Ada Programming/Platform/Portable builds
Appearance
GPRbuild can be used to make portable builds.
Platform-independent code
[edit | edit source]Create a project for platform-independent code which is common to all supported platforms.
portable.gpr
project
Portableis
for
Mainuse
("portable.adb"); -- GPS uses this to start the executablefor
Exec_Diruse
"bin";for
Source_Dirs use ("src");end
Portable;
Platform-specific code
[edit | edit source]For example, open portable-windows.gpr with GPS or GPRbuild to build a project for Windows.
portable-windows.gpr
project
Portable.Windowsextends
"portable.gpr"is
-- Object for Windows Resourcesfor
Languagesuse
("Ada", "WinRes");for
Source_Dirsuse
("windows", "resources");for
Object_Diruse
"windows-obj"; -- This should be the same as the parent project -- or the executable will be placed on the object directoryfor
Exec_Diruse
"bin";package
Linkeris
for Default_Switches ("Ada") use ("-lgdi32", "windows-obj/resources.o", "-mwindows");end
Linker;package
Compileris
for
Driver ("WinRes")use
"windres";for
Default_Switches ("WinRes")use
("--target=pe-x86-64");for
Leading_Required_Switches ("WinRes")use
("-i");for
Object_File_Suffix ("WinRes")use
".o";end
Compiler;package
Namingis
for
Body_Suffix ("WinRes")use
".rc";end
Naming;end
Portable.Windows;