aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-11-17 16:18:29 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-11-19 17:37:57 +0300
commit859a34416d0a11f7ebd0bfc85073b46555fc8d41 (patch)
tree32fc650bcf23fbf4c92ea7431102ce3a283522a0
parentfd426bd4bafdd1760d9bbef716dfc70b5bdb1010 (diff)
Add --jobs common option
-rw-r--r--bpkg/common.cli10
-rw-r--r--bpkg/pkg-command.cxx11
2 files changed, 20 insertions, 1 deletions
diff --git a/bpkg/common.cli b/bpkg/common.cli
index 646cb2b..ab3d8bd 100644
--- a/bpkg/common.cli
+++ b/bpkg/common.cli
@@ -81,6 +81,16 @@ namespace bpkg
\li|Even more detailed information.||"
}
+ size_t --jobs|-j
+ {
+ "<num>",
+ "Number of jobs to perform in parallel. If this option is not
+ specified or specified with the \c{0} value, then the number of
+ available hardware threads is used. This option is also propagated
+ when performing build system operations such as \cb{update},
+ \cb{test}, etc."
+ }
+
// In the future we may also have --structured-result, similar to the
// build system.
//
diff --git a/bpkg/pkg-command.cxx b/bpkg/pkg-command.cxx
index c66c8da..1d53e03 100644
--- a/bpkg/pkg-command.cxx
+++ b/bpkg/pkg-command.cxx
@@ -44,7 +44,16 @@ namespace bpkg
{
bspec += ')';
l4 ([&]{trace << "buildspec: " << bspec;});
- run_b (o, verb_b::normal, cvars, vars, bspec);
+
+ run_b (o,
+ verb_b::normal,
+ (o.jobs_specified ()
+ ? strings ({"-j", to_string (o.jobs ())})
+ : strings ()),
+ cvars,
+ vars,
+ bspec);
+
bspec.clear ();
}
};