Skip to content

Commit

Permalink
fix targets with zig toolchain
Browse files Browse the repository at this point in the history
  • Loading branch information
QuentinPerez committed Mar 22, 2024
1 parent bbae474 commit b344e8e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1902,7 +1902,14 @@ impl Build {

// Target flags
match cmd.family {
ToolFamily::Clang { .. } => {
ToolFamily::Clang { zig_cc } => {
let target = if zig_cc {
Cow::Owned(target.replace("-unknown-", "-"))
} else {
Cow::Borrowed(target)
};
let target = target.as_ref();

if !cmd.has_internal_target_arg
&& !(target.contains("android")
&& android_clang_compiler_uses_target_arg_internally(&cmd.path))
Expand Down Expand Up @@ -1998,7 +2005,7 @@ impl Build {
);
}
} else if let Ok(index) = target_info::RISCV_ARCH_MAPPING
.binary_search_by_key(&arch, |(arch, _)| &arch)
.binary_search_by_key(&arch, |(arch, _)| arch)
{
cmd.args.push(
format!(
Expand Down

0 comments on commit b344e8e

Please sign in to comment.