summaryrefslogtreecommitdiff
path: root/xmake/toolchains
diff options
context:
space:
mode:
authorruki <[email protected]>2026-07-19 23:12:24 +0800
committerGitHub <[email protected]>2026-07-19 23:12:24 +0800
commitc5874deb17f61381d14a6e148488d61c63c8f78f (patch)
tree1e0d0db4906b060d5376153c1416347344ec52e3 /xmake/toolchains
parent64439096a06b65556fff59f3b0b4e6a439b44129 (diff)
parent5895b1d179e31a9d41a145159399a7f5cfd5b7bb (diff)
Merge pull request #7659 from ifarbod/ifarbod/fix-emcc-detectionHEADdev
refactor emcc detection to support both .exe and .bat on windows
Diffstat (limited to 'xmake/toolchains')
-rw-r--r--xmake/toolchains/emcc/xmake.lua28
1 files changed, 19 insertions, 9 deletions
diff --git a/xmake/toolchains/emcc/xmake.lua b/xmake/toolchains/emcc/xmake.lua
index 3d64019e6..8313cd226 100644
--- a/xmake/toolchains/emcc/xmake.lua
+++ b/xmake/toolchains/emcc/xmake.lua
@@ -25,14 +25,25 @@ toolchain("emcc")
set_kind("standalone")
- local suffix = is_host("windows") and ".bat" or ""
- set_toolset("cc", "emcc" .. suffix)
- set_toolset("cxx", "emcc" .. suffix, "em++" .. suffix)
- set_toolset("ld", "em++" .. suffix, "emcc" .. suffix)
- set_toolset("sh", "em++" .. suffix, "emcc" .. suffix)
- set_toolset("ar", "emar" .. suffix)
- set_toolset("as", "emcc" .. suffix)
- set_toolset("ranlib", "emranlib" .. suffix)
+ local function toolnames(...)
+ local result = {}
+ for _, basename in ipairs({...}) do
+ if is_host("windows") then
+ table.insert(result, basename .. ".exe")
+ table.insert(result, basename .. ".bat")
+ else
+ table.insert(result, basename)
+ end
+ end
+ return table.unpack(result)
+ end
+ set_toolset("cc", toolnames("emcc"))
+ set_toolset("cxx", toolnames("emcc", "em++"))
+ set_toolset("ld", toolnames("em++", "emcc"))
+ set_toolset("sh", toolnames("em++", "emcc"))
+ set_toolset("ar", toolnames("emar"))
+ set_toolset("as", toolnames("emcc"))
+ set_toolset("ranlib", toolnames("emranlib"))
on_check(function (toolchain)
import("lib.detect.find_tool")
@@ -82,4 +93,3 @@ toolchain("emcc")
end
end
end)
-