user243655
user243655

Reputation: 8595

Creating a build framework to support compiling code that supports multiple platforms

I am working with code base that supports both Linux and Windows platform. Now, I am trying to create a build framework that will allow me to compile the code base all done from the command line with single command, no matter what platform it is. Like if I am trying to compile it under Linux, it will say create make file for me, if I am compiling it under Windows, it will create Visual Studio project files for me.

Can anyone point me to the right direction? Also does anyone know what system does Boost or MySql uses as they are also cross platform applications/libraries.

Thanks.

Upvotes: 0

Views: 94

Answers (2)

Martin Green
Martin Green

Reputation: 1054

CMake will do exactly what you asked. That is, it will create a VS project on Windows and Makefile on *nix platforms. Writing configuration files for builds can take some time to learn, and I never got exactly comfortable with that.

Another strong candidate is SCons. What I like about SCons is that its build configuration is done entirely in Python. This means that you can have very elegant solutions for very complex builds. If you have any Python experience at all, I would strongly recommend it!

Update: Just discovered Premake, which works on the same principle as CMake, but is scriptable in Lua. No experience with it, but it sounds like best of CMake and SCons in one wholesome package.

Upvotes: 3

I believe that cmake might be an answer for the build specific part.

And some cross-platforms frameworks, notably Qt, have their own way of answering.

Upvotes: 1

Related Questions