3 ms·
> Making a unity / jumbo build work for a project with 10,000+ files and millions of lines of code is not simple at all For years we rolled our own unity build
by StellarScience 2y ago
> Making a unity / jumbo build work for a project with 10,000+ files and millions of lines of code is not simple at all
For years we rolled our own unity build, but now CMake supports it directly through CMAKE_UNITY_BUILD and CMAKE_UNITY_BUILD_BATCH_SIZE, making it straightforward to enable.
When first enabling it on a large project, you'll run into clashes where different files contain identically-named file-scoped function or variables. Sometimes this reveals copy-pasted code, where the fix is to refactor the duplicate code anyway. Other times you just pick more specific names to avoid the clash.
We find unity build gives a solid 3X build speedup. We haven't eliminated header files, and in fact keep one slow CI job building the code without unity to ensure our code still builds either way.