diff options
| author | ruki <[email protected]> | 2022-06-25 00:25:46 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-06-25 00:25:46 +0800 |
| commit | 97b07242da5f37006b9c252bcda20fa2a26adc66 (patch) | |
| tree | 659263d8dbd9f885ff120c310c08ccd8c1bb04b9 | |
| parent | e8989f3392bb4670d9206a697b692aa15bc0f6a3 (diff) | |
improve trybuild
| -rw-r--r-- | CHANGELOG.md | 8 | ||||
| -rw-r--r-- | xmake/modules/private/action/trybuild/cmake.lua | 16 |
2 files changed, 24 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index b0b04c114..f1c17a917 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## master (unreleased) +### Changes + +* Improve tools.cmake to support wasm + ## v2.6.8 ### New features @@ -1314,6 +1318,10 @@ ## master (开发中) +### 改进 + +* 改进 tools.cmake 支持 wasm 库构建 + ## v2.6.8 ### 新特性 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 |
