Author Topic: Cross compiling requiring different libs in Windows and Linux  (Read 3428 times)

xtothat

  • Guest
Hi people!

Already looking forward to being part of this forum. Code::Blocks is an amazing IDE!

Anyway, on with my problem... Basically, I'm compiling cross-platform software using the Qt4 libraries, and there is a slight difference between the lib names in Linux and Windows. In Windows they are called QtGui4 and QtCore4, and in Linux, they're just QtGui and QtCore. Is there any way in Code::Blocks, that I can set to use different libraries depending on which operating system I'm compiling on? It's not a show-stopper, it'll just save me messing about with my code whenever I need to compile for both systems.

Any advice will be hugely appreciated, and thanks massively in advance!

X-T

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7256
Re: Cross compiling requiring different libs in Windows and Linux
« Reply #1 on: April 05, 2011, 11:22:26 am »
The easiest way would be to create two build-targets, one for linux and one for windows.
In the projects properties you can set the platform to windows or linux only for the appropriate target.
Then you can create a virtual target, that holds both, but builds only one of the real target depending on the platform you are on.

If you have Release and Debug at the moment:
duplicate both of them and create Release-windows, Release-linux, Debug-windows and Debug-linux.
Change the platform on projects "Properties -> Project settings".
Add two virtual targets on "Properties -> Build targets" and add the appropriate real targets to the virtual targets.
Use the virtual targets to build the sources.

You could use scripting also, but this is the easier way (in my opinion).
« Last Edit: April 05, 2011, 11:25:37 am by jens »

Offline cacb

  • Lives here!
  • ****
  • Posts: 538
Re: Cross compiling requiring different libs in Windows and Linux
« Reply #2 on: April 05, 2011, 08:57:00 pm »
The easiest way would be to create two build-targets, one for linux and one for windows.
In the projects properties you can set the platform to windows or linux only for the appropriate target.
Then you can create a virtual target, that holds both, but builds only one of the real target depending on the platform you are on.

If you have Release and Debug at the moment:
duplicate both of them and create Release-windows, Release-linux, Debug-windows and Debug-linux.
Change the platform on projects "Properties -> Project settings".
Add two virtual targets on "Properties -> Build targets" and add the appropriate real targets to the virtual targets.
Use the virtual targets to build the sources.

I have a similar setup for Windows and Linux, i..e. 4 real targets. I just build the Windows ones on Windows and the Linux ones on Linux.

What's the additional benefit of using virtual targets as you describe it?