summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-09-16 22:53:06 +0800
committerruki <[email protected]>2020-09-16 22:53:06 +0800
commitef86cee77a2cb6cdb3449b48ce33cb8123933a8c (patch)
tree18b4d7f9796d0a37bec49fbabb8dfdd8905bd9ce
parent409275d22cf9137845021203c812a1c890a3ddd8 (diff)
fix emcc for windows
-rw-r--r--xmake/modules/detect/tools/find_emar.lua2
-rw-r--r--xmake/modules/detect/tools/find_emcc.lua2
-rw-r--r--xmake/modules/detect/tools/find_emxx.lua2
-rw-r--r--xmake/toolchains/emcc/xmake.lua18
4 files changed, 14 insertions, 10 deletions
diff --git a/xmake/modules/detect/tools/find_emar.lua b/xmake/modules/detect/tools/find_emar.lua
index ef4ce81b5..cd1e47bda 100644
--- a/xmake/modules/detect/tools/find_emar.lua
+++ b/xmake/modules/detect/tools/find_emar.lua
@@ -63,5 +63,5 @@ function main(opt)
opt.check = opt.check or _check
-- find program
- return find_program(opt.program or "emar", opt)
+ return find_program(opt.program or (is_host("windows") and "emar.bat" or "emar"), opt)
end
diff --git a/xmake/modules/detect/tools/find_emcc.lua b/xmake/modules/detect/tools/find_emcc.lua
index 2eda7543c..90eafed91 100644
--- a/xmake/modules/detect/tools/find_emcc.lua
+++ b/xmake/modules/detect/tools/find_emcc.lua
@@ -41,7 +41,7 @@ function main(opt)
opt = opt or {}
-- find program
- local program = find_program(opt.program or "emcc", opt)
+ local program = find_program(opt.program or (is_host("windows") and "emcc.bat" or "emcc"), opt)
-- find program version
local version = nil
diff --git a/xmake/modules/detect/tools/find_emxx.lua b/xmake/modules/detect/tools/find_emxx.lua
index 6adaea5c9..1c9fe5840 100644
--- a/xmake/modules/detect/tools/find_emxx.lua
+++ b/xmake/modules/detect/tools/find_emxx.lua
@@ -41,7 +41,7 @@ function main(opt)
opt = opt or {}
-- find program
- local program = find_program(opt.program or "em++", opt)
+ local program = find_program(opt.program or (is_host("windows") and "em++.bat" or "em++"), opt)
-- find program version
local version = nil
diff --git a/xmake/toolchains/emcc/xmake.lua b/xmake/toolchains/emcc/xmake.lua
index 0d0901865..a74303b61 100644
--- a/xmake/toolchains/emcc/xmake.lua
+++ b/xmake/toolchains/emcc/xmake.lua
@@ -27,15 +27,18 @@ toolchain("emcc")
-- mark as standalone toolchain
set_kind("standalone")
+
+ -- add suffix for windows
+ local suffix = is_host("windows") and ".bat" or ""
-- set toolset
- set_toolset("cc", "emcc")
- set_toolset("cxx", "emcc", "em++")
- set_toolset("ld", "em++", "emcc")
- set_toolset("sh", "em++", "emcc")
- set_toolset("ar", "emar")
- set_toolset("ex", "emar")
- set_toolset("as", "emcc")
+ 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("ex", "emar" .. suffix)
+ set_toolset("as", "emcc" .. suffix)
-- check toolchain
on_check(function (toolchain)
@@ -49,3 +52,4 @@ toolchain("emcc")
toolchain:add("ldflags", "")
toolchain:add("shflags", "")
end)
+