Skip to content

Commit e6833b0

Browse files
committed
Set CMAKE_BUILD_PARALLEL_LEVEL to available_parallelism
cmake-rs' jobserver doesn't work reliably, if at all. One workaround is to set CMAKE_BUILD_PARALLEL_LEVEL to available_parallelism(). On my machine it shaves ~35 seconds off of boring-sys builds.
1 parent c95d764 commit e6833b0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

boring-sys/build/main.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,10 @@ fn built_boring_source_path(config: &Config) -> &PathBuf {
576576

577577
let mut cfg = get_boringssl_cmake_config(config);
578578

579+
if let Ok(threads) = std::thread::available_parallelism() {
580+
cfg.env("CMAKE_BUILD_PARALLEL_LEVEL", threads.to_string());
581+
}
582+
579583
if config.features.fips {
580584
let (clang, clangxx) = verify_fips_clang_version();
581585
cfg.define("CMAKE_C_COMPILER", clang)

0 commit comments

Comments
 (0)