MinGW-gcc PCH not speeding up wxWidget build times. Is my setup correct?
- by Victor T.
Hi all,
I've been building wxMSW 2.8.11 with the latest stable release of mingw-gcc 4.5.1 and I'm trying to see if the build could be sped up using precompiled headers. My initial attempts at this doesn't seem to work.
I basically followed the given instructions here. I created a wxprec.h precompiled header with the following: 
   g++ -O2 -mthreads -DHAVE_W32API_H -D__WXMSW__ -DNDEBUG -D_UNICODE  
-I..\..\lib\gcc_dll\mswu -I..\..\include  -W -Wall -DWXBUILDING -I..\.. 
\src\tiff -I..\..\src\jpeg -I..\..\src\png -I..\..\src\zlib -I..\..\src 
\regex -I..\..\src\expat\lib -DwxUSE_BASE=1 -DWXMAKINGDLL   -Wno-ctor- 
dtor-privacy ../../include/wx/wxprec.h
That does successfully create a wxprec.h.gch that's about ~1.6meg in 
size. Now I proceed to build wxmsw using the follow make command from 
cmd.exe shell: 
   mingw32-make -f makefile.gcc 
While, the build does succeed I noticed no speedup whatsoever then if 
pch wasn't used. To make sure gcc was actually using the pch I added -H 
in the config.gcc and did another rebuild. Indeed, the outputted include list does show a '!' next to the wxprec.h so gcc is supposely using it. What's the reason for pch not working? Did I setup the precompiled headers correctly or am I missing a step?
Just for reference comparison, here's the compile times I get when building wxmsw 2.8.11 with the other compilers(visual studio 2010 and C++ Builder 2007). The time savings is pretty significant. 
|           | release, pch | release, nopch | debug, nopch
-------------------------------------------------------
| gcc451    | 8min 33sec   | 8min 17sec     | 8min 49sec
| msc_1600  | 2min 23sec   | 13min 11sec    | --
| bcc593    | 0min 59sec   | 2min 29sec     | --
Thanks