C++ Build Systems – What to use? [closed]

+1 for, “Many, and they’re awful.”

But, the “richest” and “most-scalable” is probably CMake, which is a Makefile-generator (also generates native MSVC++ *.proj/*.sln). Weird syntax, but once you learn it, it can allow you to nicely generate builds for different platforms. If I “started-fresh”, I’d probably use CMake. It should handle your list, although your “code-generation” could take on “a-life-of-its-own” beyond the build system depending on what you want to do. (See below.)

For simple projects, the QMake generator is ok (you don’t need to use the Qt libraries to use QMake). But, you’re not describing “simple” — code generation and “extra-phases” means you probably want CMake or something with a rich API for your own extensions, like Scons (or Waf).

We use Scons at work. It produces “bullet-proof-builds”, but it’s really slow. No other system will be as bullet-proof as Scons. But, it’s slow. It is written in Python and we’ve extended the interface for our “workspace-organization” (where we merely specify module dependencies), and that is part of the Scons design intent (this type of extension through Python). Convenient, but builds are slow. You get bullet-proof builds (any developer box can make the final release), but it’s slow. And, it’s slow. Don’t forget that if you use Scons, though, that it’s slow. And, it’s slow.

It makes me ill to think that a decade after the Year 2000, we still don’t have flying cars. We’ll probably have to wait another hundred years or something to get them. And, we will then all probably be flying around in our flying cars that are still being constructed with crappy build systems.

Yes, they are all awful.

[ABOUT CODE GENERATION]

Scons works on “phases”, and they are “somewhat-static”. It can build code that is generated as part of the build (people are doing this in a couple of different ways), but this has been described as, “something very un-Scons-like”.

If it’s simple “preprocess some files and generate source files”, then no biggie (you have lots of options, and this is why qmake was written — for the moc preprocessing of *.hpp/*.cpp files).

However, if you are doing this in a “heavy-manner”, you’re going to need to script your own. For example, we had as-a-part-of-the-build scripts that queried the databases and generated C++ classes to interface between the “layers” (in traditional 3-tier application development). Similarly, we generated server/client source code through IDLs, and embedded version information to permit multiple clients/servers to run simultaneously with different versions (for the same “client” or “server”). Lots of generated source code. We could “pretend” that is “the-build-system”, but really, it’s a non-trivial-infrastructure for “configuration management”, of which part of it is the “build-system”. For example, this system had to, “take-down” and “start-up” servers as a part of this process. Similarly, the regression-tests were executed as a part of this process, with heavy “reporting” and “difference-testing” between versions — all as a part of our “build-scripts”.

Leave a Comment