From 97b07242da5f37006b9c252bcda20fa2a26adc66 Mon Sep 17 00:00:00 2001 From: ruki Date: Sat, 25 Jun 2022 00:25:46 +0800 Subject: improve trybuild --- xmake/modules/private/action/trybuild/cmake.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'xmake/modules') 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 -- cgit v1.3.1