Boost logo

Boost-Build :

From: Alexey Syomichev (asyomichev_at_[hidden])
Date: 2004-12-25 11:52:35


David Abrahams wrote:
> Alexey Syomichev wrote:
>>I need to preprocess some header files with a perl script. Say, I have
>>"a.cpp" that includes "a.hpp", which needs to be created first from
>>"a.h". I need to 1) run the perl script taking a.h and creating a.hpp
>>and then to 2) compile a.cpp as part of the library. Also I need to keep
>>track of the dependency between a.h and a.cpp.
>
> Meaning that you might later hand-edit a.h?

Well, yes. In case ".h" changes, ".hpp" must be re-generated, ".cpp"
recompiled and library relinked.

>>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? 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?

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?

Thanks,
-Alexey

 


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