Boost logo

Boost-Build :

Subject: [Boost-build] different macros for same object file
From: Yelve Yakut (yelve_yakut_at_[hidden])
Date: 2009-11-26 13:47:35


Hi

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.

Regards,
Yelve Yakut

Example:

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

---- controller.cpp: -----
#include <iostream>
using namespace std;

#ifdef CONTROL_SYSTEM
int main() {
# else
int control_main() {
#endif
    cout << "controller" << endl;
}

---- linapp.cpp: -----
#include <iostream>
using namespace std;

#ifdef CONTROL_SYSTEM
int linapp_main() {
# else
int main() {
#endif
    cout << "standard linux app" << endl;
}


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