From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,9410ebc184a96b6d,start X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "Alex R. Mosteo" Newsgroups: comp.lang.ada Subject: Sharing tips for GNAT project files Date: Wed, 20 Feb 2008 14:33:58 +0100 Message-ID: <622oi9F20uiifU1@mid.individual.net> Reply-To: alejandro@mosteo.com Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: individual.net e1/1Asp5MrffkDXRMOmgQwSu8ZNPKjNZbmsB1p0qV+VcbEkBM= Cancel-Lock: sha1:SCstk79pZBCLKj1S2AChc697MDE= User-Agent: Thunderbird 2.0.0.6 (X11/20071022) Xref: g2news1.google.com comp.lang.ada:19909 Date: 2008-02-20T14:33:58+01:00 List-Id: 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;