Boost logo

Boost-Build :

From: Max Stroev (stroev_at_[hidden])
Date: 2005-04-13 09:42:29


>> The last code examples override the 'run' rule of a generator. You
>> can use it to select all .a targets and then
>> - construct XXX from all sources
>> - construct YYY from XXX and all .a files
>> - construct ZZZ
>> When construction can be done by recursive call to
>> generators.construct.

As a result I use the followed code:

type.register XXX : xxx ;
generators.register-composing egcc.xxx-link : OBJ LIB : XXX ;

type.register YYY : yyy ;
generators.register-composing egcc.yyy-link : XXX LIB : YYY ;

class egcc-linking-generator : linking-generator
{
rule run ( project name ? : property-set : sources * : multiple ? )
{
local libs ;
for local s in $(sources)
{
if [ type.is-derived [ $(s).type ] LIB ]
{
libs += $(s) ;
}
}

local xxx-result = [ generators.construct $(project) $(name) : XXX : $(property-set)
: $(sources) ] ;
local yyy-result = [ generators.construct $(project) $(name) : YYY : $(property-set)
: $(xxx-result) $(libs) ] ;

return [ construct-result $(yyy-result) : $(project) $(name) : $(property-set)
] ;
}
}

generators.register [ new egcc-linking-generator egcc.link : LIB OBJ : EXE
: <toolset>egcc ] ;

actions xxx-link bind LIBRARIES
{
# construct XXX from all sources
}

actions cof-link bind LIBRARIES
{
# construct YYY from XXX and all .a files
}

actions link
{
# construct ZZZ form YYY
}

Is everything correct?

Truly yours, Max Stroev

 


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