Remove num_cpus dependency

available_parallelism is stable in Rust 1.59.0
This commit is contained in:
FreezyLemon 2024-04-07 12:37:03 +02:00 committed by Josh Holmer
parent 52a07ed0c6
commit 2d8dd6c0a5
2 changed files with 7 additions and 4 deletions

View File

@ -24,7 +24,6 @@ doctest = false
libc = "0.2" libc = "0.2"
[build-dependencies] [build-dependencies]
num_cpus = "1.11"
cc = "1.0" cc = "1.0"
pkg-config = "0.3" pkg-config = "0.3"
bindgen = { version = "0.64", default-features = false, features = ["runtime"] } bindgen = { version = "0.64", default-features = false, features = ["runtime"] }

View File

@ -1,6 +1,5 @@
extern crate bindgen; extern crate bindgen;
extern crate cc; extern crate cc;
extern crate num_cpus;
extern crate pkg_config; extern crate pkg_config;
use std::env; use std::env;
@ -465,10 +464,15 @@ fn build() -> io::Result<()> {
)); ));
} }
let num_jobs = if let Ok(cpus) = std::thread::available_parallelism() {
cpus.to_string()
} else {
"1".to_string()
};
// run make // run make
if !Command::new("make") if !Command::new("make")
.arg("-j") .arg(format!("-j{num_jobs}"))
.arg(num_cpus::get().to_string())
.current_dir(&source()) .current_dir(&source())
.status()? .status()?
.success() .success()