Subject: Re: [Boost-build] different macros for same object file
From: Vladimir Prus (ghost_at_[hidden])
Date: 2009-11-26 14:41:28
On Thursday 26 November 2009 21:47:35 Yelve Yakut wrote:
> I'd like to be able to build two different versions of the same
> project, depending on macro definitions. (see example below)
> The object files differ depending on a <define> and the problem is
> that boost is using the same folder for object files and can not tell
> which file is affected by the definition and has to be compiled anew.
> Is there a way to tell boost to use another bin directory for the other project?
> In the following example the compilation of two projects will result
> in the very same executable, depending on which project has been
> compiled first.
> Yelve Yakut
> ---- Jamroot ---
> alias sharedmem : ...... ;
> alias dependencies : .... ;
> exe linuxapp : [ glob ./src/*.c ] [ glob ./src/*.cpp ] dependencies sharedmem ;
> install linux : linuxapp : <location>./ ;
> exe realtimeapp : [ glob ./src/*.c ] [ glob ./src/*.cpp ] dependencies
> sharedmem : <define>CONTROL_SYSTEM <define>PREEMPT_PATCH ;
> install realtime : realtimeapp : <location>./ ;
try the following:
import feature ;
feature.feature realtime : off on : composite propagated ;
feature.compose <realtime>on : <define>CONTROL_SYSTEM <define>PREEMPT_PATCH ;
exe app : [ glob ./src/*.c ] [ glob ./src/*.cpp ] dependencies sharedmem ;
install dist : app app/<realtime>on : <location>. ;
This way, you introduce a feature with a fixed set of values to control your build
mode, and <realtime>on> will expand to defines you need. And because this new feature
has specific set of values, it can be -- and will be -- represented in target paths.
Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk