< Ada Programming < Platform

Ada. Time-tested, safe and secure.
GPRbuild can be used to make portable builds.
Platform-independent code
Create a project for platform-independent code which is common to all supported platforms.
portable.gpr
projectPortableisforMainuse("portable.adb"); -- GPS uses this to start the executableforExec_Diruse"bin";forSource_Dirs use ("src");endPortable;
Platform-specific code
For example, open portable-windows.gpr with GPS or GPRbuild to build a project for 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;
This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.