summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-01-12 23:00:00 +0800
committerruki <[email protected]>2021-01-12 23:00:00 +0800
commitde0f58af5a504ac72e7c23632fafdd5abdf0e771 (patch)
tree2b8f9db7b1f41a252c7d6e321ab8436bdb12aa81
parent5072adb314a1a9dd723dea2bdead3370a58d1b8f (diff)
pass jobs to buildtools
-rw-r--r--xmake/modules/package/tools/autoconf.lua3
-rw-r--r--xmake/modules/package/tools/cmake.lua4
-rw-r--r--xmake/modules/package/tools/ninja.lua2
3 files changed, 5 insertions, 4 deletions
diff --git a/xmake/modules/package/tools/autoconf.lua b/xmake/modules/package/tools/autoconf.lua
index f715c041a..759c6da5c 100644
--- a/xmake/modules/package/tools/autoconf.lua
+++ b/xmake/modules/package/tools/autoconf.lua
@@ -233,7 +233,8 @@ function install(package, configs, opt)
configure(package, configs, opt)
-- do make and install
- local njob = tostring(math.ceil(os.cpuinfo().ncpu * 3 / 2))
+ opt = opt or {}
+ local njob = opt.jobs or tostring(math.ceil(os.cpuinfo().ncpu * 3 / 2))
local argv = {"-j" .. njob}
if option.get("verbose") then
table.insert(argv, "V=1")
diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua
index ac8c87a73..c17282be3 100644
--- a/xmake/modules/package/tools/cmake.lua
+++ b/xmake/modules/package/tools/cmake.lua
@@ -470,7 +470,7 @@ end
-- do build for make
function _build_for_make(package, configs, opt)
- local njob = tostring(math.ceil(os.cpuinfo().ncpu * 3 / 2))
+ local njob = opt.jobs or tostring(math.ceil(os.cpuinfo().ncpu * 3 / 2))
local argv = {"-j" .. njob}
if option.get("verbose") then
table.insert(argv, "VERBOSE=1")
@@ -539,7 +539,7 @@ end
-- do install for make
function _install_for_make(package, configs, opt)
- local njob = tostring(math.ceil(os.cpuinfo().ncpu * 3 / 2))
+ local njob = opt.jobs or tostring(math.ceil(os.cpuinfo().ncpu * 3 / 2))
local argv = {"-j" .. njob}
if option.get("verbose") then
table.insert(argv, "VERBOSE=1")
diff --git a/xmake/modules/package/tools/ninja.lua b/xmake/modules/package/tools/ninja.lua
index dd3a279e5..45cbe7a1e 100644
--- a/xmake/modules/package/tools/ninja.lua
+++ b/xmake/modules/package/tools/ninja.lua
@@ -26,7 +26,7 @@ import("lib.detect.find_tool")
function build(package, configs, opt)
opt = opt or {}
local buildir = opt.buildir or os.curdir()
- local njob = tostring(math.ceil(os.cpuinfo().ncpu * 3 / 2))
+ local njob = opt.jobs or tostring(math.ceil(os.cpuinfo().ncpu * 3 / 2))
local ninja = assert(find_tool("ninja"), "ninja not found!")
local argv = {"-C", buildir}
if option.get("verbose") then