|
Boost-Build : |
Subject: Re: [Boost-build] eval default property fails
From: Vladimir Prus (ghost_at_[hidden])
Date: 2010-11-13 03:08:40
On Saturday, November 13, 2010 10:06:59 Oliver Kowalke wrote:
> Hi,
> in my Jamfile I add a new property/feature called 'abi' which should get
> an default value (calculated by 'default_abi()'):
>
> local rule eval_architecture ( properties * )
> {
> local result = "" ;
> ...
> return $(result) ;
> }
>
> local rule default_abi ( properties * )
> {
> local result = sysv ;
> local arch = [ eval_architecture $(properties) ] ;
>
> if <target-os>windows in $(properties) { result = ms ; }
> else if $(arch) = "arm" { result = aapcs ; }
> return $(result) ;
> }
>
> feature.feature abi
>
> : aapcs
>
> eabi
> ms
> n32
> n64
> o32
> o64
> sysv
>
> : propagated
>
> ;
> feature.set-default abi : [ default_abi $(properties) ] ;
>
> The problem is, that 'local arch = [ eval_architecture $(properties) ]'
> in 'default_abi()' does not evaluate 'properties'. It seams that
> 'properties' contains nothing.
Yes, indeed, because there's no such variable in the scope of Jamfile, unless
you have defined such variable yourself.
> How do I have to pass 'properties' to 'default_abi()' invoked in
> 'feature.set-default abi' so that 'eval_architecture()' can inspect the
> builtin-proprties like <archtiecture>, <instructions-set>, <target-os> etc.
Please understand that each Jamfile is read exactly once. Further, the default
value of a feature is set globally for a given Boost.Build run, while a given
metatarget can be generated many times, with different values of
<architecture> and <target-os> and what not. Therefore, it's not
possible to set default value of a feature like that.
I suggest you use indirect conditional requirements for your purposes
(documented in the manual), so that the value of 'abi' is defaulted
appropriately to the build properties.
- Volodya
-- Vladimir Prus http://vladimir_prus.blogspot.com Boost.Build: 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