Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
patch to build C::B against wx 3.0 with PCH enabled
ollydbg:
Hope someone think it is useful.
I build CodeBlocks_wx30.cbp with GCC 4.7.x from MinGW-Build. It should be faster than the default NON-PCH build.
--- Code: ---From 58489f50025bdca99d848facce0a849a2ae592ee Mon Sep 17 00:00:00 2001
From: asmwarrior <>
Date: Mon, 20 Jan 2014 14:16:02 +0800
Subject: [PATCH] * build against wx 3.0 with PCH enabled.
---
src/CodeBlocks_wx30.cbp | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/CodeBlocks_wx30.cbp b/src/CodeBlocks_wx30.cbp
index 3443619..b5265fe 100644
--- a/src/CodeBlocks_wx30.cbp
+++ b/src/CodeBlocks_wx30.cbp
@@ -727,11 +727,13 @@
<Add option="-mthreads" />
<Add option="-fmessage-length=0" />
<Add option="-fexceptions" />
+ <Add option="-Winvalid-pch" />
<Add option="-DHAVE_W32API_H" />
<Add option="-D__WXMSW__" />
<Add option="-DWXUSINGDLL" />
<Add option="-DcbDEBUG" />
- <Add option="-DNOPCH" />
+ <Add option="-DCB_PRECOMP" />
+ <Add option="-DWX_PRECOMP" />
<Add option="-DwxUSE_UNICODE" />
<Add directory="$(#WX30.include)" />
<Add directory="$(#WX30.lib)/gcc_dll$(WX_CFG)/msw$(WX_SUFFIX)" />
@@ -1280,6 +1282,7 @@
<Option target="sdk" />
</Unit>
<Unit filename="include/sdk.h">
+ <Option compile="1" />
<Option weight="1" />
<Option target="src" />
</Unit>
@@ -1290,6 +1293,7 @@
<Option target="sdk" />
</Unit>
<Unit filename="include/sdk_precomp.h">
+ <Option compile="1" />
<Option weight="0" />
<Option target="sdk" />
</Unit>
--
1.8.5.2.msysgit.0
--- End code ---
NOTE: GCC 4.8.x should be avoid if you want to build C::B with PCH enabled under Windows.
stahta01:
FYI:
The Contrib Workspace in Windows does NOT use PCH correctly. To get a real speed up you likely should fix that.
The cause the CB core project object directory needs to be added to the contrib project compiler search list (first would be good)
But, at least before ../../../include search folder.
I suggest fixing the wx28 Contrib projects, first.
Tim S.
ollydbg:
--- Quote from: stahta01 on January 20, 2014, 01:58:46 pm ---FYI:
The Contrib Workspace in Windows does NOT use PCH correctly. To get a real speed up you likely should fix that.
The cause the CB core project object directory needs to be added to the contrib project compiler search list (first would be good)
But, at least before ../../../include search folder.
I suggest fixing the wx28 Contrib projects, first.
Tim S.
--- End quote ---
Hi, thanks.
I put all the links I can found about enabling pch support when building contributed plugins:
Do the Contrib Plugins under Windows really use a PCH version of sdk.h?
Patch to add an local PCH file to the Windows wx28 Project
Compiling wxContribItems faster using wx/wxprec.h PCH
I hope I will have some time to test. :)
stahta01:
--- Quote from: ollydbg on January 22, 2014, 03:33:36 pm ---
--- Quote from: stahta01 on January 20, 2014, 01:58:46 pm ---FYI:
The Contrib Workspace in Windows does NOT use PCH correctly. To get a real speed up you likely should fix that.
The cause the CB core project object directory needs to be added to the contrib project compiler search list (first would be good)
But, at least before ../../../include search folder.
I suggest fixing the wx28 Contrib projects, first.
Tim S.
--- End quote ---
Hi, thanks.
I put all the links I can found about enabling pch support when building contributed plugins:
Do the Contrib Plugins under Windows really use a PCH version of sdk.h?
Patch to add an local PCH file to the Windows wx28 Project
Compiling wxContribItems faster using wx/wxprec.h PCH
I hope I will have some time to test. :)
--- End quote ---
The main PCH fix thing that needs done is in this one; just adding the object directory to the Contrib Projects will allow the Contrib use PCH.
Do the Contrib Plugins under Windows really use a PCH version of sdk.h?
The wxSmith creates a local PCH file to speed it up.
The wxContrib changes the build objects NOT the PCH; but, it really speeds it up.
I found the fix while trying to fix the PCH and the PCH fix I tried did no improvements; but, the Build Fix cut the time to about 1/3 the prior time.
Edit: I am Forking a Git Repo of CB and will do this one line change to most of the Contrib Projects.
Plan to skip wxSmith and wxContribItems.
Edit2: Attach Git Patch to add the obj search to cbp and a single sdk_precomp.h to sdk.h fix.
Tim S.
ollydbg:
--- Quote from: stahta01 on January 22, 2014, 03:40:38 pm ---The main PCH fix thing that needs done is in this one; just adding the object directory to the Contrib Projects will allow the Contrib use PCH.
Do the Contrib Plugins under Windows really use a PCH version of sdk.h?
--- End quote ---
I apply the git patch, and I see that building Games plugin now from 22 seconds(before patch) to 7 seconds(after patch). Nice result. :)
I also see that when building FileManager Plugin, there is no time reducing before and after the patch, I'm not sure why.
I haven't tested other plugin yet, but I see it does improve the build performance.
--- Quote ---Edit2: Attach Git Patch to add the obj search to cbp and a single sdk_precomp.h to sdk.h fix.
--- End quote ---
I think we should always use sdk.h, not sdk_precomp.h when building non-sdk target.
Q1: what is better?
--- Code: ---#include <sdk.h>
--- End code ---
or
--- Code: ---#include "sdk.h"
--- End code ---
?
Q2: When I build CodeCompletion plugin, I see such command
--- Code: ---[ 6.3%] g++.exe -Wall -g -pipe -mthreads -fmessage-length=0 -fexceptions -Winvalid-pch -DHAVE_W32API_H -D__WXMSW__ -DWXUSINGDLL -DcbDEBUG -DCB_PRECOMP -DWX_PRECOMP -DwxUSE_UNICODE -DBUILDING_PLUGIN -iquote.objs\include -I.objs\include -I. -IE:\code\wx-mingw-build-481-dw2\wxWidgets-2.8.12\include -IE:\code\wx-mingw-build-481-dw2\wxWidgets-2.8.12\lib\gcc_dll\mswu -Isdk\wxscintilla\include -Isdk\wxpropgrid\include -Iinclude\tinyxml -Iinclude -Iinclude\mozilla_chardet -Iinclude\mozilla_chardet\mfbt -Iinclude\mozilla_chardet\nsprpub\pr\include -Iinclude\mozilla_chardet\xpcom -Iinclude\mozilla_chardet\xpcom\base -Iinclude\mozilla_chardet\xpcom\glue -c plugins\codecompletion\ccoptionsdlg.cpp -o .objs\plugins\codecompletion\ccoptionsdlg.o
--- End code ---
Note, there is: -iquote.objs\include
But I see the command when build FileManager Plugin
--- Code: ---[ 14.3%] g++.exe -Wall -pipe -mthreads -fmessage-length=0 -fexceptions -Winvalid-pch -DWXUSINGDLL -DHAVE_W32API_H -D__WXMSW__ -DcbDEBUG -DCB_PRECOMP -DWX_PRECOMP -DwxUSE_UNICODE -DBUILDING_PLUGIN -g -I..\..\..\.objs\include -I..\..\..\include -I..\..\..\sdk\wxscintilla\include -I..\..\..\include\mozilla_chardet -I..\..\..\include\mozilla_chardet\mfbt -I..\..\..\include\mozilla_chardet\nsprpub\pr\include -I..\..\..\include\mozilla_chardet\xpcom -I..\..\..\include\mozilla_chardet\xpcom\base -I..\..\..\include\mozilla_chardet\xpcom\glue -IE:\code\wx-mingw-build-481-dw2\wxWidgets-2.8.12\include -IE:\code\wx-mingw-build-481-dw2\wxWidgets-2.8.12\lib\gcc_dll\mswu -c directorymonitor.cpp -o ..\..\..\.objs\plugins\contrib\FileManager\directorymonitor.o
--- End code ---
Why there is no -iquote?
Q3: what does the below statement mean? I don't see the change in wxContrib from your git patch.
--- Quote ---The wxContrib changes the build objects NOT the PCH; but, it really speeds it up.
--- End quote ---
Navigation
[0] Message Index
[#] Next page
Go to full version