* Sharing tips for GNAT project files
@ 2008-02-20 13:33 Alex R. Mosteo
0 siblings, 0 replies; only message in thread
From: Alex R. Mosteo @ 2008-02-20 13:33 UTC (permalink / raw)
Hello,
I'm posting here my default project file, so interested people can look
at it and suggest improvements.
With this project file I can build a set of files as a library (static
or dynamic), which will compile all source files, or pulling in only the
"withed" files. It also includes several optimization settings.
--8<--
project Template is
type Yes_No is ("Yes", "No");
for Languages use ("Ada");
-- , "C", "C++");
for Source_Dirs use ("src");
for Object_Dir use "obj";
for Exec_Dir use "obj";
Lib_Name := "template";
Lib_Version := "20070102";
type Build_Type is ("Debug", "Release", "No_Options", "Profile");
type Linking_Type is ("Dependencies", "Static_Library",
"Dynamic_Library");
Build : Build_Type := external ("Template_Build", "Debug");
Link : Linking_Type := External ("Template_Link", "Dependencies");
case Link is
when "Dependencies" =>
null;
when "Static_Library" =>
for Library_Dir use "libstatic";
for Library_Name use Lib_Name;
for Library_Kind use "Static";
for Library_Version use Lib_Name & ".a." & Lib_Version;
when "Dynamic_Library" =>
for Library_Dir use "libdynamic";
for Library_Name use Lib_Name;
for Library_Kind use "Dynamic";
for Library_Version use Lib_Name & ".so." & Lib_Version;
end case;
Include_Test : Yes_No := external ("Template_Include_Test", "Yes");
case Include_Test is
when "Yes" => for Source_Dirs use project'Source_Dirs & "test";
when "No" => null;
end case;
package Ide is
for Vcs_Kind use "Subversion";
end Ide;
package Compiler is
for Default_Switches ("C") use ("-g", "-Wall", "-O2");
for Default_Switches ("C++") use ("-g", "-Wall", "-O2");
for Default_Switches ("Ada") use
("-g", "-gnatf", "-gnat05",
"-gnatwcfjklmopruvz", "-gnatyacehikn", "-gnatqQ");
case Build is
when "Profile" =>
for Default_Switches ("Ada") use
Compiler'Default_Switches ("Ada") &
("-O2", "-gnato", "-fstack-check", "-gnata", "-gnatpg");
when "Debug" =>
for Default_Switches ("Ada") use
Compiler'Default_Switches ("Ada") &
("-O2", "-gnato", "-fstack-check", "-gnata");
when "Release" =>
for Default_Switches ("Ada") use
Compiler'Default_Switches ("Ada") &
("-O3", "-gnatn", "-gnatN");
for Default_Switches ("C") use
Compiler'Default_Switches ("C") & ("-O3");
for Default_Switches ("C++") use
Compiler'Default_Switches ("C") & ("-O3");
when "No_Options" =>
for Default_Switches ("Ada") use ("-gnat05");
-- Deliberately override default switches not to have any!
end case;
end Compiler;
package Binder is
for Default_Switches ("Ada") use ("-E", "-g"); -- , "-r");
-- "Show restrictions
end Binder;
package Linker is
for Default_Switches ("Ada") use ("-g", "-Wl,--gc-sections");
for Default_Switches ("C") use ("-g");
for Default_Switches ("C++") use ("-g");
end Linker;
package Builder is
for Default_Switches ("Ada") use ("-g");
-- , "-j2"); -- Two files at a time
end Builder;
package Pretty_Printer is
for Default_Switches ("Ada") use ("-A1", "-A2", "-A3", "-A4");
end Pretty_Printer;
package Naming is
for Specification_Suffix ("C") use ".h";
for Implementation_Suffix ("C") use ".c";
for Specification_Suffix ("C++") use ".hh";
for Implementation_Suffix ("C++") use ".cc";
for Specification_Suffix ("Changelog") use "changelog";
for Specification_Suffix ("Project file") use ".gpr";
for Specification_Suffix ("Python") use ".py";
end Naming;
end Template;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-02-20 13:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-20 13:33 Sharing tips for GNAT project files Alex R. Mosteo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox