diff options
| author | Damian Höster <[email protected]> | 2026-08-21 23:49:41 +0200 |
|---|---|---|
| committer | Damian Höster <[email protected]> | 2026-08-21 23:49:41 +0200 |
| commit | 0eb5c44e2ddb51f58ae76aadf823bacba51078f5 (patch) | |
| tree | 6bcefe5b9ade4f77f86e5d0a364a913979defc87 /xmake/rules/c++/modules/support.lua | |
| parent | 780159d6946115b89bb4657856fba361e79a1555 (diff) | |
Improve MinGW toolchain support for Clang and libc++
This patch primarily enables support for LLVM libc++ runtimes (c++_static, c++_shared) in the mingw toolchain, and updates C++20 module rules so that `import std;` resolves to LLVM libc++ instead of hardcoded GNU libstdc++ when using Clang on MinGW (llvm-mingw), which caused build failures before.
Also, configuring for MinGW on Linux or macOS without a cross-compiler present would previously result in fallback to host-native /usr/bin/gcc. Now unprefixed fallback is only used on Windows/MSYS2/Cygwin hosts. The toolchain check now also automatically selects clang when pointing at llvm-mingw or a clang-only installation, avoiding the need to manually pass clang = true.
Diffstat (limited to 'xmake/rules/c++/modules/support.lua')
| -rw-r--r-- | xmake/rules/c++/modules/support.lua | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/xmake/rules/c++/modules/support.lua b/xmake/rules/c++/modules/support.lua index 126e25c61..38df28a05 100644 --- a/xmake/rules/c++/modules/support.lua +++ b/xmake/rules/c++/modules/support.lua @@ -92,7 +92,15 @@ function get_cpplibrary_name(target) end elseif target:is_plat("macosx", "iphoneos", "watchos", "appletvos", "applexros", "bsd", "harmony") then return "c++" - elseif target:is_plat("linux", "mingw", "cygwin", "msys", "haiku") then + elseif target:is_plat("linux", "cygwin", "msys", "haiku") then + return "stdc++" + elseif target:is_plat("mingw") then + local toolchain_inst = target:toolchain("mingw") + local is_clang = (toolchain_inst and toolchain_inst:config("clang")) or + target:has_tool("cxx", "clang", "clangxx", "clang_cl") + if is_clang then + return "c++" + end return "stdc++" elseif target:is_plat("windows") then return "msstl" |
