Boost logo

Boost-Build :

From: Tyson Marchuk (tmarchuk_at_[hidden])
Date: 2005-10-26 19:21:13


Is there an easy way to force boost to add the build directory to the
list of includes it uses for compiling for every file?

The reason I want it is kind of weird but if it helps I'll detail it
below.

Long-winded explanation of what I want to do follows
====================================================

Basically at our company we have a lot of QT classes where instead of
generating a MOC file from the header and compiling it and then
linking it into the library or executable we generate the MOC file
from the header and then #include it in the implementation file. In
order to allow our code to continue to build with our existing make
system (we're currently trialing Boost.Build as a replacement for
Imake so we can't change the code) we need to get Boost.Build to
handle QT classes this way instead of the default way it currently
handles them.

So I changed the qt.jam file slightly to remove this line:
generators.register-standard qt.moc : H : CPP(moc_%) : <allow>qt ;

And I added these lines in their place (MOCCED_CPP was added to the
qt.jam file in the types directory):
generators.register-standard qt.moc : H : MOCCED_CPP(%.moc.cxx) :
<allow>qt ;
generators.register-standard qt.fakeCpp : MOCCED_CPP : CPP(moc_%) :
<allow>qt ;

I also added below the qt.moc action:
actions fakeCpp
{
genFakeCpp $(>) $(<)
}

The change to (%.moc.cxx) from (moc_%) is necessary because in our
current build system that's how we name our MOC files. 'genFakeCpp' is
just a perl script that creates the expected (moc_%) CPP file with
just some trivial C++ code in it so that it gets compiled to an OBJ
and linked in by Boost.Build. (Technically I don't need this file but
if I don't provide Boost.Build with a path ending in an OBJ or a LIB
it won't generate the MOC file.)

The only problem with my changes is that the qt.moc file that I
generate is in the build directory but this directory isn't being
included when the QT class is compiled. If I include a UI source file
in the directory though it automatically includes the build directory
in every compile command. This is essentially the behaviour I want but
without needing a UI file in the directory. (A lot of our libraries,
etc. don't have a UI file generated QT class they just have
stand-alone QT classes.)

=======================================================
End long-winded explanation

Anyways.. thanks for any help you guys can provide,
-Tyson Marchuk

 


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