summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2023-07-27 11:04:49 +0800
committerGitHub <[email protected]>2023-07-27 11:04:49 +0800
commite2d62d264fd60248eee0134622eb9f2acf7575f7 (patch)
tree7e34d2a1d97e50cda96115954a8784c9e9cd3bbb
parent2ced205fec82c50143fe0fbbbfdb31d52e7aeebe (diff)
parentd23c643fe0bb9f2c6a05d8438cc2fa88c56929c2 (diff)
Merge pull request #4017 from xmake-io/mingw
fix and improve mingw package toolchain
-rw-r--r--xmake/toolchains/mingw/check.lua27
1 files changed, 11 insertions, 16 deletions
diff --git a/xmake/toolchains/mingw/check.lua b/xmake/toolchains/mingw/check.lua
index 22a13fadd..483b98ffb 100644
--- a/xmake/toolchains/mingw/check.lua
+++ b/xmake/toolchains/mingw/check.lua
@@ -24,29 +24,24 @@ import("detect.sdks.find_mingw")
-- check the mingw toolchain
function main(toolchain)
- local mingw = find_mingw(toolchain:config("mingw") or config.get("mingw"), {verbose = true, bindir = toolchain:bindir(), cross = toolchain:cross()})
- if not mingw then
- for _, package in ipairs(toolchain:packages()) do
- local installdir = package:installdir()
- if installdir and os.isdir(installdir) then
- mingw = find_mingw(installdir, {verbose = true, cross = toolchain:cross()})
- if mingw then
- break
- end
+ local mingw
+ for _, package in ipairs(toolchain:packages()) do
+ local installdir = package:installdir()
+ if installdir and os.isdir(installdir) then
+ mingw = find_mingw(installdir, {verbose = true, cross = toolchain:cross()})
+ if mingw then
+ break
end
end
end
+ if not mingw then
+ mingw = find_mingw(toolchain:config("mingw") or config.get("mingw"), {verbose = true, bindir = toolchain:bindir(), cross = toolchain:cross()})
+ end
if mingw then
toolchain:config_set("mingw", mingw.sdkdir)
toolchain:config_set("cross", mingw.cross)
toolchain:config_set("bindir", mingw.bindir)
toolchain:configs_save()
- else
- -- failed
- cprint("${bright color.error}please run:")
- cprint(" - xmake config --mingw=xxx")
- cprint("or - xmake global --mingw=xxx")
- raise()
+ return true
end
- return true
end