|
Boost-Build : |
From: Vladimir Prus (ghost_at_[hidden])
Date: 2008-05-12 13:59:10
On Tuesday 06 May 2008 16:33:56 Frank Birbacher wrote:
> Hi!
>
> From the beginning of using BJam I repeatedly run into the following
> problem:
>
> I have several projects where sources are distributed in different
> directories. These projects usually build a client and a serer
> executable as well as a client shared library. These targets share
> common code. I put this code into a single directory and the other
> sources are split up into "server", "client", and "lib" directories.
>
> How am I supposed to build the "common" code in a way that
> (1) compiles the code only once for each build variant
> (2) works regardless of link=shared or static
> (3) works with gcc and msvc alike
>
> My first guess was:
>
> # in /common dir:
> lib common : [ glob *.cpp ] /boost//filesystem ... ;
>
> # in /server dir:
> exe server : [ glob *.cpp ] ../common//common ;
>
> This satisfies (1), but (2) only when using gcc, because for DLLs I
> would have to litter the code with __declspec(dllim-/export) which I
> don't want to. If I only do a static build then the boost libs will be
> linked statically, too, which I don't want to. Mixing dyn boost libs
> with a static common lib opens another can of worms.
>
> Second guess:
>
> alias common : [ glob *.cpp ] /boost//filesystem ... ;
>
> This satisfies (2) and (3), but for each use the code is compiled again,
> increasing compile times significantly: the "server", the "client", and
> the "lib" each compile the code again.
I'd suggest this:
lib common_proper : [ glob *.cpp ] <link>static ;
alias common : common_proper /boost//filesystem ;
- Volodya
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