summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-12-04 09:04:12 +0800
committerGitHub <[email protected]>2022-12-04 09:04:12 +0800
commit06195f234f01a36603f5f064b6e7772f7f617e85 (patch)
tree484f02553e8aacd9aaafb1ca4e2ec9ccebf30a4c
parent852c47b94e933906931ae02734c2f60e3e2961f7 (diff)
parentd0ce4ec4c9a7f208a83c51eb7555bdb3859aff59 (diff)
Merge pull request #3132 from SirLynix/patch-12
improve cmake generator with wasm (uses mingw make)
-rw-r--r--xmake/modules/package/tools/cmake.lua9
1 files changed, 8 insertions, 1 deletions
diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua
index 40437a1c7..3304cf90b 100644
--- a/xmake/modules/package/tools/cmake.lua
+++ b/xmake/modules/package/tools/cmake.lua
@@ -483,6 +483,10 @@ function _get_configs_for_wasm(package, configs, opt)
table.insert(configs, "-DCMAKE_TOOLCHAIN_FILE=" .. emscripten_cmakefile)
end
assert(emscripten_cmakefile, "Emscripten.cmake not found!")
+ if is_subhost("windows") then
+ local mingw = assert(package:build_getenv("mingw") or package:build_getenv("sdk"), "mingw not found!")
+ table.insert(configs, "-DCMAKE_MAKE_PROGRAM=" .. _translate_paths(path.join(mingw, "bin", "mingw32-make.exe")))
+ end
_get_configs_for_generic(package, configs, opt)
end
@@ -645,6 +649,9 @@ function _get_configs_for_generator(package, configs, opt)
elseif package:is_plat("windows") then
table.insert(configs, "-G")
table.insert(configs, _get_cmake_generator_for_msvc(package))
+ elseif package:is_plat("wasm") and is_subhost("windows") then
+ table.insert(configs, "-G")
+ table.insert(configs, "MinGW Makefiles")
else
table.insert(configs, "-G")
table.insert(configs, "Unix Makefiles")
@@ -841,7 +848,7 @@ function _install_for_make(package, configs, opt)
if is_host("bsd") then
os.vrunv("gmake", argv)
os.vrunv("gmake", {"install"})
- elseif is_subhost("windows") and package:is_plat("mingw") then
+ elseif is_subhost("windows") and package:is_plat("mingw", "wasm") then
local mingw = assert(package:build_getenv("mingw") or package:build_getenv("sdk"), "mingw not found!")
local mingw_make = path.join(mingw, "bin", "mingw32-make.exe")
os.vrunv(mingw_make, argv)