Boost logo

Boost-Build :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2005-08-04 02:12:40


On Thursday 04 August 2005 11:02, emildotchevski wrote:
> --- In jamboost_at_[hidden], Vladimir Prus <ghost_at_c...> wrote:
> > On Thursday 04 August 2005 09:24, emildotchevski wrote:
> > > This is a question about using different cpp files in a given lib
> > > depending on the target platform.
> >
> > Does
> >
> > lib your_lib : nt/a.cpp : <os>NT ;
> > lib your_lib : linux/a.cpp : <os>LINUX ;
> >
> > work for you? Note that you'd need nightly snapshot, or CVS
>
> version of V2
>
> > for this to work sensibly.
> >
> > HTH,
> > Volodya
> >
> > --
> > Vladimir Prus
> > http://vladimir_prus.blogspot.com
> > Boost.Build V2: http://boost.org/boost-build2
>
> Yes I tried this and it did work, thanks. I was trying something
> along the lines of:
>
> lib mylib : [ glob *.cpp ] [ glob $(OS)/*.cpp ] ;
>
> which I believe didn't work.

Yes, because the 'OS' variable is not defined in Jamfile, unless you define
it. Putting

import modules ;
constant OS : [ modules.peek : OS ] ;

to your Jamroot should do the trick, and will work for a while. But if
we eventually implement cross-compiling, this no longer work, as "OS" above
will be host os, not target os.

> And to make it perfect, I'd like to parameterize the behavior and
> leave the jamfiles for each lib to just provide the name of the lib,
> like so:
>
> simple-lib mylib ;

How about putting this to Jamroot:

rule simple-lib ( lib-name )
{
lib $(lib-name) : [ glob *.cpp ] [ glob $(OS)/*.cpp ;
}

?

-- 
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