Over the past few months, Kitware Inc. has been collaborating with Mojang Studios to improve Minecraft’s CMake build system. CMake is a particularly great fit for Mojang Studios because of the sheer number of platforms that Minecraft supports.
In addition to providing help and guidance towards improving the Minecraft build system, Kitware has also made a number of improvements to CMake itself as part of this effort. Here is a non-exhaustive list of the improvements to CMake that Kitware has made as part of this work.
- Added an option to CMake’s unity build support that allows you to explicitly specify how source files should be grouped together.
- Taught CMake how to generate Visual Studio projects for Android.
- Interface libraries can now have source files associated with them. This makes it easier to organize groups of source files in your IDE.
- Added a new target property, OPTIMIZE_DEPENDENCIES, that can be used to speed up build times by relaxing the dependency graph for static libraries.
- Added support to cmake and cmake-gui to parse CMakePresets.json files. These files can be used to define a list of “presets”. Each preset specifies a generator, a build directory, and optionally a list of variables and other arguments to pass to CMake. This functionality makes it much easier for developers to define a list of different “types” of builds that they wish to officially support. We are also working with the Visual Studio team to reconcile any differences between CMakePresets.json and their CMakeSettings.json schema.
Kitware would like to thank Mojang Studios for giving us the opportunity to make these improvements to CMake. Because CMake is open source, the entire CMake community can now benefit from these new features.
It’s been our pleasure to contribute to the development lifecycle of a game that’s enjoyed by millions of people around the world. Through this collaboration, Kitware and Mojang Studios have improved CMake and Minecraft’s CMake build system to make development faster and more reliable.