Boost logo

Boost-Build :

Subject: Re: [Boost-build] Using properties of a concrete target
From: Niklas Angare (li51ckf02_at_[hidden])
Date: 2015-09-25 05:24:43


"Vladimir Prus" <vladimir.prus_at_[hidden]> wrote:
> You can use
>
> toolprefix on $(<) = nto$(qnxarch)- ;
>
> so that the 'toolprefix' variable is set for a particular engine target,
> as opposed to
> globally.

Perfect, thanks!

> > rule generate-postprocess ( project name : property-set : source )
> > {
> > local result ;
> >
> > # Create a new action
> > local a = [ new non-scanning-action $(source) :
> > $(__name__).postprocess : $(property-set) ] ;
>
> If you want to use different actions for different architectures, you can
> do:
>
> local architecture = [ $(property-set).get <architecture> ] ;
>
> and then create action class with different actions. Is that what you're
> after?

I'm not sure what an "action class" is but your method of getting the
property helped a lot. It's confusing that you seemingly have to use
different syntax to do the same thing in different contexts.

Here's the new generate-postprocess that does post-processing if the target
os is QNX and just copies the file(s) otherwise:

import common ;

rule generate-postprocess ( project name : property-set : sources * )
{
    local targets ;

    for local s in $(sources)
    {
        local a;
        local os = [ $(property-set).get <target-os> ] ;

        # Create a new action appropriate for the target os
        if $(os) = qnxnto
        {
            a = [ new non-scanning-action $(s) :
                $(__name__).postprocess-qnx : $(property-set) ] ;
        }
        else
        {
            a = [ new non-scanning-action $(s) :
                common.copy : $(property-set) ] ;
        }

        # Create a target to represent the action result. Uses the target
name
        # passed here via the 'name' parameter and the same type and project
as
        # the source.
        targets += [ new file-target $(name) : [ $(s).type ] :
            $(project) : $(a) ] ;
    }

    return [ sequence.transform virtual-target.register : $(targets) ] ;
}

Thanks for your help!

Regards,

Niklas Angare


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