mirror of
https://github.com/boostorg/build.git
synced 2026-02-17 13:42:14 +00:00
Default to available cpu threads for -j option.
This adds a `b2::system_info` class to obtain available information on system we are running in. Currently provides CPU counts. And currently only implemented for macOS.
This commit is contained in:
@@ -134,6 +134,7 @@
|
||||
#include "timestamp.h"
|
||||
#include "variable.h"
|
||||
#include "execcmd.h"
|
||||
#include "sysinfo.h"
|
||||
|
||||
/* Macintosh is "special" */
|
||||
#ifdef OS_MAC
|
||||
@@ -373,6 +374,11 @@ int main( int argc, char * * argv, char * * arg_environ )
|
||||
return EXITOK;
|
||||
}
|
||||
|
||||
/* Set default parallel jobs to match cpu threads. This can be overridden
|
||||
the usual way with -jX or PARALLELISM env var. */
|
||||
b2::system_info sys_info;
|
||||
globs.jobs = sys_info.cpu_thread_count();
|
||||
|
||||
/* Pick up interesting options. */
|
||||
if ( ( s = getoptval( optv, 'n', 0 ) ) )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user