Merge pull request 'perf: build external cmake deps in parallel' (#21) from claude/issue-20 into master
All checks were successful
CI / build-test-release (push) Successful in 13m7s
All checks were successful
CI / build-test-release (push) Successful in 13m7s
Reviewed-on: #21
This commit is contained in:
commit
b83170ffc8
1 changed files with 7 additions and 1 deletions
|
|
@ -210,7 +210,13 @@ std::string ConfigureCMake(const fs::path& cloneDir, const fs::path& cmakeBuildD
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string BuildCMake(const fs::path& cmakeBuildDir) {
|
std::string BuildCMake(const fs::path& cmakeBuildDir) {
|
||||||
std::string cmd = std::format("cmake --build {}", ShellQuote(fs::absolute(cmakeBuildDir).string()));
|
// Without --parallel, the Unix Makefiles generator builds one translation
|
||||||
|
// unit at a time, leaving every core but one idle. Pass an explicit job
|
||||||
|
// count (a bare --parallel maps to an unbounded `make -j` fork bomb on the
|
||||||
|
// Makefiles generator) so deps like DPP/msquic/glslang compile ~N× faster.
|
||||||
|
unsigned jobs = std::max(1u, std::thread::hardware_concurrency());
|
||||||
|
std::string cmd = std::format("cmake --build {} --parallel {}",
|
||||||
|
ShellQuote(fs::absolute(cmakeBuildDir).string()), jobs);
|
||||||
CommandResult r = RunCommandChecked(cmd);
|
CommandResult r = RunCommandChecked(cmd);
|
||||||
if (r.exitCode != 0) {
|
if (r.exitCode != 0) {
|
||||||
return std::format("cmake --build failed (exit {}): {}", r.exitCode, r.output);
|
return std::format("cmake --build failed (exit {}): {}", r.exitCode, r.output);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue