Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++ build systems [closed]

Tags:

I will start a new C++ project (it may have some C components as well) soon and I am looking for a modern, industrial-strength (i.e. non-beta) build system. The software will be created by several developers in 3-5 years and will run on Linux (Mac OS X and Windows might be supported later). I am looking for something that has better comprehensibility, ease-of-use and maintainability than e.g. make but is still powerful enough to handle a complex project. Open source software is preferred.

I started looking into Boost.Build, CMake, Maven and SCons so far and liked features and concepts of all of those, but I'm lacking the experience to make a decision for a large project.

like image 319
flo Avatar asked May 17 '10 08:05

flo


2 Answers

I don't have experience with the others, but if you're looking for a cross-platform, cross-toolchain build system, use CMake. CMake is not actually a build system, it's a build script generator - it generates the actual build scripts for a lot of build systems and (and that's in my opinion the strength) generates project files for major IDEs like Visual Studio and KDevelop. Recent KDevelop versions, by the way, have Intellisense for CMake files.

The generated build scripts or Visual Studio solutions are not as elegant as they would be if created manually, but since you also don't have to maintain them manually, it's fine.

The downside of CMake is that it doesn't really come with a lot of built-in tools, or an easy way to extend it (compared to e.g. MSBuild, which is of course just a build system, not a generator). Our Linux developers tend to call Unix command line tools to do things like compression/decompression, which are not available on a typical Windows installation, while in contrast MSBuild has thousands of additional commands available from community projects, so you don't need to use the command line, and it's really easy to create a new Task for MSBuild. I'm currently looking into how to get around these limitations for CMake, because it currently means we can't entirely build on Windows, even though the code itself would build fine.

Writing the CMake files is not a beautiful experience, but it's ok. The language has some strange quirks (like having to exactly repeat an if-condition in the else and endif, which will drive you crazy especially when experimenting), and you'll really, really hate having a file called CMakeLists.txt in each and every directory which has custom build rules (and that maybe a lot, in a large project), and they all show up just with the name in your IDE ;)

like image 157
OregonGhost Avatar answered Sep 28 '22 20:09

OregonGhost


A few years into the future...

  • SCons is dying off in popularity, from what I've seen. I don't like it at all.
  • Waf is awesome (in my opinion). If you're looking into SCons, try Waf first. However, parallel builds always show you all the errors that occurred...so expect your screen to be flooded with error messages. Also, it can get a little complicated to extend.
  • Boost.Build is one of my favorites but has the worst documentation on earth. Other than that, it's very flexible and lets you do almost anything. It can be a tad slow at times, though.
  • CMake is good for only generating Ninja scripts; anything else is garbage (4000 lines of makefiles for a 1-source 1-executable project)
  • Tup is nice, but it lacks anything for configuration.
  • Autoconf is still autocrap.

Other ones not mentioned:

  • Kbuild is a tad weird but looks nice. That's all I know.
  • mk-configure is great for make lovers.
  • Shake with shake-language-c is flexible and lets you do anything...if you know Haskell and don't mind abandoning VS support.
  • Jamplus loves to shove -m32 at the end of every freaking compiler command, which sucks on a 64-bit system.
  • Tundra can be a tad repetitive but is still very fast and accurate.
  • Bam...Tundra is better. It's fast without sacrificing accuracy.
  • Gyp (used for Google Chrome/Chromium) is underdocumented but is a great alternative to CMake.
  • Premake is great if you value simplicity, but it can get annoying when it comes do doing seemingly simple things.
  • Bakefile is very restrictive but great for simple projects.
  • fbuild is my favorite (along with Boost.Build). It's quite underdocumented but has plenty of examples and very readable source code. Build scripts are short, too. It's used to build (and was designed for) Felix. It's also very, very fast, and it's almost always perfectly accurate and has automatic parallelism that DOESN'T flood your screen. Ever. I'm using it to build a regex JIT engine and am very, very happy. It's also very easy to extend. However, it's still technically in beta, although I've never experienced any real problems.

I'd recommend fbuild or Boost.Build...or Gyp if you like makefile generators.

If you want to extend the basic functionality, definitely use fbuild. If you have LOTS of platform-specific flags/options and plenty of messes, use Boost.Build. If you need a makefile generator or have lots of configurations, try Gyp.

like image 44
kirbyfan64sos Avatar answered Sep 28 '22 20:09

kirbyfan64sos