Compiling for 2 Operating Systems

Anything else
Post Reply
YellowShadow
Posts: 2
Joined: Thu Feb 26, 2009 7:12 pm

Compiling for 2 Operating Systems

Post by YellowShadow » Thu Feb 26, 2009 7:19 pm

Hey guys!

I have some code which I would like to get compiled and running on Linux (Mac OS X soon!) but I'm having some problems. I'm using Visual Studio to compile my code on Windows. Previously I would just use G++ and compile that one main.cpp file. But now since the game's code has grown, I don't know what the best way for compiling on Linux would be.

I was using CodeBlocks but I figured it would be kinda difficult for maintaining two different project files for different IDEs.

I also tried CMake and SCons but I couldn't get those to work either.

If anyone has some first hand experience (Wolfire guys and other devs) or anyone has any tutorials that can put me in the direction, it would be awesome if you guys can share them with me.

BTW: I'm using SDL so I'm pretty sure that the code will compile with/without some minor changes.

Thanks,
YellowShadow

User avatar
Starrz
Posts: 487
Joined: Thu Oct 09, 2008 5:33 pm
Location: in ur pants
Contact:

Re: Compiling for 2 Operating Systems

Post by Starrz » Thu Feb 26, 2009 8:04 pm

Heyyy your first post! High five! *slaps*

David
Project Leader
Posts: 1995
Joined: Wed Nov 19, 2003 10:45 pm
Contact:

Re: Compiling for 2 Operating Systems

Post by David » Fri Feb 27, 2009 1:04 pm

I don't know about Linux, but for Windows and Mac OS X we just use the same source code with a number of #ifdefs to make small changes. It is tricky to keep the project files in sync, but we have a policy of trying the mac build right after committing a change to the windows build, and vice versa, which helps us fix problems before they inconvenience anyone else on the team.

YellowShadow
Posts: 2
Joined: Thu Feb 26, 2009 7:12 pm

Re: Compiling for 2 Operating Systems

Post by YellowShadow » Sat Feb 28, 2009 11:43 am

David wrote:I don't know about Linux, but for Windows and Mac OS X we just use the same source code with a number of #ifdefs to make small changes. It is tricky to keep the project files in sync, but we have a policy of trying the mac build right after committing a change to the windows build, and vice versa, which helps us fix problems before they inconvenience anyone else on the team.
If I use #ifdef would I have to #define something? Also, what would be some stuff I can use #ifdef for. I know one if for different headers.

Post Reply