Boost logo

Boost-Build :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2006-03-20 04:00:54


On Monday 13 March 2006 19:25, Roland Schwarz wrote:

> I am with the team that is attempting the thread rewrite, and
> we want to better manage to handle platform dependant source
> files. But I am unsure about the best practice.
>
> I.e. we want to do away with the ifdef monsters that have
> been creeping into the code, to make it more readable.
>
> For header files we choose to take the usual route to
> include platform dependant files.
>
> The issue is different for source files since it turns
> out that that the set of needed files is different for
> each platform. We could do similar as with the header
> files and just include the platform dependant source
> files from there. But I think this is not a very elegant
> solution isn't it?
>
> So my question is for some recommendations how to possibly
> handle this with bjam? Are there any examples available?

Hi Roland,

I suggest you start wtih Boost.Build V2, and then read this part of docs:

   http://boost.org/boost-build2/doc/html/bbv2/advanced/targets.html#id2572452

the example there talks about platform-dependent files, only the "platform"
there is not OS, but compiler. Replacing <toolset>XXX with <os>XXX should do
the trick for you.

You can also use the 'alias' rule to your advantage:

   lib thread : universal_source.cpp platform_sources ;
   alias platform_sources : a.cpp : <os>NT ;
   alias platform_sources : b.cpp : <os>LINUX ;

HTH,
Volodya

-- 
Vladimir Prus
http://vladimir_prus.blogspot.com
Boost.Build V2: http://boost.org/boost-build2

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