diff options
| author | ruki <[email protected]> | 2023-05-24 22:45:30 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2023-05-24 22:45:30 +0800 |
| commit | bc28991991d916bda0cc8a8d746b000e3e827e48 (patch) | |
| tree | 48c5f4b406197ea4801a1d1aab72126e723105da | |
| parent | 53f86ce179a1ae0b7f2cee85c806cd90209b0429 (diff) | |
improve tools.cmake for wasm
| -rw-r--r-- | xmake/modules/package/tools/cmake.lua | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua index da104f8f1..87c1e2725 100644 --- a/xmake/modules/package/tools/cmake.lua +++ b/xmake/modules/package/tools/cmake.lua @@ -482,8 +482,8 @@ function _get_configs_for_wasm(package, configs, opt) local emscripten_cmakefile = find_file("Emscripten.cmake", path.join(emsdk.emscripten, "cmake/Modules/Platform")) assert(emscripten_cmakefile, "Emscripten.cmake not found!") table.insert(configs, "-DCMAKE_TOOLCHAIN_FILE=" .. emscripten_cmakefile) - if is_subhost("windows") then - local mingw = assert(package:build_getenv("mingw") or package:build_getenv("sdk"), "mingw not found!") + if is_subhost("windows") and opt.cmake_generator ~= "Ninja" then + local mingw = assert(package:build_getenv("mingw") or package:build_getenv("sdk"), "mingw32-make 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) @@ -652,8 +652,15 @@ function _get_configs_for_generator(package, configs, opt) table.insert(configs, "-G") table.insert(configs, _get_cmake_generator_for_msvc(package)) elseif package:is_plat("wasm") and is_subhost("windows") then + -- we attempt to use ninja if it exist + -- @see https://github.com/xmake-io/xmake/issues/3771 table.insert(configs, "-G") - table.insert(configs, "MinGW Makefiles") + if find_tool("ninja") then + table.insert(configs, "Ninja") + opt.cmake_generator = "Ninja" + else + table.insert(configs, "MinGW Makefiles") + end else table.insert(configs, "-G") table.insert(configs, "Unix Makefiles") |
