Skip to content

Commit

Permalink
Add LLVM based MinGW targets
Browse files Browse the repository at this point in the history
  • Loading branch information
mati865 authored and thomcc committed Oct 26, 2022
1 parent 4796486 commit 76c821e
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2301,7 +2301,8 @@ impl Build {
if target.contains("msvc") {
msvc.to_string()
} else {
format!("{}.exe", gnu)
let cc = if target.contains("llvm") { clang } else { gnu };
format!("{}.exe", cc)
}
} else if target.contains("apple-ios") {
clang.to_string()
Expand Down Expand Up @@ -2329,7 +2330,10 @@ impl Build {
} else if self.get_host()? != target {
let prefix = self.prefix_for_target(&target);
match prefix {
Some(prefix) => format!("{}-{}", prefix, gnu),
Some(prefix) => {
let cc = if target.contains("llvm") { clang } else { gnu };
format!("{}-{}", prefix, cc)
}
None => default.to_string(),
}
} else {
Expand Down Expand Up @@ -2634,7 +2638,8 @@ impl Build {
let cc_env = self.getenv("CROSS_COMPILE");
let cross_compile = cc_env.as_ref().map(|s| s.trim_end_matches('-').to_owned());
cross_compile.or(match &target[..] {
"aarch64-pc-windows-gnu" => Some("aarch64-w64-mingw32"),
// Note: there is no `aarch64-pc-windows-gnu` target, only `-gnullvm`
"aarch64-pc-windows-gnullvm" => Some("aarch64-w64-mingw32"),
"aarch64-uwp-windows-gnu" => Some("aarch64-w64-mingw32"),
"aarch64-unknown-linux-gnu" => Some("aarch64-linux-gnu"),
"aarch64-unknown-linux-musl" => Some("aarch64-linux-musl"),
Expand Down Expand Up @@ -2737,6 +2742,7 @@ impl Build {
"thumbv8m.main-none-eabi" => Some("arm-none-eabi"),
"thumbv8m.main-none-eabihf" => Some("arm-none-eabi"),
"x86_64-pc-windows-gnu" => Some("x86_64-w64-mingw32"),
"x86_64-pc-windows-gnullvm" => Some("x86_64-w64-mingw32"),
"x86_64-uwp-windows-gnu" => Some("x86_64-w64-mingw32"),
"x86_64-rumprun-netbsd" => Some("x86_64-rumprun-netbsd"),
"x86_64-unknown-linux-gnu" => self.find_working_gnu_prefix(&[
Expand Down

0 comments on commit 76c821e

Please sign in to comment.