Author Topic: How to transfer projects between platforms automatically with C::B+wxWidgets  (Read 10455 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
Code
-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
Code
__GNUWIN32__
__WXMSW__
WXUSINGDLL
wxUSE_UNICODE

Is there a easier way?

Offline byo

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 837
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
Code
-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
Code
__GNUWIN32__
__WXMSW__
WXUSINGDLL
wxUSE_UNICODE

Is there a easier way?

The "libraries" tab in project properties is part of "lib_finder" plugin and one of it's purposes is to make project files cross platform. Now, this under heavy development so answer to your question depends on which version of C::B you use. While 1.0 was released, lib_finder was really basic, current version included in nightly builds is much better :).

I'll focus on nightly build one since some things can not be done using the one in 1.0.

Basically lib_finder allows you to move ALL compiler / linker options related to given library out of a project and you only need to mark to use wx (as you did by adding it through '<' button).
Now all those options are moved to lib_finder's database (stored in code::block's configuration) which can be accessed from Plugins->Lib Finder menu. And here's why nightly build version is needed - the one with 1.0 release allow you only to automatically detect the library without any posibility to modify the results of such detection. In nightly builds you can edit library settings similarly to project options.

Now to make your projects cross-platform:
1) Create project using wizard
2) Remove ALL compiler/linker options related to wxWidgets from project configuartion (and optionally move them to lib_finder's database)
3) in Project->Properties->libraries add wxWidgets library and uncheck "Don't setup automatically"

The only problem here would be to configure lib_finder's database - that's where it's autodetection may be helpful. If it will mess up everything, the easiest way is to create empty wxWidgets project on each platform you work on and copy settings generated from wizard.

Regards
   BYO

Offline 00061205

  • Multiple posting newcomer
  • *
  • Posts: 30
Quote
Now to make your projects cross-platform:
1) Create project using wizard
2) Remove ALL compiler/linker options related to wxWidgets from project configuartion (and optionally move them to lib_finder's database)
3) in Project->Properties->libraries add wxWidgets library and uncheck "Don't setup automatically"

Thanks byo. :D :D
I'm using C:B 8.02 release.But where I can optionally move the ALL compiler/linker options to Lib_Finder?
« Last Edit: June 17, 2008, 06:23:41 am by 00061205 »

Offline byo

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 837
Thanks byo. :D :D
I'm using C:B 8.02 release.But where I can optionally move the ALL compiler/linker options to Lib_Finder?

First try to detect library settings through Plugins->Library Finder menu - if you choose this option (in 8.02) you will see window where you can enter directories where it should look for wxWidgets (but from what you've written before I guess you already did such detection).

If that won't work, you'll have to download latest nightly build (http://forums.codeblocks.org/index.php/topic,8581.0.html) and when you do that, under the Plugins->Library Finder menu you'll have the editor of lib_finder's database.

Regards
   BYO

Offline 00061205

  • Multiple posting newcomer
  • *
  • Posts: 30
Thanks byo. :D :D
I'm using C:B 8.02 release.But where I can optionally move the ALL compiler/linker options to Lib_Finder?

First try to detect library settings through Plugins->Library Finder menu - if you choose this option (in 8.02) you will see window where you can enter directories where it should look for wxWidgets (but from what you've written before I guess you already did such detection).

If that won't work, you'll have to download latest nightly build (http://forums.codeblocks.org/index.php/topic,8581.0.html) and when you do that, under the Plugins->Library Finder menu you'll have the editor of lib_finder's database.

Regards
   BYO

Yes, Lib_finder works. Just remove all compile and link options and use Lib_finer.
Thanks.