ninja-build / ninja

a small build system with a focus on speed
https://ninja-build.org/
Apache License 2.0
10.93k stars 1.58k forks source link

Support setting default -j value in a build.ninja file #1352

Open RedBeard0531 opened 6 years ago

RedBeard0531 commented 6 years ago

While the default of using -j=#cores makes sense in most cases, it would be nice if there was a way to specify a higher default inside of a build.ninja file. This makes it easier to use distributed compilation because the capacity of the cluster could be set in the generator script and users won't need to remember to use -j=BIG_NUMBER, or update it as the cluster changes size. Of course, an explicitly set -j on the command line would override the default.

I think there are two natural syntaxes for this, a magic variable like default_jobs = 400 or a magic pool like:

pool default:
    depth = 400

The latter seems like a good combination with #1351 (sub-pools) since it would be as-if all pools and rules have a default pool = default variable unless they they specify a different pool explicitly.

ocroquette commented 6 years ago

Would this change help? https://github.com/ninja-build/ninja/pull/1399

jhasse commented 5 years ago

Would this change help? #1399

I don't think so, as he wants to set it in the generator script.