|
Boost-Build : |
From: Denis N. Kononenko (denisn.kononenko_at_[hidden])
Date: 2006-11-20 13:50:21
2006/11/20, Vladimir Prus <ghost_at_[hidden]>:
> On Saturday 18 November 2006 23:25, Denis N. Kononenko wrote:
>
> > Would you enlighten me on another question? Is it possible to write a
> > custom generator with variable number of output files depending on
> > features? Currently I use a long list of all possible generated types
> > and touch files that may not be generated.
>
> Yes, it's possible but you have to define a new generator class. If you tell
> me more details about your generator, I can create a quick-n-dirty and not
> working example, add it to examples directory and then you can make it work
> for your specific use case.
I can send you full version of my gsoap.jam. But I'm afraid that it's
too complicated module in order to be an example. :)
The problem lay in the three usage scenarios of 3rd party tool. The
tool can generate C++ proxies either for client or server
implementation depending on command line options. E.g. if we specify
option '-C' the tool will generate a %Client.cpp file, in case of
option '-S' a file %Server.cpp will be generated. For both
configurations the tool generates common files, these are %ó.cpp, %H.h
and %Stub.h. If we don't specify any of above options then all files
will be generated.
I use straightforward inelegant solution:
===
import feature : feature ;
# all -- client and server side proxies (default)
# client -- client only proxies
# server -- server only proxies
feature gsoap-target-type : all client server : propagated ;
import toolset : flags ;
flags gsoap.compile.cws GSOAP_TARGET_TYPE <gsoap-target-type>server : -S ;
flags gsoap.compile.cws GSOAP_TARGET_TYPE <gsoap-target-type>client : -C ;
generators.register-c-compiler gsoap.compile.cws : CWS
: CPP(%C)
CPP(%Client)
CPP(%Server)
H(%H)
H(%Stub) ;
# [2] -- %Client.cpp (will be empty for server target type)
# [3] -- %Server.cpp (will be empty for client target type)
actions compile.cws
{
$(GSOAP_SOAPCPP2) -p$(>[1]:B) $(GSOAP_COMPILE_FLAGS)
$(GSOAP_TARGET_TYPE) -d$(<[2]:D) $(>)
$(TOUCH) $(<[2]:W)
$(TOUCH) $(<[3]:W)
}
===
As you can see I simply touch missing files. But it's very unefficient
solution. :(
WBR,
Denis.
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