Author Topic: wxWidgets Code::Blocks project  (Read 10874 times)

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
wxWidgets Code::Blocks project
« on: September 01, 2011, 05:01:47 am »
I spent some time and assembled a Code::Blocks project to build several configurations of wxWidgets 2.8.12 (with MinGW).  The project file saves me a lot of time as Code::Blocks utilizes both of my cores to compile, cutting the time in half.  If anyone would like to try it, just decompress the project file (7zip compression) into wxWidgets2.8.12\build\msw, however, I must warn you that although there is a shared multi-lib target, it does fail partway through (if someone knows why, please tell me).  (Note the project variable VENDOR is currently set to cb, but can be changed.)

One curious thing I noticed in making this is that although Code::Blocks allows for the import library of a dynamic library to have a custom name, it is not saved upon exit.  Perhaps an oversight in the file format?

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: wxWidgets Code::Blocks project
« Reply #1 on: September 01, 2011, 06:37:06 am »
Code
"cmd /c if not exist ..\..\lib\gcc_dll\mswu\wx\setup.h copy ..\..\include\wx\msw\setup.h ..\..\lib\gcc_dll\mswu\wx\setup.h"

After glancing at your cbp file, I noticed a common mistake.
You need to copy ..\..\include\wx\msw\setup0.h to ..\..\include\wx\msw\setup.h if the second file does not exist. This is done the first time the mingw makefile is ran.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5913
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: wxWidgets Code::Blocks project
« Reply #2 on: September 01, 2011, 07:16:39 am »
The project file saves me a lot of time as Code::Blocks utilizes both of my cores to compile, cutting the time in half. 
If you use makefile, you can also achieve this by using something like:
Code
mingw32-make.exe -j4 -f makefile.gcc

Anyway, using a cbp file is also great contribution, hope the wx guys will adopt your contribution.
By the way, is it easy to create this cbp file. I would suggest if it possible to create such cbp files for wx's sample code.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: wxWidgets Code::Blocks project
« Reply #3 on: September 01, 2011, 07:48:47 am »
By the way, is it easy to create this cbp file. I would suggest if it possible to create such cbp files for wx's sample code.

FYI: I did some research in creating "cbp files for wx's sample code." the work is almost done (or done completely) by the wxCode wxDemo project.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5913
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: wxWidgets Code::Blocks project
« Reply #4 on: September 01, 2011, 07:56:13 am »
By the way, is it easy to create this cbp file. I would suggest if it possible to create such cbp files for wx's sample code.

FYI: I did some research in creating "cbp files for wx's sample code." the work is almost done (or done completely) by the wxCode wxDemo project.

Tim S.
Thanks for the info.
Can you show us the link of wxCode/wxDemo? I just search on the wxCode webpage, but I can't find them. The remind that three years ago, when I'm a beginner to wx and c::b, I would like they should supply the wxSamples' cbp file, so I would easily learn wx code under C::B, otherwise, I need to use the command line to build the wxSample, and not easy to debug.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: wxWidgets Code::Blocks project
« Reply #5 on: September 01, 2011, 04:01:50 pm »
Can you show us the link of wxCode/wxDemo?

Example source code links; so you can look at source code first
http://wxcode.svn.sourceforge.net/viewvc/wxcode/trunk/wxCode/components/wxdemo/build/
http://wxcode.svn.sourceforge.net/viewvc/wxcode/trunk/wxCode/components/wxdemo/wxWidgets/demoFiles/animate/

Link to full download
http://sourceforge.net/projects/wxcode/files/Components/wxDemo/

The source code files are 2009 Premake files; Premake files can create Code::Blocks projects.
Problem the files are two years old; but, he has the needed Premake command in his SVN.
No idea if the lua files need updating for 2.8.12; but, I think they did for 2.9 builds.

I do not remember ever testing this and seeing if it works or contains Code::Blocks projects.
But, it should work OK.

Finished the download; code snippet from the first sample project animate.cbp
Code
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />

Tim S.


« Last Edit: September 01, 2011, 04:13:13 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: wxWidgets Code::Blocks project
« Reply #6 on: September 01, 2011, 11:59:52 pm »
You need to copy ..\..\include\wx\msw\setup0.h to ..\..\include\wx\msw\setup.h if the second file does not exist.
Thanks, I had overlooked that.

If you use makefile, you can also achieve this by using something like:
Code
mingw32-make.exe -j4 -f makefile.gcc
Thank you for pointing that out.  (Hmm I really should look a little more carefully when I read documentation.)  However, testing Code::Blocks and a makefile with the same build configuration on the same number of cores - Code::Blocks was about ten seconds faster; plus 1 for Code::Blocks. :)

By the way, is it easy to create this cbp file. I would suggest if it possible to create such cbp files for wx's sample code.
I created the project file by hand (not very smart of me); I am looking into writing a small program that will recurse through the samples directories and generate some cbp's.

FYI: I did some research in creating "cbp files for wx's sample code." the work is almost done (or done completely) by the wxCode wxDemo project.
Interesting, I will look into it

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: wxWidgets Code::Blocks project
« Reply #7 on: April 01, 2012, 03:29:38 am »
Fixed the Shared Multilib Build.

I added sub-folder(s) under build/msw that holds the several files that need to be renamed because they need to be compiled to two different object files. (one for base and second for core)

I also fixed many issues with files not being part of the right target.

Note: I added some defines that may not be needed.
Also, I added some post build commands to try to make CB 10.05 work; I finally gave up; never removed post build commands.

Tim S.

« Last Edit: April 02, 2012, 04:53:52 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline LETARTARE

  • Lives here!
  • ****
  • Posts: 531
  • L'ami de l'homme.The friend of man.
    • LETARTARE
Re: wxWidgets Code::Blocks project
« Reply #8 on: November 17, 2012, 07:54:26 pm »
hello,
@stahta01
Did you update the file "wxWidgets-2.8.12.cbp" to version 2.9.x ?
Sincerely
CB-13483, plugins-sdk-2.25.0 : Collector-2.0.0, AddOnForQt-3.9.1
1-Win7 Business Pack1 64bits : wx-3.2.4, gcc-8.1.0,
2-OpenSuse::Leap-15.4-64bits : wx-3.2.4;gtk3, gcc-8.2.1,
=> !! The messages are translated by Deepl

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: wxWidgets Code::Blocks project
« Reply #9 on: November 17, 2012, 09:07:21 pm »
hello,
@stahta01
Did you update the file "wxWidgets-2.8.12.cbp" to version 2.9.x ?
Sincerely

No, I have not done that.

I might try to do it next year; depends on if I have freetime.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org