List Info

Thread: how to preprocess all source files in a single step




how to preprocess all source files in a single step
user name
2006-02-10 12: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



import src ;
my-converted-cpp my_processed : a.src b.src
;_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )