summaryrefslogtreecommitdiff
path: root/xmake/modules/package/tools/cmake.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2021-06-29 22:50:02 +0800
committerruki <[email protected]>2021-06-29 22:50:02 +0800
commitb115e1612528899fecb16f453ec559d17a54219b (patch)
treeccc56398172b1815fe4f18021bdc87c9fe57590f /xmake/modules/package/tools/cmake.lua
parent3cc1a70d719794fe629552a52a00e0d8095efc17 (diff)
add linkjobs for tools/cmake
Diffstat (limited to 'xmake/modules/package/tools/cmake.lua')
-rw-r--r--xmake/modules/package/tools/cmake.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua
index 097069bf2..680d29a9b 100644
--- a/xmake/modules/package/tools/cmake.lua
+++ b/xmake/modules/package/tools/cmake.lua
@@ -425,6 +425,15 @@ function _get_configs_for_generator(package, configs, opt)
end
table.insert(configs, "-G")
table.insert(configs, cmake_generator)
+ if cmake_generator:find("Ninja", 1, true) then
+ local jobs = opt.jobs or option.get("jobs") or tostring(math.ceil(os.cpuinfo().ncpu * 3 / 2))
+ local linkjobs = opt.linkjobs or option.get("linkjobs")
+ if linkjobs then
+ table.insert(configs, "-DCMAKE_JOB_POOL_COMPILE:STRING=compile")
+ table.insert(configs, "-DCMAKE_JOB_POOL_LINK:STRING=link")
+ table.insert(configs, ("-DCMAKE_JOB_POOLS:STRING=compile=%s;link=%s"):format(jobs, linkjobs))
+ end
+ end
elseif package:is_plat("mingw") and is_subhost("msys") then
table.insert(configs, "-G")
table.insert(configs, "MSYS Makefiles")