Fixing Bakefile PCH for Objective-C++
David Elliott
dfe at cox.net
Mon May 7 11:48:20 PDT 2007
Vaclav, others,
I am interested in fixing some of the problems with PCH in the
wxWidgets build system.
At the moment, Bakefile creates a .pch directory containing one
subdirectory for each wxWidgets library (base, core, adv, etc.). For
each library build, that directory is then added to the include path
with a -I flag. This is needed because different precompiled headers
are needed for different sets of define (-D) compiler flags.
However, this does not go far enough. We also need different
precompiled headers for different languages. Objective-C++ is a
distinct language from C++ as far as GCC is concerned.
So, somehow we need to separate pch by language. We could
do .pch_cxx and .pch_objcxx each one containing the wxprec_*lib
directories or we could do .pch/wxprec_cxx_*lib and .pch/
wxprec_objcxx_*lib. We also of course need to know whether it is
even necessary to build the Objective-C++ precompiled header. It
could either be a flag set in Bakefile to indicate which languages
are used or it could perhaps be auto-determined based on extensions
of listed files.
I do believe that when using the PCH it should be possible to simply
have multiple -I, one for each language. I assume the compiler will
automatically grab the right PCH by simply skipping over the wrong
one like it does anyway and moving to the next include path component.
My problem is that I am unfamiliar with how Bakefile does this. It's
been a few years since I looked at this. Perhaps someone could
provide some insight as to how I might go about doing this?
There is one other issue too. The samples should not be built with -
DWX_PRECOMP unless they have their own precompiled headers. Aside
from the widgets sample, most do not benefit from precompiled headers
as they only contain one or two source files. I would suggest that
the simple fix is to not define WX_PRECOMP for any of the samples
since none of them are currently being built with precompiled headers.
-Dave
More information about the wx-dev
mailing list