diff options
| author | ruki <[email protected]> | 2021-01-12 23:01:38 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-01-12 23:01:38 +0800 |
| commit | 1d7ff7a14fd27aa6164d43a62a66a516f574978b (patch) | |
| tree | c7802081086a8c751702e7a984fd458f7045623b | |
| parent | de0f58af5a504ac72e7c23632fafdd5abdf0e771 (diff) | |
pass jobs for xrepo
| -rw-r--r-- | xmake/actions/require/xmake.lua | 2 | ||||
| -rw-r--r-- | xmake/modules/package/tools/autoconf.lua | 2 | ||||
| -rw-r--r-- | xmake/modules/package/tools/cmake.lua | 4 | ||||
| -rw-r--r-- | xmake/modules/package/tools/ninja.lua | 2 | ||||
| -rw-r--r-- | xmake/modules/private/xrepo/action/install.lua | 9 |
5 files changed, 13 insertions, 6 deletions
diff --git a/xmake/actions/require/xmake.lua b/xmake/actions/require/xmake.lua index ca44d9e62..a5104ce1e 100644 --- a/xmake/actions/require/xmake.lua +++ b/xmake/actions/require/xmake.lua @@ -46,6 +46,8 @@ task("require") " $ xmake require --clean", " $ xmake require --clean zlib tbox pcr*" } , {'f', "force", "k", nil, "Force to reinstall all package dependencies." } + , {'j', "jobs", "kv", tostring(math.ceil(os.cpuinfo().ncpu * 3 / 2)), + "Specifies the number of jobs to build simultaneously." } , {nil, "shallow", "k", nil, "Does not install dependent packages." } , {'l', "list", "k", nil, "List all package dependencies in project.", "e.g.", diff --git a/xmake/modules/package/tools/autoconf.lua b/xmake/modules/package/tools/autoconf.lua index 759c6da5c..0f50bbb6d 100644 --- a/xmake/modules/package/tools/autoconf.lua +++ b/xmake/modules/package/tools/autoconf.lua @@ -234,7 +234,7 @@ function install(package, configs, opt) -- do make and install opt = opt or {} - local njob = opt.jobs or tostring(math.ceil(os.cpuinfo().ncpu * 3 / 2)) + local njob = opt.jobs or option.get("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 c17282be3..e13453303 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 = opt.jobs or tostring(math.ceil(os.cpuinfo().ncpu * 3 / 2)) + local njob = opt.jobs or option.get("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 = opt.jobs or tostring(math.ceil(os.cpuinfo().ncpu * 3 / 2)) + local njob = opt.jobs or option.get("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 45cbe7a1e..e1feccc14 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 = opt.jobs or tostring(math.ceil(os.cpuinfo().ncpu * 3 / 2)) + local njob = opt.jobs or option.get("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 diff --git a/xmake/modules/private/xrepo/action/install.lua b/xmake/modules/private/xrepo/action/install.lua index 4fed2583c..2f63b0e5d 100644 --- a/xmake/modules/private/xrepo/action/install.lua +++ b/xmake/modules/private/xrepo/action/install.lua @@ -32,14 +32,16 @@ function menu_options() { {'k', "kind", "kv", nil, "Enable static/shared library.", values = {"static", "shared"} }, - {'p', "plat", "kv", nil, "Set the given platform." }, - {'a', "arch", "kv", nil, "Set the given architecture." }, + {'p', "plat", "kv", nil, "Set the given platform." }, + {'a', "arch", "kv", nil, "Set the given architecture." }, {'m', "mode", "kv", nil, "Set the given mode.", values = {"release", "debug"} }, {'f', "configs", "kv", nil, "Set the given extra package configs.", "e.g.", " - xrepo install -f \"vs_runtime=MD\" zlib", " - xrepo install -f \"regex=true,thread=true\" boost"}, + {'j', "jobs", "kv", tostring(math.ceil(os.cpuinfo().ncpu * 3 / 2)), + "Specifies the number of jobs to build simultaneously."}, {category = "Visual Studio SDK Configuration" }, {nil, "vs", "kv", nil, "The Microsoft Visual Studio" , " e.g. --vs=2017" }, @@ -177,6 +179,9 @@ function _install_packages(packages) if option.get("diagnosis") then table.insert(require_argv, "-D") end + if option.get("jobs") then + table.insert(require_argv, option.get("jobs")) + end if option.get("force") then table.insert(require_argv, "--force") end |
