Boost logo

Boost :

From: Sylvain, Gregory M (GSylvain_at_[hidden])
Date: 2005-07-12 16:11:00


Hello all,

We are currently using boost_1_32_0 and I'm trying to write a toolset file to enable us to use Roguewave's LEIF xsd2cpp C++ class generator from within bjam. (The xsd2cpp command is just a C++ class generator that generates C++ class from a respective W3C XSD Schema).

I'm not having much luck, I've been through the boost build manual, samples, etc. and I'm still having problems.

In the end, I would like to be able to write a library rule such as :

lib libclientxml
        :
        schemas.xsd
;

And have boost run RW's xsd2cpp tool run on the file schemas.xsd and all of the resulting cpp files that are generated would be compiled and archived in libclientxml.

I have a toolset file in my boost-build/tools directory as follows:

---- begin file boost-build/tools/xsd2cpp.jam ----
import type ;
type.register XSD : xsd ;

import generators ;

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

      # after the actions is executed, get a list of the generated targets that
        # results from this action
        rule generated-targets ( sources * : property-set : project name ?)
        {
                local leafs ;
                local temp = [ virtual-targets.traverse $(sources[1]) : : include-sources ] ;
                for local f in $(temp)
                {
                        leafs += $(f) ;
                }
                return [ generator.generated-targets $(sources) $(leafs)
                        : $(property-set) : $(project) $(name) ] ;
        }

}

generators.register
        [ new cpp-generator xsd2cpp.xsd2cpp : XSD : CPP ] ;

actions xsd2cpp
{
        # run RW's xsd2cpp command over the source and produce a lot of C++ code.
        xsd2cpp -STL "$(>)"
}
---- end file boost-build/tools/xsd2cpp.jam ----

If anyone has a clue how to do this, please let me know. Or if I've going about this the wrong way, I would like to here that as well.

Thanks for any assistance with this,
greg


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk