Ada 程式設計/平臺/可移植構建
外觀
GPRbuild 可用於構建可移植的構建。
為所有支援平臺通用的平臺無關程式碼建立專案。
portable.gpr
projectPortableisforMainuse("portable.adb"); -- GPS uses this to start the executableforExec_Diruse"bin";forSource_Dirs use ("src");endPortable;
例如,使用 GPS 或 GPRbuild 開啟 portable-windows.gpr 以構建 Windows 專案。
portable-windows.gpr
projectPortable.Windowsextends"portable.gpr"is-- Object for Windows ResourcesforLanguagesuse("Ada", "WinRes");forSource_Dirsuse("windows", "resources");forObject_Diruse"windows-obj"; -- This should be the same as the parent project -- or the executable will be placed on the object directoryforExec_Diruse"bin";packageLinkerisfor Default_Switches ("Ada") use ("-lgdi32", "windows-obj/resources.o", "-mwindows");endLinker;packageCompilerisforDriver ("WinRes")use"windres";forDefault_Switches ("WinRes")use("--target=pe-x86-64");forLeading_Required_Switches ("WinRes")use("-i");forObject_File_Suffix ("WinRes")use".o";endCompiler;packageNamingisforBody_Suffix ("WinRes")use".rc";endNaming;endPortable.Windows;
