Summary
Highlights
This video series is aimed at JUCE developers transitioning from using the Producer to CMake. It will explain why CMake is beneficial and how it simplifies workflows, arguing that not using CMake creates technical debt.
Ben Vining, a self-taught C++ developer, shares his journey into JUCE and CMake. He believes CMake enhances maintainability and future-proofing, offering a deeper understanding of C++ build processes.
CMake allows for DRY (Don't Repeat Yourself) code in build descriptions and offers debugging strategies similar to C++ code. Its strong focus on backward compatibility ensures future compilation without changes to CMake scripts.
CMake abstracts away complex build steps, allowing a single build description for multiple platforms and tools. It also integrates testing and installer creation, potentially speeding up CI processes and saving costs.
Both CMake and the JUCE Producer are build system generators, not compilers. They can generate project files for various IDEs like Xcode and Visual Studio, and both have GUI editors (though their focus differs).
The fundamental difference is that the Producer uses static data files (XML), while CMake uses actual code with an interpreter, enabling sophisticated logic (if statements, loops) and dynamic responses to the build environment.
CMake is an industry standard widely adopted by C++ developers and package managers. Unlike the Producer, CMake is agnostic to the operating system and build system, allowing a single description to generate builds for different environments.
CMake allows for centralized configuration settings and managing source files within their respective directories, reducing redundancy and making changes easier to maintain compared to the Producer's approach.
CMake's ability to switch build systems or compilers with minimal changes to the build description saves time and effort. Its focus on backward compatibility ensures long-term project viability. CMake's command-line interface simplifies build, test, and install scripts.
CMake is often pre-installed on CI services, simplifying setup. It supports 'ccache' (compiler cache), significantly speeding up CI runs by recompiling only changed files, a feature not readily available with the Producer.
CMake facilitates code reuse by allowing static or shared library compilation, avoiding recompilation in every project. It also provides robust mechanisms for integrating third-party libraries, handling versions, configurations, and build methods dynamically.
CMake integrates static analysis tools (clang-tidy, cppcheck) directly into the build process. It centralizes scripts for building, testing, documentation, and installer creation (using CPack), providing a consistent and abstracted workflow across platforms.
Using CMake encourages a deeper understanding of C++ compilation, linking, library types, and ABI. It forces developers to consider build system design's impact on source code organization, advocating for a build system that helps rather than hinders.