views:

289

answers:

2

Any suggestions on how one could go about setting up a build system that would compile one or two libraries against a couple of different platforms/targets.

The main project is in Visual Studio.

For example, I have a library:

nav.lib

It compiles on Windows and Linux with a few tweaks.

The executable that uses the library, win_nav.lib, only compiles on Windows at the moment with OpenGL.

I'm porting this code to the iPhone. Although I know I can't compile and link the entire library on windows I would like to try to compile the graphics code with OpenGL includes and OpenGLES includes. (Perhaps I can test out my opengles code on the windows machine as well?)

I plan to change my graphics file to include based on preprocessor flags:

#ifdef USE_OPEN_GL_FULL
     #include <opengl/gl.h>
#else
     #include <opengles/gl.h>
#endif

So, how would you go about doing this?

Using a couple of different scripts or different projects in Visual Studio?

+2  A: 

This is what "Solution Configurations" are for. By default Visual Studio creates Release and Debug configurations, but you can add your own custom configurations too. The Project options are different for each configuration, so just set your #define in the configuration that needs it.

When you are running your automated build you just set the /build parameter to the name of the configuration you want to compile with.

galuvian
A: 

Within VS you can use the Configuration Manager to target different builds and use different libraries within your code.

MrTelly