From 771b8ed67428eaf79ef2c240d8df2ab753fa3005 Mon Sep 17 00:00:00 2001 From: Spencer Smith Date: Mon, 17 Jul 2023 02:14:37 -0600 Subject: [PATCH 1/2] Use gnu -o flag for obj out path instead of -Fo when using gcc & g++ on Windows --- src/lib.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index e295e9714..db59bf8b6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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, ); @@ -1348,6 +1350,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()? @@ -1367,7 +1370,7 @@ 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"); @@ -3544,10 +3547,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); From 786016cd894e32bbcdcd22243e9071f981e66185 Mon Sep 17 00:00:00 2001 From: Spencer Smith Date: Mon, 17 Jul 2023 02:23:04 -0600 Subject: [PATCH 2/2] Fixed formatting --- src/lib.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index db59bf8b6..37e2dda98 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1370,7 +1370,9 @@ impl Build { ) }; let is_arm = target.contains("aarch64") || target.contains("arm"); - command_add_output_file(&mut cmd, &obj.dst, self.cuda, msvc, clang, gnu, 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");