Author Topic: wxSmith - fast compile  (Read 5380 times)

Offline byo

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 837
wxSmith - fast compile
« on: October 22, 2005, 01:12:10 pm »
Hi, I'd like to show here small trick, which will speed up wxSmith compilation a little bit :D

At this point I assume You have wxWidgets (>=2.6) and lastest C::B cvs snapshoot compiled and everything works fine.
You can compile wxSmith by compiling it's project (it's in CB_ROOT/src/plugins/contrib/wxSmith directory). Using precompiled headers (discussion about it is here:,1109.0/topicseen.html) it took me about 5 minutes on my Athlon XP 2000+ to rebuild all.
Using some trick I've reduced compile time to about 1 minute :D. Here are some steps (it works on Windows but I guess it wouldn't be hard to make it compile on Linux too, just few compile options need to be changed :) ) :

  • Download attached file and unpack it's content to CB_ROOT/src/plugins/contrib/wxSmith (make sure that wxSmith_2_6_fc.cbp in in same directory where wxSmith_2_6.cbp is)
  • Open wxSmith_2_6_fc.cbp project file and add WX_DIR and WX_CFG custom variables in compile options (first must point to root wxWidgets' directory, second by default should be blank)
  • Compile and enjoy

How it works ?

There are few fc.cpp files inside zip file. These fc.cpp files include all cpp files inside project. Instead of compiling all source files separately I compile one fc.cpp file which include everything.

This technique may work also with other projects but with some restrictions:
  • Project must have many files and each file should have many headers include (f.ex. including wxWidgets)
  • two files can not define two symbols with same name (it was allowed in two different sources when adding static keyword before declaration)
  • I'm not sure about that but it may also fail with duplicated #defines (fix: use #undef before ;) )
  • All header files should be standard (with #ifndef AAA #define AAA ... #endif guard block), header include order should not be important
  • This won't work with precompiled headers (at least on GCC 3.4.4, MinGW) because it would include same gch file many times - that leads to strange errors

[attachment deleted by admin]