Skip to content

Commit f139bce

Browse files
authored
Use gnu -o flag for obj out path instead of -Fo when using clang & clang++ on Windows (#483)
1 parent a885236 commit f139bce

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/lib.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -449,11 +449,13 @@ impl Build {
449449

450450
let mut cmd = compiler.to_command();
451451
let is_arm = target.contains("aarch64") || target.contains("arm");
452+
let clang = compiler.family == ToolFamily::Clang;
452453
command_add_output_file(
453454
&mut cmd,
454455
&obj,
455456
self.cuda,
456457
target.contains("msvc"),
458+
clang,
457459
false,
458460
is_arm,
459461
);
@@ -1144,10 +1146,11 @@ impl Build {
11441146
let is_asm = obj.src.extension().and_then(|s| s.to_str()) == Some("asm");
11451147
let target = self.get_target()?;
11461148
let msvc = target.contains("msvc");
1149+
let compiler = self.try_get_compiler()?;
1150+
let clang = compiler.family == ToolFamily::Clang;
11471151
let (mut cmd, name) = if msvc && is_asm {
11481152
self.msvc_macro_assembler()?
11491153
} else {
1150-
let compiler = self.try_get_compiler()?;
11511154
let mut cmd = compiler.to_command();
11521155
for &(ref a, ref b) in self.env.iter() {
11531156
cmd.env(a, b);
@@ -1163,7 +1166,7 @@ impl Build {
11631166
)
11641167
};
11651168
let is_arm = target.contains("aarch64") || target.contains("arm");
1166-
command_add_output_file(&mut cmd, &obj.dst, self.cuda, msvc, is_asm, is_arm);
1169+
command_add_output_file(&mut cmd, &obj.dst, self.cuda, msvc, clang, is_asm, is_arm);
11671170
// armasm and armasm64 don't requrie -c option
11681171
if !msvc || !is_asm || !is_arm {
11691172
cmd.arg("-c");
@@ -2685,10 +2688,11 @@ fn command_add_output_file(
26852688
dst: &Path,
26862689
cuda: bool,
26872690
msvc: bool,
2691+
clang: bool,
26882692
is_asm: bool,
26892693
is_arm: bool,
26902694
) {
2691-
if msvc && !cuda && !(is_asm && is_arm) {
2695+
if msvc && !clang && !cuda && !(is_asm && is_arm) {
26922696
let mut s = OsString::from("-Fo");
26932697
s.push(&dst);
26942698
cmd.arg(s);

0 commit comments

Comments
 (0)