Skip to content

Commit 163eb8e

Browse files
authored
Use gnu -o flag for obj out path instead of -Fo when using gcc & g++ on Windows (#820)
1 parent d2a6839 commit 163eb8e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/lib.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -522,12 +522,14 @@ impl Build {
522522
let mut cmd = compiler.to_command();
523523
let is_arm = target.contains("aarch64") || target.contains("arm");
524524
let clang = compiler.family == ToolFamily::Clang;
525+
let gnu = compiler.family == ToolFamily::Gnu;
525526
command_add_output_file(
526527
&mut cmd,
527528
&obj,
528529
self.cuda,
529530
target.contains("msvc"),
530531
clang,
532+
gnu,
531533
false,
532534
is_arm,
533535
);
@@ -1377,6 +1379,7 @@ impl Build {
13771379
let msvc = target.contains("msvc");
13781380
let compiler = self.try_get_compiler()?;
13791381
let clang = compiler.family == ToolFamily::Clang;
1382+
let gnu = compiler.family == ToolFamily::Gnu;
13801383

13811384
let (mut cmd, name) = if msvc && asm_ext == Some(AsmFileExt::DotAsm) {
13821385
self.msvc_macro_assembler()?
@@ -1396,7 +1399,9 @@ impl Build {
13961399
)
13971400
};
13981401
let is_arm = target.contains("aarch64") || target.contains("arm");
1399-
command_add_output_file(&mut cmd, &obj.dst, self.cuda, msvc, clang, is_asm, is_arm);
1402+
command_add_output_file(
1403+
&mut cmd, &obj.dst, self.cuda, msvc, clang, gnu, is_asm, is_arm,
1404+
);
14001405
// armasm and armasm64 don't requrie -c option
14011406
if !msvc || !is_asm || !is_arm {
14021407
cmd.arg("-c");
@@ -3578,10 +3583,11 @@ fn command_add_output_file(
35783583
cuda: bool,
35793584
msvc: bool,
35803585
clang: bool,
3586+
gnu: bool,
35813587
is_asm: bool,
35823588
is_arm: bool,
35833589
) {
3584-
if msvc && !clang && !cuda && !(is_asm && is_arm) {
3590+
if msvc && !clang && !gnu && !cuda && !(is_asm && is_arm) {
35853591
let mut s = OsString::from("-Fo");
35863592
s.push(&dst);
35873593
cmd.arg(s);

0 commit comments

Comments
 (0)