File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -25,9 +25,10 @@ local os = require("base/os")
25
25
function is_cross (plat , arch )
26
26
plat = plat or os .subhost ()
27
27
arch = arch or os .subarch ()
28
- if os .host () == " windows " then
29
- local host_arch = os . arch ()
28
+ local host_os = os .host ()
29
+ if host_os == " windows " then
30
30
if plat == " windows" then
31
+ local host_arch = os .arch ()
31
32
-- maybe cross-compilation for arm64 on x86/x64
32
33
if (host_arch == " x86" or host_arch == " x64" ) and arch == " arm64" then
33
34
return true
@@ -39,13 +40,22 @@ function is_cross(plat, arch)
39
40
elseif plat == " mingw" then
40
41
return false
41
42
end
43
+ elseif host_os == " macosx" then
44
+ if plat == " macosx" then
45
+ local host_arch = os .arch ()
46
+ -- arm64 macOS can execute x86_64 (rosetta)
47
+ if host_arch == " arm64" and arch == " x86_64" then
48
+ return false
49
+ end
50
+ end
42
51
end
43
52
if plat ~= os .host () and plat ~= os .subhost () then
44
53
return true
45
54
end
46
55
if arch ~= os .arch () and arch ~= os .subarch () then
47
56
return true
48
57
end
58
+ return false
49
59
end
50
60
51
61
return is_cross
You can’t perform that action at this time.
0 commit comments