@@ -33,24 +33,25 @@ function main(toolchain)
33
33
34
34
-- find cross toolchain from external envirnoment
35
35
local envs
36
- local cross_toolchain = find_cross_toolchain (sdkdir , {bindir = bindir })
37
- if not cross_toolchain then
38
- -- find it from packages
39
- for _ , package in ipairs (toolchain :packages ()) do
40
- local installdir = package :installdir ()
41
- if installdir and os .isdir (installdir ) then
42
- cross_toolchain = find_cross_toolchain (installdir )
43
- if cross_toolchain then
44
- -- we need to bind msys2 shell envirnoments for calling cosmocc,
45
- -- @see https://github.com/xmake-io/xmake/issues/5552
46
- if is_subhost (" windows" ) then
47
- envs = package :envs ()
48
- end
49
- break
36
+ local cross_toolchain
37
+ -- find it from packages first, because we need bind msys2 envirnoments from package.
38
+ for _ , package in ipairs (toolchain :packages ()) do
39
+ local installdir = package :installdir ()
40
+ if installdir and os .isdir (installdir ) then
41
+ cross_toolchain = find_cross_toolchain (installdir )
42
+ if cross_toolchain then
43
+ -- we need to bind msys2 shell envirnoments for calling cosmocc,
44
+ -- @see https://github.com/xmake-io/xmake/issues/5552
45
+ if is_subhost (" windows" ) then
46
+ envs = package :envs ()
50
47
end
48
+ break
51
49
end
52
50
end
53
51
end
52
+ if not cross_toolchain then
53
+ cross_toolchain = find_cross_toolchain (sdkdir , {bindir = bindir })
54
+ end
54
55
if not cross_toolchain then
55
56
local cosmocc = find_tool (" cosmocc" , {force = true })
56
57
if cosmocc and cosmocc .program then
0 commit comments