|
Boost-Build : |
From: Vladimir Prus (ghost_at_[hidden])
Date: 2006-02-10 07:21:24
Hi Chris,
> > If that's not feasible, you can create your own target type, say
> > "MY_CONVERTED_CPP", derived from CPP. Then you can define a custom
> > generator for your type, and:
> >
> > - mark the generator as 'composing'
> > - make the generator produce a pair of target for each source
>
> Okay. I tried that, but unfortunately I don't yet understand enough of
> what's going on to solve one remaining puzzle.
.......
> rule generated-targets ( sources + : property-set : project name ? )
> {
> # Create generated targets for source file
> local targets ;
> for local s in $(sources)
> {
> targets += [ generator.generated-targets $(sources)
.......
I think I was unclear in my previous email. By 'produce a pair of targets for
each source' I mean 'by directly constructing file-target and action
instances'.
The code you have now creates one target for each source. That target has all
sources as sources, and 'src.convert' as updating action, so the action is
run once for each source. In other word, you create one instance of the
'action' class for each source.
Here's the right code:
local a = [ new action $(sources) : src.convert : $(property-set) ] ;
local targets ;
for local s in $(sources)
{
targets += [ new file-target
[ utility.basename [ $(s).name ] ]
: CPP
: $(project)
: $(a) ] ;
}
return $(targets) ;
First, you create a *single* instance of 'action', having all sources as
input. Then you create a number of result targets, each associated with just
created action.
I attach the testcase I've used to check that the above works.
- Volodya
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