Skip to content

Commit b344e8e

Browse files
committed
fix targets with zig toolchain
1 parent bbae474 commit b344e8e

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/lib.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1902,7 +1902,14 @@ impl Build {
19021902

19031903
// Target flags
19041904
match cmd.family {
1905-
ToolFamily::Clang { .. } => {
1905+
ToolFamily::Clang { zig_cc } => {
1906+
let target = if zig_cc {
1907+
Cow::Owned(target.replace("-unknown-", "-"))
1908+
} else {
1909+
Cow::Borrowed(target)
1910+
};
1911+
let target = target.as_ref();
1912+
19061913
if !cmd.has_internal_target_arg
19071914
&& !(target.contains("android")
19081915
&& android_clang_compiler_uses_target_arg_internally(&cmd.path))
@@ -1998,7 +2005,7 @@ impl Build {
19982005
);
19992006
}
20002007
} else if let Ok(index) = target_info::RISCV_ARCH_MAPPING
2001-
.binary_search_by_key(&arch, |(arch, _)| &arch)
2008+
.binary_search_by_key(&arch, |(arch, _)| arch)
20022009
{
20032010
cmd.args.push(
20042011
format!(

0 commit comments

Comments
 (0)