summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChi Huu Huynh <[email protected]>2024-08-29 11:53:25 +0100
committerChi Huu Huynh <[email protected]>2024-08-29 11:53:25 +0100
commit63c0cd00d74a40f91262a6ca587b9ef0d22e37b8 (patch)
treefc191cc9d35399a1fcca40bf6505b7b0f3dc1f68
parent09f4c713fa673df9d175b58f8209c39d2dea8cea (diff)
add `_get_ninja(package)`, remove ` _get_configs_for_generator` in install
-rw-r--r--xmake/modules/package/tools/cmake.lua18
1 files changed, 12 insertions, 6 deletions
diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua
index 52f89f519..dbb761966 100644
--- a/xmake/modules/package/tools/cmake.lua
+++ b/xmake/modules/package/tools/cmake.lua
@@ -366,6 +366,13 @@ function _get_mingw32_make(package)
end
end
+-- get ninja
+function _get_ninja(package)
+ local ninja = find_tool("ninja")
+ assert(ninja, "ninja not found!")
+ return ninja.program
+end
+
-- https://github.com/xmake-io/xmake-repo/pull/1096
function _fix_cxx_compiler_cmake(package, envs)
local cxx = envs.CMAKE_CXX_COMPILER
@@ -608,9 +615,10 @@ function _get_configs_for_wasm(package, configs, opt)
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)
+ local ninja = _get_ninja(package)
+ if ninja then
+ table.insert(configs, "-DCMAKE_MAKE_PROGRAM=" .. ninja)
+ end
end
end
_get_configs_for_generic(package, configs, opt)
@@ -768,7 +776,6 @@ function _get_configs_for_generator(package, configs, opt)
table.insert(configs, "-G")
if find_tool("ninja") then
table.insert(configs, "Ninja")
- opt.cmake_generator = "Ninja"
else
table.insert(configs, "MinGW Makefiles")
end
@@ -1148,7 +1155,7 @@ function _get_cmake_generator(package, opt)
if not cmake_generator then
if package:has_tool("cc", "clang_cl") or package:has_tool("cxx", "clang_cl") then
cmake_generator = "Ninja"
- elseif is_subhost("windows") and package:is_plat("mingw") then
+ elseif is_subhost("windows") and (package:is_plat("mingw", "wasm")) then
local mingw_make = _get_mingw32_make(package)
if not mingw_make and find_tool("ninja") then
cmake_generator = "Ninja"
@@ -1220,7 +1227,6 @@ end
-- install package
function install(package, configs, opt)
opt = opt or {}
- _get_configs_for_generator(package, configs, opt)
local cmake_generator = _get_cmake_generator(package, opt)
-- enter build directory