summaryrefslogtreecommitdiff
path: root/xmake/modules
diff options
context:
space:
mode:
authorruki <[email protected]>2022-06-25 00:25:46 +0800
committerruki <[email protected]>2022-06-25 00:25:46 +0800
commit97b07242da5f37006b9c252bcda20fa2a26adc66 (patch)
tree659263d8dbd9f885ff120c310c08ccd8c1bb04b9 /xmake/modules
parente8989f3392bb4670d9206a697b692aa15bc0f6a3 (diff)
improve trybuild
Diffstat (limited to 'xmake/modules')
-rw-r--r--xmake/modules/private/action/trybuild/cmake.lua16
1 files changed, 16 insertions, 0 deletions
diff --git a/xmake/modules/private/action/trybuild/cmake.lua b/xmake/modules/private/action/trybuild/cmake.lua
index 4217e98a5..e68eff105 100644
--- a/xmake/modules/private/action/trybuild/cmake.lua
+++ b/xmake/modules/private/action/trybuild/cmake.lua
@@ -139,6 +139,20 @@ function _get_configs_for_mingw(configs)
end
end
+-- get configs for wasm
+function _get_configs_for_wasm(configs)
+ local emsdk = os.getenv("EMSDK")
+ local emscripten_cmakefile
+ if emsdk and os.isdir(emsdk) then
+ emscripten_cmakefile = find_file("Emscripten.cmake", path.join(emsdk, "*", "emscripten/cmake/Modules/Platform"))
+ end
+ if emscripten_cmakefile then
+ table.insert(configs, "-DCMAKE_TOOLCHAIN_FILE=" .. emscripten_cmakefile)
+ end
+ assert(emscripten_cmakefile, "Emscripten.cmake not found!")
+ _get_configs_for_generic(configs)
+end
+
-- get configs for cross
function _get_configs_for_cross(configs)
local envs = {}
@@ -186,6 +200,8 @@ function _get_configs(artifacts_dir)
_get_configs_for_appleos(configs)
elseif is_plat("mingw") then
_get_configs_for_mingw(configs)
+ elseif is_plat("wasm") then
+ _get_configs_for_wasm(configs)
elseif not is_plat(os.subhost()) then
_get_configs_for_cross(configs)
end