Author Topic: How to transfer projects between platforms automatically with C::B+wxWidgets  (Read 3630 times)

Offline 00061205

  • Multiple posting newcomer
  • *
  • Posts: 30
I found it is very complicated to transfer projects between platforms.
I list the steps below how I transfer a "Hello World" wxWidgets project from Linux to Windows XP
1. Project->Properties->libraries tab; select Cross-Platform |_wx:wxWidgets; click < button; uncheck Don't setup automatically check box
2. Project->Build options->Complier setting->Other options tab; add following
-pipe
-mthreads
[[if (PLATFORM == PLATFORM_MSW && (GetCompilerFactory().GetCompilerVersionString(_T("gcc")) >= _T("4.0.0"))) print(_T("-Wno-attributes"));]]

3.Project->Build options->Complier setting->#Defines tab; add following
__GNUWIN32__
__WXMSW__
WXUSINGDLL
wxUSE_UNICODE


Is there a easier way?
« Last Edit: June 16, 2008, 06:02:10 am by 00061205 »

Offline Deschamps

  • Multiple posting newcomer
  • *
  • Posts: 120
Quote
Is there a easier way?

How about defining a build target for each platform?
So, you only need to select the proper target when compiling your sources.

Regards.

PS/ It's exactly the same way when you want to compile against different wxWidgets builds (unicode/ansi, static/shared, ...)
Misquotations are the only quotations that are never misquoted

Offline 00061205

  • Multiple posting newcomer
  • *
  • Posts: 30
Thanks,I'll try. :D

Offline eranif

  • Regular
  • ***
  • Posts: 254
The problem is that you adding pre-processors manually rather than using the very much convenient wx-config tool.

instead of adding all the macros/switches, you can simply do this:

Code: [Select]
//to compile a simple hello world app on linux
g++ -c main.cpp -o HelloWorld `wx-config --libs --cflags`

The same can be used within CB, instead of hard coding all the macors/flags, replace it with:
Code: [Select]
`wx-config --cflags`
and in the linker:
Code: [Select]
`wx-config --libs`
Using the above method will work both on windows & linux & mac (you can get wx-config for windows from here:
http://wx-config-win.googlecode.com/svn/binary/wx-config.exe)

This is how I do it (different IDE same principle)
Eran