Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
patch to build C::B against wx 3.0 with PCH enabled
ollydbg:
--- Quote from: stahta01 on January 27, 2014, 03:51:42 pm ---
--- Quote from: ollydbg on January 27, 2014, 03:26:47 pm ---...
Hi, Tim, I get confused, why "WX_PRECOMP" is not needed here? Can you explain it a little?
--- End quote ---
1. Under MinGW GCC you can only have a single PCH file in a compilation unit; The CB_PRECOMP is correct for using a PCH of sdk.h
2. Currently, inside sdk_common.h the WX_PRECOMP is set if CB_PRECOMP is set without NOPCH being set.
--- End quote ---
Ok, I understand this.
--- Quote ---3. The setting of WX_PRECOMP to true implies the use of wxprec.h; this is NOT true for some (hopefully nearly all) CB Projects.
--- End quote ---
Do you mean that all C::B project does not build the "wxprec.h" to "wxprec.h.gch"? Even though it can generate a "wxprec.h.gch", but we already have a "sdk.h.gch", so GCC can't handle two gch files. (As you said in the FYI section)
--- Quote ---4. The using of wxprec.h (with WX_PRECOMP true) when it is NOT a PCH file slows down the build process.
--- End quote ---
Yes, I agree, this will include a not of wx header files which are not need.
Now, the conclusion is:
If we want to use PCH, we should define CB_PRECOMP, and we should NOT to define (set) the WX_PRECOMP inside sdk_common.h?
Not only the wx3.0 cbp, but also the wx2.8 cbp should follow this way?
stahta01:
--- Quote from: ollydbg on January 27, 2014, 04:06:39 pm ---
--- Quote from: stahta01 on January 27, 2014, 03:51:42 pm ---
--- Quote from: ollydbg on January 27, 2014, 03:26:47 pm ---...
Hi, Tim, I get confused, why "WX_PRECOMP" is not needed here? Can you explain it a little?
--- End quote ---
1. Under MinGW GCC you can only have a single PCH file in a compilation unit; The CB_PRECOMP is correct for using a PCH of sdk.h
2. Currently, inside sdk_common.h the WX_PRECOMP is set if CB_PRECOMP is set without NOPCH being set.
--- End quote ---
Ok, I understand this.
--- Quote ---3. The setting of WX_PRECOMP to true implies the use of wxprec.h; this is NOT true for some (hopefully nearly all) CB Projects.
--- End quote ---
Do you mean that all C::B project does not build the "wxprec.h" to "wxprec.h.gch"? Even though it can generate a "wxprec.h.gch", but we already have a "sdk.h.gch", so GCC can't handle two gch files. (As you said in the FYI section)
--- Quote ---4. The using of wxprec.h (with WX_PRECOMP true) when it is NOT a PCH file slows down the build process.
--- End quote ---
Yes, I agree, this will include a not of wx header files which are not need.
Now, the conclusion is:
If we want to use PCH, we should define CB_PRECOMP, and we should NOT to define (set) the WX_PRECOMP inside sdk_common.h?
Not only the wx3.0 cbp, but also the wx2.8 cbp should follow this way?
--- End quote ---
Edit: I agree with your conclusion for Building with MinGW GCC 4.8 and above.
Edit3: But, setting WX_PRECOMP (inside sdk_common.h) for lower version (that does NOT have the PCH bug) will speed building.
Edit2: I plan to add an conditional setting of WX_PRECOMP based on OS, WX, and Compiler version to fix the MinGW GCC 4.8 PCH bug in the future.
Note: I believe CB Project never builds wxprec.h.gch; and I think is should NOT build one.
FYI: If you wish to build one (wxprec.h.gch) for use by the CB Projects; it only helped with wxContribItems in my testing.
The simplest way was putting it in the same folder as setup.h (wx/setup.h).
Note: You then only need to change the order of the wxWidgets search folders in the CB Project.
The search for the setup.h folder needs to be before the normal wxWidgets include folder.
Edit4: Doing the above might break other projects the use the wxWidgets installation.
Tim S.
stahta01:
I edited my prior post a lot.
Tim S.
ollydbg:
--- Quote from: stahta01 on January 27, 2014, 04:35:54 pm ---Edit: I agree with your conclusion for Building with MinGW GCC 4.8 and above.
Edit3: But, setting WX_PRECOMP (inside sdk_common.h) for lower version (that does NOT have the PCH bug) will speed building.
Edit2: I plan to add an conditional setting of WX_PRECOMP based on OS, WX, and Compiler version to fix the MinGW GCC 4.8 PCH bug in the future.
Note: I believe CB Project never builds wxprec.h.gch; and I think is should NOT build one.
FYI: If you wish to build one (wxprec.h.gch) for use by the CB Projects; it only helped with wxContribItems in my testing.
The simplest way was putting it in the same folder as setup.h (wx/setup.h).
Note: You then only need to change the order of the wxWidgets search folders in the CB Project.
The search for the setup.h folder needs to be before the normal wxWidgets include folder.
Edit4: Doing the above might break other projects the use the wxWidgets installation.
Tim S.
--- End quote ---
I agree with you.
So, I think in most cases, WX_PRECOMP should not be explicitly defined in the project/target build options. We can have this in "conditional setting of WX_PRECOMP based on OS, WX, and Compiler version".
Thanks.
stahta01:
The patch I am testing. I do NOT think "src/include/xtra_res.h" needs patched.
But, I am only testing with that for now; looking for compile errors because "wx/wxprec.h" was NOT included.
If I don't find any I will test the patch without changing "src/include/xtra_res.h".
Tim S.
--- Code: ---Index: src/CodeBlocks_wx30.cbp
===================================================================
--- src/CodeBlocks_wx30.cbp (revision 9615)
+++ src/CodeBlocks_wx30.cbp (working copy)
@@ -731,7 +731,7 @@
<Add option="-D__WXMSW__" />
<Add option="-DWXUSINGDLL" />
<Add option="-DcbDEBUG" />
- <Add option="-DNOPCH" />
+ <Add option="-DCB_PRECOMP" />
<Add option="-DwxUSE_UNICODE" />
<Add directory="$(#WX30.include)" />
<Add directory="$(#WX30.lib)/gcc_dll$(WX_CFG)/msw$(WX_SUFFIX)" />
@@ -1280,6 +1280,7 @@
<Option target="sdk" />
</Unit>
<Unit filename="include/sdk.h">
+ <Option compile="1" />
<Option weight="1" />
<Option target="src" />
</Unit>
@@ -1290,6 +1291,7 @@
<Option target="sdk" />
</Unit>
<Unit filename="include/sdk_precomp.h">
+ <Option compile="1" />
<Option weight="0" />
<Option target="sdk" />
</Unit>
Index: src/include/sdk_common.h
===================================================================
--- src/include/sdk_common.h (revision 9615)
+++ src/include/sdk_common.h (working copy)
@@ -28,16 +28,26 @@
#if ( defined(CB_PRECOMP) && !defined(WX_PRECOMP) )
#define WX_PRECOMP
+ #ifdef __MINGW32__
+ #if __GNUC__ == 4 && __GNUC_MINOR__ >= 8
+ #include <wx/version.h>
+ #if wxMAJOR_VERSION == 3
+ #undef WX_PRECOMP
+ #endif // wxMAJOR_VERSION
+ #endif // __GNUC__
+ #endif // __MINGW32__
#endif // CB_PRECOMP
// basic wxWidgets headers : this one itself will check for precompiled headers
// and if so will include a list of wx headers, at the bottom we add some more headers
// in the case of precompilation (note : some headers are in both lists)
// so even if NO CB_PRECOMP we can still have WX_PRECOMP turned on in this "wxprec" header
-#include <wx/wxprec.h>
+#ifdef WX_PRECOMP
+ #include <wx/wxprec.h>
-#ifdef __BORLANDC__
- #pragma hdrstop
+ #ifdef __BORLANDC__
+ #pragma hdrstop
+ #endif
#endif
#include "prep.h" // this is deliberately not inside the #ifdef block
Index: src/include/xtra_res.h
===================================================================
--- src/include/xtra_res.h (revision 9615)
+++ src/include/xtra_res.h (working copy)
@@ -6,16 +6,11 @@
#ifndef XTRA_RES_H
#define XTRA_RES_H
-#include <wx/wxprec.h>
#include <wx/xrc/xmlres.h>
#include <wx/xrc/xh_dlg.h>
#include <wx/toolbar.h>
-#ifdef __BORLANDC__
- #pragma hdrstop
-#endif
-
class wxXmlResourceHandler;
class wxToolBarAddOnXmlHandler : public wxXmlResourceHandler
--- End code ---
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version