diff options
| author | Chi Huu Huynh <[email protected]> | 2024-08-29 01:31:31 +0100 |
|---|---|---|
| committer | Chi Huu Huynh <[email protected]> | 2024-08-29 01:31:31 +0100 |
| commit | fb1ac8a218a8f064826e937d074f008b08a47c09 (patch) | |
| tree | 64a90da3ab74e39ae74c87098038f08cac8e5011 | |
| parent | 2a2ee54fe65cd4035bc25b01391e63170c952c38 (diff) | |
fix windows wasm compilation with packages
| -rw-r--r-- | xmake/core/platform/platform.lua | 2 | ||||
| -rw-r--r-- | xmake/modules/package/tools/cmake.lua | 17 |
2 files changed, 13 insertions, 6 deletions
diff --git a/xmake/core/platform/platform.lua b/xmake/core/platform/platform.lua index 1b2ba19e3..a7ab68fca 100644 --- a/xmake/core/platform/platform.lua +++ b/xmake/core/platform/platform.lua @@ -151,7 +151,7 @@ end -- get the toolchains function _instance:toolchains(opt) local toolchains = self:_memcache():get("toolchains") - if not toolchains then + if not toolchains or #toolchains == 0 then -- get current valid toolchains from configuration cache local names = nil diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua index 99dfe0436..38b25db51 100644 --- a/xmake/modules/package/tools/cmake.lua +++ b/xmake/modules/package/tools/cmake.lua @@ -601,10 +601,16 @@ 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") and opt.cmake_generator ~= "Ninja" then - local mingw_make = _get_mingw32_make(package) - if mingw_make then - table.insert(configs, "-DCMAKE_MAKE_PROGRAM=" .. mingw_make) + if is_subhost("windows") then + if opt.cmake_generator ~= "Ninja" then + local mingw_make = _get_mingw32_make(package) + if mingw_make then + table.insert(configs, "-DCMAKE_MAKE_PROGRAM=" .. mingw_make) + end + else + local ninja = find_tool("ninja") + assert(ninja, "ninja not found!") + table.insert(configs, "-DCMAKE_MAKE_PROGRAM=" .. ninja.program) end end _get_configs_for_generic(package, configs, opt) @@ -1214,8 +1220,9 @@ end -- install package function install(package, configs, opt) opt = opt or {} - local cmake_generator = _get_cmake_generator(package, opt) + _get_configs(package, configs, opt) + local cmake_generator = _get_cmake_generator(package, opt) -- enter build directory local buildir = opt.buildir or package:buildir() os.mkdir(path.join(buildir, "install")) |
