Skip to content

Commit

Permalink
automatic thead number parallel build makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
ryichsecondary committed Dec 1, 2024
1 parent d43b36f commit 019c1bc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ rand = "0.8.5"
git_info = "^0.1.2"
rayon = "1.5.3"
toml = "0.8.19"

[build-dependencies]
num_cpus = "1.16.0"
4 changes: 3 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@

use std::env;
use std::process::Command;
use num_cpus;

fn main() {
let out_dir = env::var("OUT_DIR").unwrap();
let num_threads = num_cpus::get();
println!("cargo:rerun-if-changed=src/cpp");
println!("cargo:rerun-if-changed=eigsys/eig-hpp");
let output = Command::new("make")
.current_dir("src/cpp")
.arg(format!("OUT_DIR={}", out_dir))
.arg("-j12")
.arg(format!("-j{}", num_threads))
.output()
.expect("Failed to execute make command");

Expand Down

0 comments on commit 019c1bc

Please sign in to comment.