Skip to content

Commit

Permalink
Use gnu -o flag for obj out path instead of -Fo when using gcc & g++ …
Browse files Browse the repository at this point in the history
…on Windows (#820)
  • Loading branch information
Spencer1O1 committed Jul 17, 2023
1 parent d2a6839 commit 163eb8e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -522,12 +522,14 @@ impl Build {
let mut cmd = compiler.to_command();
let is_arm = target.contains("aarch64") || target.contains("arm");
let clang = compiler.family == ToolFamily::Clang;
let gnu = compiler.family == ToolFamily::Gnu;
command_add_output_file(
&mut cmd,
&obj,
self.cuda,
target.contains("msvc"),
clang,
gnu,
false,
is_arm,
);
Expand Down Expand Up @@ -1377,6 +1379,7 @@ impl Build {
let msvc = target.contains("msvc");
let compiler = self.try_get_compiler()?;
let clang = compiler.family == ToolFamily::Clang;
let gnu = compiler.family == ToolFamily::Gnu;

let (mut cmd, name) = if msvc && asm_ext == Some(AsmFileExt::DotAsm) {
self.msvc_macro_assembler()?
Expand All @@ -1396,7 +1399,9 @@ impl Build {
)
};
let is_arm = target.contains("aarch64") || target.contains("arm");
command_add_output_file(&mut cmd, &obj.dst, self.cuda, msvc, clang, is_asm, is_arm);
command_add_output_file(
&mut cmd, &obj.dst, self.cuda, msvc, clang, gnu, is_asm, is_arm,
);
// armasm and armasm64 don't requrie -c option
if !msvc || !is_asm || !is_arm {
cmd.arg("-c");
Expand Down Expand Up @@ -3578,10 +3583,11 @@ fn command_add_output_file(
cuda: bool,
msvc: bool,
clang: bool,
gnu: bool,
is_asm: bool,
is_arm: bool,
) {
if msvc && !clang && !cuda && !(is_asm && is_arm) {
if msvc && !clang && !gnu && !cuda && !(is_asm && is_arm) {
let mut s = OsString::from("-Fo");
s.push(&dst);
cmd.arg(s);
Expand Down

0 comments on commit 163eb8e

Please sign in to comment.