Skip to content

Commit

Permalink
Always pass ZIG_COMMAND env var when --zig is present
Browse files Browse the repository at this point in the history
  • Loading branch information
messense committed May 15, 2022
1 parent 905c58d commit c9366cc
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,15 +200,6 @@ fn compile_target(
let mut build = cargo_zigbuild::Build::new(Some(context.manifest_path.clone()));

build.target = vec![target_triple.to_string()];
// Pass zig command to downstream, eg. python3-dll-a
if let Ok((zig_cmd, zig_args)) = cargo_zigbuild::Zig::find_zig() {
let zig_cmd = if zig_args.is_empty() {
zig_cmd
} else {
format!("{} {}", zig_cmd, zig_args.join(" "))
};
env::set_var("ZIG_COMMAND", zig_cmd);
}
build.build_command("rustc")?
} else {
let mut build = cargo_zigbuild::Build::new(Some(context.manifest_path.clone()));
Expand All @@ -233,6 +224,18 @@ fn compile_target(
build.build_command("rustc")?
};

if context.zig {
// Pass zig command to downstream, eg. python3-dll-a
if let Ok((zig_cmd, zig_args)) = cargo_zigbuild::Zig::find_zig() {
let zig_cmd = if zig_args.is_empty() {
zig_cmd
} else {
format!("{} {}", zig_cmd, zig_args.join(" "))
};
build_command.env("ZIG_COMMAND", zig_cmd);
}
}

build_command
.args(&build_args)
// We need to capture the json messages
Expand Down

0 comments on commit c9366cc

Please sign in to comment.