Precompiled headers DRAMATICALLY improve build time


13-11-2007 19:18:51

Preprocessing "boost/python.hpp" and "python_ogre_masterlist.h" for every source file is the primary reason the build takes so long.

I setup precompiled headers for these and am seeing dramatically improved compile times. I'll time it out when I'm done.



13-11-2007 23:53:54

What changes did you make to scons to enable this?



14-11-2007 15:25:45

This is for Windows... though GCC also supports precompiled headers.

I added this to SConstruct:

_env['PCHSTOP'] = 'PythonOgrePCH.h'
_env['PCH'] = _env.PCH('generated/ogre_1.4/PythonOgrePCH.cpp')[0]

I hacked the "boost/python.hpp" includes out of the Py++ code generator... made sure that "#include "PythonOgrePCH.h" was at the top of the generated files... there are hopefully ways of doing this without hacking the Py++ sources. Though, I am just evaluating Python-Ogre at this point :)

I also removed the headers from ogre/

I created a PythonOgrePCH.h which includes the contents of the python_ogre_masterlist.h and also includes boost/python.hpp ... I also created a PythonOgrePCH.cpp which generates the PCH file. You'll want to exclude this cpp from the build itself.

You'll want to search through the generated source files for any includes of boost/python.hpp, python_ogre_masterlist.h, and extraneous includes to make sure it is setup right. Also, extra excludes can probably be put in the PCH too.

You'll have to add /Zm200 or so to the compiler flags as boost/python.hpp just pushes the compiler's limits after including all the Ogre includes...

When using (abusing?) templates to this degree and including a whole pile of header files (Ogre), precompiled headers *really* help compile times.