Skip to content

Commit

Permalink
fix: force windows compiler execution in out_dir to prevent generat…
Browse files Browse the repository at this point in the history
…ion of flag_check.exe in cwd
  • Loading branch information
wmmc88 committed Feb 25, 2025
1 parent 176d721 commit 570d80c
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1337,17 +1337,15 @@ impl Build {

let mut cmd = compiler.to_command();
let is_arm = matches!(target.arch, "aarch64" | "arm");
let clang = compiler.is_like_clang();
let gnu = compiler.family == ToolFamily::Gnu;
command_add_output_file(
&mut cmd,
&obj,
CmdAddOutputFileArgs {
cuda: self.cuda,
is_assembler_msvc: false,
msvc: compiler.is_like_msvc(),
clang,
gnu,
clang: compiler.is_like_clang(),
gnu: compiler.is_like_gnu(),
is_asm: false,
is_arm,
},
Expand All @@ -1366,7 +1364,7 @@ impl Build {
cmd.env("_LINK_", "-entry:main");
}

let output = cmd.output()?;
let output = cmd.current_dir(out_dir).output()?;
let is_supported = output.status.success() && output.stderr.is_empty();

self.build_cache
Expand Down Expand Up @@ -1749,8 +1747,6 @@ impl Build {
let target = self.get_target()?;
let msvc = target.env == "msvc";
let compiler = self.try_get_compiler()?;
let clang = compiler.is_like_clang();
let gnu = compiler.family == ToolFamily::Gnu;

let is_assembler_msvc = msvc && asm_ext == Some(AsmFileExt::DotAsm);
let mut cmd = if is_assembler_msvc {
Expand All @@ -1770,8 +1766,8 @@ impl Build {
cuda: self.cuda,
is_assembler_msvc,
msvc: compiler.is_like_msvc(),
clang,
gnu,
clang: compiler.is_like_clang(),
gnu: compiler.is_like_gnu(),
is_asm,
is_arm,
},
Expand Down

0 comments on commit 570d80c

Please sign in to comment.