I came across several SO questions regarding specific aspects of improving the turn-on time of C ++ projects with C ++ support recently (for example, βAt what level should I distribute my build process?β Or βcmake rebuild_cache only for a subdirectory?β ) I was wondering if there is a more general guide using the specific features of CMake suggestions. If there is probably no cross-platform compile-time optimization, I'm mostly interested in the Visual Studio or GNU toochain approaches.
And I already know and invest in recommended areas to speed up C ++ builds:
Change / optimize / fine-tune toolchain
Optimize your base / software code architecture (for example, by reducing dependencies and using clearly defined subprojects - unit tests)
Invest in the best hardware (SSD, CPU, memory)
as recommended here , here or here . Therefore, my focus on this issue is in the first place.
Plus, I know the recommendations that can be found in the CMake Wiki:
The former simply handles the basics (parallel make), the later ones mainly process the parsing of CMake files.
To make this a little more specific, if I take the CMake example from here with 100 libraries using MSYS / GNU, I got the following time measurement results
$ cmake --version cmake version 3.5.2 CMake suite maintained and supported by Kitware (kitware.com/cmake). $ time -p cmake -G "MSYS Makefiles" .. -- The CXX compiler identification is GNU 4.8.1 ... -- Configuring done -- Generating done -- Build files have been written to: [...] real 27.03 user 0.01 sys 0.03 $ time -p make -j8 ... [100%] Built target CMakeTest real 113.11 user 8.82 sys 33.08
So, I have a total of ~ 140 seconds, and my goal - admittedly for this very simple example - is to get about 10-20% of what I get with the standard settings / tools.
performance compilation cmake gnu-make nmake
Florian
source share