Boost logo

Boost-Build :

From: Daniel Einspanjer (deinspanjer_at_[hidden])
Date: 2006-02-07 14:10:50


Hrm. I'm sorry, I should have read the new FAQ entry before I posted this.

The FAQ entry makes it sound like what I am wanting to do as a one liner is
not possible.
It sounds lie I would have to either create a feature.compose for every
customer I define or use conditional requirements for each customer I define
in the project section.

Does this sound correct that there is no one liner I can write that won't
require maintenance when adding customers?

If that is the case, should I do this as a feature.compose as I did the
extra <customer>internal define or should I do it as a conditional
requirement in the project?

"Daniel Einspanjer" <deinspanjer_at_[hidden]> wrote in message
news:dsaqkc$n5q$1_at_sea.gmane.org...
> Ohh Ohh! I have been struggling with trying to learn how to do this.
> This example allowed me to at least see the value of my <customer>
> feature.
> The next step for me is finding a way to be able to make a <define> based
> on
> the value of <customer>.
> e.g. In my main project, I would like to have the following in my
> requirements section:
> <define>CUSTOMER=$(customer)
>
> I can't find a syntax that would allow me to do that.
>
> If someone could spare just a moment to point me at some documentation
> that
> demonstrates anything like this I would greatly appreciate it.
>
> Just in case, here is the relevant portion of my jamroot:
>
> # Set up our customer variable as a variant that can be specified on the
> command line e.g.
> feature customer : internal foo bar : implicit composite propagated
> symmetric ;
> feature.set-default customer : internal ;
>
> # customize the internal customer to set this extra define.
> feature.compose <customer>internal: <define>_AN_INTERNAL_BUILD ;
>
> import notfile ;
> notfile test : @print-customer ;
> rule print-customer ( targets * : sources * : properties * )
> {
> ECHO "Customer = " [ feature.get-values <customer> : $(properties) ] ;
> }
>
> project testproject
> : requirements
>
> # <define>CUSTOMER=[ feature.get-values <customer> :
> $(properties) ]
>
>
> Thanks,
>
> Daniel
>
> "Vladimir Prus" <ghost_at_[hidden]> wrote in message
> news:200602071554.31337.ghost_at_cs.msu.su...
>> On Sunday 05 February 2006 14:31, Jaroslav Gresula wrote:
>>> Could someone advise me how to retrieve value of a feature within a
>>> rule? I followed an example from the docs which uses the toolset.flags
>>> rule but with no luck.
>>>
>>> Below is my attempt, but the TOOLSET variable expands to an empty
>>> string.
>>>
>>> ---
>>> local rule this-module-rule ( ) { return [ CALLER_MODULE ] ; }
>>> local this-module = [ this-module-rule ] ;
>>>
>>> import toolset ;
>>> toolset.flags $(this-module).print-toolset TOOLSET : <toolset> ;
>>>
>>> rule print-toolset ( )
>>> {
>>> ECHO $(TOOLSET) ;
>>> }
>>>
>>> alias main : : [ print-toolset ] ;
>>
>> This code is executed during Jamfile parsing stage. It calls the rule
>> 'print-toolset', that immediately executes "ECHO", but the value of
>> $(TOOLSET) is empty, because it's only set when bjam starts executing
>> actions, and only if 'print-toolset' is the updating action for some
>> target.
>>
>> Try this:
>>
>> import notfile ;
>> import toolset ;
>> import feature ;
>>
>> notfile test : @print-toolset ;
>>
>> rule print-toolset ( targets * : sources * : properties * )
>> {
>> ECHO "Toolset = " [ feature.get-values <toolset> : $(properties) ] ;
>> }
>>
>> Note that if you run "bjam" with two different toolsets, say:
>>
>> bjam gcc intel
>>
>> you'll see two "Toolset = " lines, one for each time "test" is built.
>>
>> You might also want to check the newly added FAQ item:
>>
>> http://boost.org/boost-build2/doc/html/bbv2/faq.html#id2577795
>>
>> HTH,
>> Volodya
>>
>>
>>
>>
>>
>> _______________________________________________
>> Unsubscribe & other changes:
>> http://lists.boost.org/mailman/listinfo.cgi/boost-build
>>
>
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost-build
>


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