summaryrefslogtreecommitdiff
path: root/xmake/modules/detect
diff options
context:
space:
mode:
authorruki <[email protected]>2020-09-18 00:57:09 +0800
committerruki <[email protected]>2020-09-18 00:57:09 +0800
commitb9122293418bd2eb5a1b3221a728b17df43c96a4 (patch)
treeaebfc967816eebaa7ac0748c50e2f25e59d1e8c0 /xmake/modules/detect
parentb9c28b0518bad65f22dbab68a5572ef3324842ce (diff)
improve llvm to support llvm-mingw
Diffstat (limited to 'xmake/modules/detect')
-rw-r--r--xmake/modules/detect/sdks/find_mingw.lua23
1 files changed, 15 insertions, 8 deletions
diff --git a/xmake/modules/detect/sdks/find_mingw.lua b/xmake/modules/detect/sdks/find_mingw.lua
index 6aa5e3f2a..9ec58de85 100644
--- a/xmake/modules/detect/sdks/find_mingw.lua
+++ b/xmake/modules/detect/sdks/find_mingw.lua
@@ -31,10 +31,14 @@ function _find_mingwdir(sdkdir)
-- get mingw directory
if not sdkdir then
- if is_host("macosx") then
- sdkdir = "/usr/local/opt/mingw-w64"
- elseif is_host("linux") then
- sdkdir = "/usr"
+ if is_host("macosx", "linux") and os.isdir("/opt/llvm-mingw") then
+ sdkdir = "/opt/llvm-mingw"
+ else
+ if is_host("macosx") then
+ sdkdir = "/usr/local/opt/mingw-w64"
+ elseif is_host("linux") then
+ sdkdir = "/usr"
+ end
end
end
@@ -59,11 +63,14 @@ function _find_mingw(sdkdir, bindir, cross)
return
end
- -- select cross on macos, e.g x86_64-w64-mingw32- or i686-w64-mingw32-
- if is_host("macosx", "linux") and not cross then
- local arch = config.get("arch")
- if not arch or arch == "i386" then
+ -- select cross on macOS, e.g x86_64-w64-mingw32- or i686-w64-mingw32-
+ if not cross then
+ if is_arch("i386", "x86", "i686") then
cross = "i686-*-"
+ elseif is_arch("arm64", "aarch64") then
+ cross = "aarch64-*-" -- for llvm-mingw
+ elseif is_arch("arm.*") then
+ cross = "armv7-*-" -- for llvm-mingw
else
cross = "x86_64-*-"
end