comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: Q: Multiple GNAT project files and object directories
Date: Tue, 09 Jul 2013 22:42:03 +0100
Date: 2013-07-09T22:42:03+01:00	[thread overview]
Message-ID: <lyvc4jwgus.fsf@pushface.org> (raw)
In-Reply-To: 062c95f8-445d-49f1-8bd2-76481f146cf7@googlegroups.com

gautier_niouzes@hotmail.com writes:

> How do I force all object files to land into a single directory,
> including the object files of "with"-ed projects ?

I think it's a design feature of GNAT Project that you can't.

> With
>    for Object_Dir use "obj";
> only the object files for the project are put into it.

> The "with"-ed projects have their own Object_Dir's, and their object
> files appear there. Fair enough.

> Now I have a more complicated situation: a main project with different
> build modes. So the Object_Dir depends on this build mode:

>    case Build_Mode is
>       when "Debug" =>
>          for Object_Dir use "../obj/debug";
>       when "Fast" =>
>          for Object_Dir use "../obj/fast";
>       when "Profiling" =>
>          for Object_Dir use "../obj/profiling";
>    end case;

> The snag is: the "with"-ed projects do not know about that and use
> only their own single Object_Dir. GNAT is smart enough to recompile
> everything in the "with"-ed projects upon a build mode change. But it
> makes the build very long each time a mode is changed. At worst we
> would have different sets of compiler options in the object files to
> be linked.

Are you sure that GNAT will recompile the 'with'ed projects? I don't
believe I've ever seen it do so.

Unless, of course, the 'with'ed projects use a common project to pick up
the compiler options they're supposed to use.

In which case, why not use the common project to specify an object
subdirectory?

project Common is
   type Modes is ("debug", "profiling", "fast");
   Mode : Modes := external ("MODE", "debug");
   for Source_Files use ();
end Common;

with "common";
project User is
   for Main use ("hello.adb");
   for Object_Dir use ".user/" & Common.Mode;
   for Exec_Dir use ".";
end User;

  parent reply	other threads:[~2013-07-09 21:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-09 20:44 Q: Multiple GNAT project files and object directories gautier_niouzes
2013-07-09 21:27 ` Dmitry A. Kazakov
2013-07-09 21:42 ` Simon Wright [this message]
2013-07-10  8:00   ` gautier_niouzes
2013-07-10  8:28   ` Pascal Obry
2013-07-10 12:37     ` Simon Wright
2013-07-10 13:34       ` gautier_niouzes
2013-07-10 17:44         ` J-P. Rosen
2013-07-10 19:45           ` Simon Wright
2013-07-11  3:45           ` gautier_niouzes
2013-07-10 19:53         ` Simon Wright
2013-07-11  4:21           ` gautier_niouzes
replies disabled

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