Boost logo

Boost-Build :

Subject: Re: [Boost-build] generator: 1-n targets
From: Anatoly Shirokov (shirokov_a_at_[hidden])
Date: 2009-10-06 05:35:24


In the attachment there is a example which produces 5 output files.

BR,
Anatoly.

Thomas Lehmann:
> Hi!
>
> having a dummy.template, how can I implement best
> to get a
>
> - dummy.h
> - dummy_manager.h
> - dummy_manager.cxx
>
> I have seen the 1-to-1 generator example and this is
> working well for me but I need three output files
> with different names. My python script can do it easily
> by the given input "dummy.template" but how can I make
> boost recogize the dummy_manager.cxx?
>
> How can I place those headers in another location than
> the manager?
>
> sincerely
> Thomas
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost-build
>
>

import type ;
import generators ;
import feature ;
import common ;
import os ;
import "class" : new ;

type.register SDH : sdh ;

class soap-generator : generator
{
    import "class" : new ;

    rule __init__ ( * : * )
    {
        generator.__init__ $(1) : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ;
    }

    rule run ( project name ? : property-set : sources * )
    {
        if ! $(sources[2])
        {
            # If no output name is specified, guess it from sources.
            if ! $(name)
            {
               name = [ generator.determine-output-name $(sources) ] ;
            }

            # Accept only single source.
            local t = [ $(sources[1]).type ] ;
            if $(t) = SDH
            {
                local a = [ new action $(sources[1]) : soap.gensrc : $(property-set) ] ;
                local t1 = [ new file-target soapc : CPP : $(project) : $(a) ] ;
                local t2 = [ new file-target soaprolisappserviceproxy : CPP : $(project) : $(a) ] ;
                local t3 = [ new file-target soaph : H : $(project) : $(a) ] ;
                local t4 = [ new file-target soapstub : H : $(project) : $(a) ] ;
                local t5 = [ new file-target soaprolisappserviceproxy : H : $(project) : $(a) ] ;

                return [ virtual-target.register $(t1) ]
                       [ virtual-target.register $(t2) ]
                       [ virtual-target.register $(t3) ]
                       [ virtual-target.register $(t4) ]
                       [ virtual-target.register $(t5) ]
                ;

            }
        }
    }
}

generators.register [ new soap-generator soap.soap : SDH : CPP H ] ;

GSOAP_ROOT = [ os.environ GSOAP_ROOT ] ;
SOAPCPP2 = $(GSOAP_ROOT)/bin/soapcpp2 ;

actions gensrc
{
    $(SOAPCPP2) -I$(GSOAP_ROOT)/import -d$(<[1]:D) -i -C -L -w -x $(>)
}


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