comp.lang.ada
 help / color / mirror / Atom feed
* gnat Project files
@ 2009-11-04  2:02 RasikaSrinivasan@gmail.com
  2009-11-04  9:09 ` Dmitry A. Kazakov
  2009-11-05 10:22 ` Stephen Leake
  0 siblings, 2 replies; 9+ messages in thread
From: RasikaSrinivasan@gmail.com @ 2009-11-04  2:02 UTC (permalink / raw)


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?

thanks, srini



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: gnat Project files
  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-05 10:22 ` Stephen Leake
  1 sibling, 1 reply; 9+ messages in thread
From: Dmitry A. Kazakov @ 2009-11-04  9:09 UTC (permalink / raw)


On Tue, 3 Nov 2009 18:02:21 -0800 (PST), RasikaSrinivasan@gmail.com wrote:

> 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.

Yes, I have the same problem too. So far the best solution I know is:

with "common.gpr";
project Dependent is
   for Object_Dir use Common'Object_Dir;
   ...

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: gnat Project files
  2009-11-04  9:09 ` Dmitry A. Kazakov
@ 2009-11-04 13:23   ` AdaMagica
  2009-11-04 14:20     ` Hibou57 (Yannick Duchêne)
  0 siblings, 1 reply; 9+ messages in thread
From: AdaMagica @ 2009-11-04 13:23 UTC (permalink / raw)


> Yes, I have the same problem too. So far the best solution I know is:
>
> with "common.gpr";
> project Dependent is
>    for Object_Dir use Common'Object_Dir;

This is not the best solution, it's *the* solution AdaCore has in mind.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: gnat Project files
  2009-11-04 13:23   ` AdaMagica
@ 2009-11-04 14:20     ` Hibou57 (Yannick Duchêne)
  2009-11-04 14:39       ` AdaMagica
  2009-11-04 14:50       ` Dmitry A. Kazakov
  0 siblings, 2 replies; 9+ messages in thread
From: Hibou57 (Yannick Duchêne) @ 2009-11-04 14:20 UTC (permalink / raw)


On 4 nov, 14:23, AdaMagica <christoph.gr...@eurocopter.com> wrote:
> > Yes, I have the same problem too. So far the best solution I know is:
>
> > with "common.gpr";
> > project Dependent is
> >    for Object_Dir use Common'Object_Dir;
>
> This is not the best solution, it's *the* solution AdaCore has in mind.

Currently, I do not use GPS, nor the GNAT project facilities, but
still have a question : is it possible to use a relative path for this
common path ? I mean, a relative path which would be interpreted
relatively to another path specific to each project.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: gnat Project files
  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
  1 sibling, 1 reply; 9+ messages in thread
From: AdaMagica @ 2009-11-04 14:39 UTC (permalink / raw)


On 4 Nov., 15:20, Hibou57 (Yannick Duchêne) <yannick_duch...@yahoo.fr>
wrote:
> Currently, I do not use GPS, nor the GNAT project facilities, but
> still have a question : is it possible to use a relative path for this
> common path ? I mean, a relative path which would be interpreted
> relatively to another path specific to each project.

You can specify an abolute or releative path, or you can use an
environment variable for project file paths.

with "../Relative_Path/common";
with "/Absolute_Path/something";
project Dependent is ...



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: gnat Project files
  2009-11-04 14:20     ` Hibou57 (Yannick Duchêne)
  2009-11-04 14:39       ` AdaMagica
@ 2009-11-04 14:50       ` Dmitry A. Kazakov
  2009-11-04 15:29         ` Hibou57 (Yannick Duchêne)
  1 sibling, 1 reply; 9+ messages in thread
From: Dmitry A. Kazakov @ 2009-11-04 14:50 UTC (permalink / raw)


On Wed, 4 Nov 2009 06:20:32 -0800 (PST), Hibou57 (Yannick Duch�ne) wrote:

> On 4 nov, 14:23, AdaMagica <christoph.gr...@eurocopter.com> wrote:
>>> Yes, I have the same problem too. So far the best solution I know is:
>>
>>> with "common.gpr";
>>> project Dependent is
>>> � �for Object_Dir use Common'Object_Dir;
>>
>> This is not the best solution, it's *the* solution AdaCore has in mind.
> 
> Currently, I do not use GPS, nor the GNAT project facilities, but
> still have a question : is it possible to use a relative path for this
> common path ? I mean, a relative path which would be interpreted
> relatively to another path specific to each project.

Sure. For example:

 � for Object_Dir use "../../" & Common'Object_Dir;

P.S. '/' works under Windows as if it were '\'. Also you should better use
all quoted file names in lower case to make it working under both Linux and
Windows.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: gnat Project files
  2009-11-04 14:50       ` Dmitry A. Kazakov
@ 2009-11-04 15:29         ` Hibou57 (Yannick Duchêne)
  0 siblings, 0 replies; 9+ messages in thread
From: Hibou57 (Yannick Duchêne) @ 2009-11-04 15:29 UTC (permalink / raw)


Thanks to you both for the tips

On 4 nov, 15:50, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de>
wrote:
> P.S. '/' works under Windows as if it were '\'. Also you should better use
> all quoted file names in lower case to make it working under both Linux and
> Windows.

If I may add something about general path format : on Windows, spaces
must be avoided in paths, otherwise the debugger will not work (I do
not really use it as well, but I've tried it in a near past). Note :
the GNAT compiler (on Windows) does not requires this, just the
debugger do.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: gnat Project files
  2009-11-04 14:39       ` AdaMagica
@ 2009-11-04 17:51         ` Robert A Duff
  0 siblings, 0 replies; 9+ messages in thread
From: Robert A Duff @ 2009-11-04 17:51 UTC (permalink / raw)


AdaMagica <christoph.grein@eurocopter.com> writes:

> You can specify an abolute or releative path, or you can use an
> environment variable for project file paths.
>
> with "../Relative_Path/common";
> with "/Absolute_Path/something";
> project Dependent is ...

Relative paths are relative to the directory where the project file is,
not (necessarily) relative to the current directory where you're running
the compiler.

- Bob



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: gnat Project files
  2009-11-04  2:02 gnat Project files RasikaSrinivasan@gmail.com
  2009-11-04  9:09 ` Dmitry A. Kazakov
@ 2009-11-05 10:22 ` Stephen Leake
  1 sibling, 0 replies; 9+ messages in thread
From: Stephen Leake @ 2009-11-05 10:22 UTC (permalink / raw)


"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



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2009-11-05 10:22 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox