summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2024-09-05 23:39:34 +0800
committerruki <[email protected]>2024-09-05 23:39:34 +0800
commit82532a9c09fc8adc9e1b6c22ecfebfef0bd88792 (patch)
treee58fa74bcf4b6f38f0453bb14d0ae229923c679e
parente96c3155ee33cdba5bd83f756d1134c55e4c9fa8 (diff)
improve cosmocc
-rw-r--r--xmake/toolchains/cosmocc/check.lua29
1 files changed, 15 insertions, 14 deletions
diff --git a/xmake/toolchains/cosmocc/check.lua b/xmake/toolchains/cosmocc/check.lua
index 5876db68f..72f4cfe37 100644
--- a/xmake/toolchains/cosmocc/check.lua
+++ b/xmake/toolchains/cosmocc/check.lua
@@ -33,25 +33,26 @@ function main(toolchain)
-- find cross toolchain from external envirnoment
local envs
- local cross_toolchain = find_cross_toolchain(sdkdir, {bindir = bindir})
- if not cross_toolchain then
- -- find it from packages
- for _, package in ipairs(toolchain:packages()) do
- local installdir = package:installdir()
- if installdir and os.isdir(installdir) then
- cross_toolchain = find_cross_toolchain(installdir)
- if cross_toolchain then
- -- we need to bind msys2 shell envirnoments for calling cosmocc,
- -- @see https://github.com/xmake-io/xmake/issues/5552
- if is_subhost("windows") then
- envs = package:envs()
- end
- break
+ local cross_toolchain
+ -- find it from packages first, because we need bind msys2 envirnoments from package.
+ for _, package in ipairs(toolchain:packages()) do
+ local installdir = package:installdir()
+ if installdir and os.isdir(installdir) then
+ cross_toolchain = find_cross_toolchain(installdir)
+ if cross_toolchain then
+ -- we need to bind msys2 shell envirnoments for calling cosmocc,
+ -- @see https://github.com/xmake-io/xmake/issues/5552
+ if is_subhost("windows") then
+ envs = package:envs()
end
+ break
end
end
end
if not cross_toolchain then
+ cross_toolchain = find_cross_toolchain(sdkdir, {bindir = bindir})
+ end
+ if not cross_toolchain then
local cosmocc = find_tool("cosmocc", {force = true})
if cosmocc and cosmocc.program then
local bindir = path.directory(cosmocc.program)