diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2017-02-28T11·54+0100 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2017-02-28T11·54+0100 |
commit | 7251d048fa812d2551b7003bc9f13a8f5d4c95a5 (patch) | |
tree | 242d94f45d24a2becf373cdda7e34f3128111982 /src/libmain/shared.cc | |
parent | 3fab1f04a7d9a5d8ca0f7faf071d5767f93c7e22 (diff) |
Support auto-configuration of build-max-jobs
"build-max-jobs" and the "-j" option can now be set to "auto" to use the number of CPUs in the system. (Unlike build-cores, it doesn't use 0 to imply auto-configuration, because a) magic values are a bad idea in general; b) 0 is a legitimate value used to disable local building.) Fixes #1198.
Diffstat (limited to 'src/libmain/shared.cc')
-rw-r--r-- | src/libmain/shared.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc index 53fa83fe0dee..326202d295fb 100644 --- a/src/libmain/shared.cc +++ b/src/libmain/shared.cc @@ -167,6 +167,10 @@ struct LegacyArgs : public MixCommonArgs settings.set("build-fallback", "true"); }); + mkFlag1('j', "max-jobs", "jobs", "maximum number of parallel builds", [=](std::string s) { + settings.set("build-max-jobs", s); + }); + auto intSettingAlias = [&](char shortName, const std::string & longName, const std::string & description, const std::string & dest) { mkFlag<unsigned int>(shortName, longName, description, [=](unsigned int n) { @@ -174,7 +178,6 @@ struct LegacyArgs : public MixCommonArgs }); }; - intSettingAlias('j', "max-jobs", "maximum number of parallel builds", "build-max-jobs"); intSettingAlias(0, "cores", "maximum number of CPU cores to use inside a build", "build-cores"); intSettingAlias(0, "max-silent-time", "number of seconds of silence before a build is killed", "build-max-silent-time"); intSettingAlias(0, "timeout", "number of seconds before a build is killed", "build-timeout"); |