Boost logo

Boost-Build :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2004-12-27 03:00:36


On Saturday 25 December 2004 19:52, Alexey Syomichev wrote:

> >>It looks like I canot register a new generator, because the suffix ".h"
> >>is already assigned to a type "H".
> >
> > How does that prevent you from registering a new generator?
>
> You are right, it does not. Following the extender manual, I was trying
> to register my own type for the sufix ".h" before I register the
> generator, which is wrong.
> Now I have a ".h -> .hpp" generator. How do i invoke it?

Well, with CVS version you'd write

hpp my_header : a.h ;

after that, you must make sure that V2 will handle #include dependency to this
generated header, see:

exe my_exe : a.cpp b.cpp : <implicit-dependency>my_header ;

The "implicit-dependency" feature says that some of my_exe sources include
targets produced by my_header. V2 will figure out which one, and dependency
should be correct.

> If I simply
> list ".h" file in "sources", nothing is happening.
> Additional generator, creating empty .cpp from .hpp, seems to do the
> trick and the .h -> .hpp generator gets invoked. When I re-run the
> build, updates happen only if I touch the .h or clean the intermediates.
> Cool!
> Two little problems: there are extra .cpp and .o files involved, which
> is just not elegant, and the dummy .cpp can clash with an existing .cpp,
> which is a more serious limitation. Is there a better way?

Yes, see above.

> One more question: during generator registration, how do I reference
> rules/actions from the local Jamfile? I created a small module
> "preprocess" and referenced an action as "preprocess.convert", which
> works. Then I tried placing the contents of "preprocess.jam" in the
> Jamfile itself and changing the reference to plain "convert", but it
> fails to look up an action by the unqualified name. Is there some magic
> qualifier for local rules/actions?

I use $(__name__).action for that purpose. Maybe it should be documented, but
then the preferred way is to create a module, to keep Jamfiles from clutter.

- 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