|
Boost-Build : |
From: Vladimir Prus (ghost_at_[hidden])
Date: 2005-10-27 03:16:38
Hi Tyson,
> 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?
.....
> 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.
.....
> 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.)
Well, *.moc.cxx are actually included? Then I'd suggest to rename the type to
MOCCED_H *and* declare it as:
type MOCCED_H : moc.cxx : H ;
that is derive the type from the "H" type. This should cause V2 to magically
add include paths to that file.
You might sometimes need the <implicit-dependency> property:
http://boost.org/boost-build2/doc/html/bbv2/reference/jamfiles.html
but in most cases this should work fine. If you get this to work, ping me and
I'll tell (or even write), a code that does not require this "fakeCpp"
action. The Qt4 support in CVS HEAD can automatically convert .ui files into
just .h (without any compilable .cpp files).
- Volodya
-- Vladimir Prus http://vladimir_prus.blogspot.com Boost.Build V2: http://boost.org/boost-build2
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