summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaksim Bondarenkov <maksapple2306@gmail.com>2024-07-14 07:50:32 +0300
committerJack O'Connor <oconnor663@gmail.com>2024-07-17 09:55:06 -0700
commitd94882d66d060fb035b3cb7199011b6577bb99ee (patch)
tree5953842aa31e54f6f23f686f2b076c00c507fae9
parent84a4ec319a69682bb84efdcfd3ab376a310d4f6e (diff)
build(windows): add support for gnullvm targets
-rw-r--r--build.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/build.rs b/build.rs
index af5805d..57f72b7 100644
--- a/build.rs
+++ b/build.rs
@@ -74,7 +74,7 @@ fn is_big_endian() -> bool {
endianness() == "big"
}
-// Windows targets may be using the MSVC toolchain or the GNU toolchain. The
+// Windows targets may be using the MSVC toolchain or the MinGW toolchain. The
// right compiler flags to use depend on the toolchain. (And we don't want to
// use flag_if_supported, because we don't want features to be silently
// disabled by old compilers.)
@@ -85,11 +85,15 @@ fn is_windows_msvc() -> bool {
&& target_components()[3] == "msvc"
}
+// MinGW toolchain uses 2 different targets depending on the main compiler.
+// Target for a general MinGW toolchain ends with `-gnu` (GCC is used as C
+// compiler). Target for a LLVM-MinGW toolchain (Clang is used as C compiler)
+// ends with `-gnullvm`.
fn is_windows_gnu() -> bool {
// Some targets are only two components long, so check in steps.
target_components()[1] == "pc"
&& target_components()[2] == "windows"
- && target_components()[3] == "gnu"
+ && target_components()[3] != "msvc"
}
fn new_build() -> cc::Build {