Skip to content

Commit

Permalink
Set CMAKE_BUILD_PARALLEL_LEVEL to num_cpus
Browse files Browse the repository at this point in the history
cmake-rs' jobserver doesn't work reliably, or at all. One workaround is
to set CMAKE_BUILD_PARALLEL_LEVEL to num_cpus. On my machine it makes
builds over 3x faster
  • Loading branch information
rushilmehra committed Jan 27, 2024
1 parent 3cf8bc4 commit e843b66
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,4 @@ linked_hash_set = "0.1"
once_cell = "1.0"
tower = "0.4"
tower-layer = "0.3"
num_cpus = "1.16.0"
1 change: 1 addition & 0 deletions boring-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,4 @@ bindgen = { workspace = true }
cmake = { workspace = true }
fs_extra = { workspace = true }
fslock = { workspace = true }
num_cpus = { workspace = true }
2 changes: 2 additions & 0 deletions boring-sys/build/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,8 @@ fn built_boring_source_path(config: &Config) -> &PathBuf {

let mut cfg = get_boringssl_cmake_config(config);

cfg.env("CMAKE_BUILD_PARALLEL_LEVEL", num_cpus::get().to_string());

if config.features.fips {
let (clang, clangxx) = verify_fips_clang_version();
cfg.define("CMAKE_C_COMPILER", clang)
Expand Down

0 comments on commit e843b66

Please sign in to comment.