New in 2.3: Build Mixxx with CMake

Posted on by Jan Holthuis (@Holzhaus)

Starting with Mixxx 2.3, we're introducing experimental support for CMake. This will probably be more interesting for people who are either compiling Mixxx themselves or going hack on its code base than for regular users, but it will make the build process more straightforward in the future.

Mixxx has used SCons as its build system for more than 13 years. Since it's based on the Python programming language, it's quite flexible and can be used to customize every build step. Unfortunately, it requires lots of boilerplate code to accomplish simple tasks. This makes our build scripts hard to maintain on all platforms and has lead to problems in the past.

Hence, we added support for the CMake build system (or rather: build system generator), which many C++ developers are already be familiar with. This has several advantages:

  • The code is more maintainable and requires fewer platform-specific hacks. Also, less code is necessary. To give you a rough idea: We managed to reduce the line count from approximately 8000 lines of Python code down to a 2300 line CMakeLists.txt file plus modules. All in all we reduced the line count by almost 3000 lines.
  • If you prefer a graphical "build" button over compiling Mixxx on the command line, this is now possible: IDEs such as KDevelop, Visual Studio or CLion have support for CMake built-in. There is even a standalone GUI that you can try.
  • Improved caching: Unnecessary recompilation is annoying and a waste of time. To avoid this, we had a custom caching solution in SCons, which cached the compilation units based on the git branch you're working on. This solution took a lots of disk space and also had occasional issues with failed builds. With CMake, we added support for ccache (and clcache on Windows), which makes development significantly faster.
  • Arguably, CMake is vastly more popular than SCons, so we hope that more people be able to build and contribute to Mixxx.

Note that there are still some issues with building Mixxx on macOS with CMake, so if you own a Mac we'd appreciate if you help us out. Apart from that, it's already working quite well. Most of our core developers already switched over to CMake as their daily driver when working on Mixxx, but since it hasn't been as widely tested as we'd like, we label the support as "experimental" for the 2.3 release and stick with SCons for the release builds. We plan to drop SCons and fully migrate over to CMake in 2.4.

If you want to try out building Mixxx with CMake yourself, check the instructions in our wiki.

Comments