comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <stephen_leake@stephe-leake.org>
Subject: Re: gnat Project files
Date: Thu, 05 Nov 2009 05:22:50 -0500
Date: 2009-11-05T05:22:50-05:00	[thread overview]
Message-ID: <uskctp8xx.fsf@stephe-leake.org> (raw)
In-Reply-To: 316f58b2-1151-4124-a416-e0345be66474@x15g2000vbr.googlegroups.com

"RasikaSrinivasan@gmail.com" <rasikasrinivasan@gmail.com> writes:

> I have a "common.gpr" for a number of projects. I was hoping I could
> define Exec_Dir, Object_Dir etc in just in the common.gpr. But it does
> not appear to be inherited in the lower level gprs. Am I missing
> something?

Yes :).

One use of project files is to keep separate sets of sources and build
directories for each project, so higher-level projects can share
lower-level projects.

For example, I have this directory structure:

GDS -- top level
    sal -- math and other utilities
        build
            x86_gnu_windows     -- native Windows
            x86_gnu_lynx_linux  -- cross target Linux to Lynx
            x86_gnu_linux       -- native Linux
        source -- *.ad[sb]

    common -- core GDS stuff
       build
            x86_gnu_windows     -- native Windows
            x86_gnu_lynx_linux  -- cross target Linux to Lynx
            x86_gnu_linux       -- native Linux
        source -- *.ad[sb]

    smm -- music manager
        build
            x86_gnu_windows     -- native Windows

Each x86_* directory has a project file, and local obj subdirectory.
Exec_Dir has the default value of the x86_* directory; that's where
test executables get built.

smm and common both use sal, but they have nothing else in common. The
compiler only has to compile sal once, when compiling smm or common.


You can also set compiler options in a common gpr file, and then use
renames on the compiler package:

project Shared is

    package Compiler is
        for Default_Switches ("Ada") use ("-gnat05");

        -- other switches
    end Compiler;
end Shared;

with "shared";
project Common is

    package Compiler renames Shared.Compiler;

end Common;

-- 
-- Stephe



      parent reply	other threads:[~2009-11-05 10:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-04  2:02 gnat Project files RasikaSrinivasan@gmail.com
2009-11-04  9:09 ` Dmitry A. Kazakov
2009-11-04 13:23   ` AdaMagica
2009-11-04 14:20     ` Hibou57 (Yannick Duchêne)
2009-11-04 14:39       ` AdaMagica
2009-11-04 17:51         ` Robert A Duff
2009-11-04 14:50       ` Dmitry A. Kazakov
2009-11-04 15:29         ` Hibou57 (Yannick Duchêne)
2009-11-05 10:22 ` Stephen Leake [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox