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=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Q: Multiple GNAT project files and object directories Date: Tue, 09 Jul 2013 22:42:03 +0100 Organization: A noiseless patient Spider Message-ID: References: <062c95f8-445d-49f1-8bd2-76481f146cf7@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx05.eternal-september.org; posting-host="a849a84efccf4ec3e3fdf530b5c53bc9"; logging-data="25925"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+BOrqt+4Q07fHelNBpXdqV18pd80PO4ts=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (darwin) Cancel-Lock: sha1:pLe41O6mPZ2thSjkELsOewwBJ+E= sha1:RqNcQMyUO8iEfbMfR33+wWH6ynY= Xref: news.eternal-september.org comp.lang.ada:16233 Date: 2013-07-09T22:42:03+01:00 List-Id: 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;