Author Topic: Sharing project across different platforms  (Read 3647 times)

Offline kirash4

  • Multiple posting newcomer
  • *
  • Posts: 42
Sharing project across different platforms
« on: April 13, 2014, 04:28:05 am »
I'm wondering if there's a way to do this or if I'm going about it wrong. I'm working primarily on my Windows machine and using MinGW (stand-alone) to compile. I realize I can't simply open the identical project on my unix machine and compile there (for a unix platform) because it would be using GCC there and the project wasn't setup for that. So how does one do that? I want to keep working on my Windows machine. The project is sitting on a shared drive that both the Windows and unix machines have access to. It seems too easy to simply add a unix build target. The headers wouldn't be the same (for this like wxWidgets and others), linking options are different, etc., etc.

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2545
Re: Sharing project across different platforms
« Reply #1 on: April 13, 2014, 11:26:33 am »
You can do this on different ways:
1) Use build targets for windows and linux: Project->Properties->Build Targets dublicate your target and modify it for linux use, the cklick on "build options" select your new target on the left and set the compiler options for this platform. Now if you build you have o select the proper target in the drop down menu near the build button
2) You use embedded scripting to differ between the oses. How this is done see here: http://forums.codeblocks.org/index.php/topic,19127.msg130864.htm this works also for compiler flags...

greetings

Offline kirash4

  • Multiple posting newcomer
  • *
  • Posts: 42
Re: Sharing project across different platforms
« Reply #2 on: April 13, 2014, 05:42:36 pm »
Ok, I'll try it again. For some reason when I tried it yesterday, it was failing to compile because it was still using compiler settings from the Windows environment. More than likely I did something wrong.

Alternatively, can I also setup cygwin and use it's compiler as another build target? That would keep me on the same physical machine too, good for when I'm traveling ... assuming it works.

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: Sharing project across different platforms
« Reply #3 on: April 13, 2014, 06:21:04 pm »
Be aware that there are per target and per project settings.
Make sure. that the OS-specific settings are target-only.

Offline kirash4

  • Multiple posting newcomer
  • *
  • Posts: 42
Re: Sharing project across different platforms
« Reply #4 on: April 13, 2014, 06:35:22 pm »
Yes, there's that too. I will have to verify again, I thought I did it right but I may have messed something up.