Remove num_cpus dependency
available_parallelism is stable in Rust 1.59.0
This commit is contained in:
parent
52a07ed0c6
commit
2d8dd6c0a5
@ -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"] }
|
||||||
|
@ -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()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user