From de0f58af5a504ac72e7c23632fafdd5abdf0e771 Mon Sep 17 00:00:00 2001 From: ruki Date: Tue, 12 Jan 2021 23:00:00 +0800 Subject: pass jobs to buildtools --- xmake/modules/package/tools/autoconf.lua | 3 ++- xmake/modules/package/tools/cmake.lua | 4 ++-- xmake/modules/package/tools/ninja.lua | 2 +- 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 -- cgit v1.3.1