Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use jobserver if available #153

Merged
merged 1 commit into from
Oct 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,7 @@ impl Config {
}

// If the generated project is Makefile based we should carefully transfer corresponding CARGO_MAKEFLAGS
let mut use_jobserver = false;
if fs::metadata(&build.join("Makefile")).is_ok() {
match env::var_os("CARGO_MAKEFLAGS") {
// Only do this on non-windows and non-bsd
Expand All @@ -796,6 +797,7 @@ impl Config {
|| cfg!(target_os = "bitrig")
|| cfg!(target_os = "dragonflybsd")) =>
{
use_jobserver = true;
cmd.env("MAKEFLAGS", makeflags);
}
_ => {}
Expand All @@ -816,7 +818,7 @@ impl Config {

// --parallel requires CMake 3.12:
// https://cmake.org/cmake/help/latest/release/3.12.html#command-line
if version >= Version::new(3, 12) {
if version >= Version::new(3, 12) && !use_jobserver {
if let Ok(s) = env::var("NUM_JOBS") {
// See https://cmake.org/cmake/help/v3.12/manual/cmake.1.html#build-tool-mode
cmd.arg("--parallel").arg(s);
Expand Down