Stefano Bonicatti
10/21/2019, 6:33 PMcmake --build with -j 8 that tells msbuild to build at max 8 projects parallel, which means 1 job per project and so 1 TU per project at a time.
Then you have the /MP switch which activates parallel compilation for a single project, there you can set the number of jobs/cores to use, with /MP8 for instance; but since this is per project it means that, together with the previous settings, you can end up having 64 build jobs, blowing out your CPU and RAM.
Then the EC2Client.cpp is a really big source file that requires several GBs of RAM to be compiled, so that slows down compilation for sure.
Ninja as build system instead of msbuild is a possible solution, though even if I've used it in the past to work at the osquery CMake code, I noticed that it creates some test binaries which crash. Still haven't triaged and compared compiler and linker command lines, to see why such difference from msbuild.
Then I recently tried NMake + JOM (with NMake Makefiles always created by CMake), though jom, due to the presence of ".NOTPARALLEL" (I think) in the Makefile, disables parallel compilation.
I'm not sure why is that, because I recall having used jom years ago to parallelize a CMake project on Windows and I've checked that CMake didn't just recently start to add that ".NOTPARALLEL" instruction.