-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
request: new environment variable NINJA_OPTIONS (or NINJA_FLAGS) #797
Comments
What's the use-case for this? |
the default value for -j is too high on my system (# cores + 2) and makes the UI completely unresponsive if I'm doing active work while compiling code.. So I would prefer to have the ability to set a default value that is lower. So the ability to set it in an environment variable per-system would allow greater flexibility. |
What number do you use ? Just # cores? How many cores do you have? Wouldn't it be better to just pick a better default for -j? Then it'd just work for everyone, without everyone having to set some option. |
I have 8 cores in my system.. and -j10 (the default) just kills the system too much making it unusable. Doing simply # of cores would also probably be a better default. However, I would like to set things at -j4 by default as I usually run more than one compile at a time. (multiple archs usually, or just different variations on a build.. e.g. regular or steam enabled, debug or release).. |
What platform are you on? I wonder if there are OS-related causes. (In principle your UI shouldn't lag no matter how much is going on, but in practice scheduling is hard.) |
It's a linux system. |
Try nicing the Ninja command -- this will lower the priority of it and the processes it spawns. |
Why not just use $NINJAFLAGS ? Then it could fit both of |
When ninja invokes ninja (for instance when building a sub-project) it is useful to have a way to control the flags used by the sub-ninja process. If I pass '-d explain' or '-v' when starting ninja from the command line on the top project, I expect these flags to be forwarded to the sub-ninja process. Note that this patch has limited parsing capabilities of the NINJA_FLAGS environment variables but that should be enough for our use case. Fixes ninja-build#797, ninja-build#922 and ninja-build#816.
See #1370 about adding environment variables. |
Just ran into this and saw that the pull request for |
The independent Ninja build language reimplementation https://github.com/michaelforney/samurai supports this via the environment variable SAMUFLAGS. Simply use samu anywhere you'd otherwise use ninja, or install samu as your system /usr/bin/ninja (some linux distros have options to install this competing implementation as the default, or only, ninja). |
This would allow global user-override parameters such as specifying -j#
e.g.
export NINJA_OPTIONS=-j6
would force all builds to be run with -j6 instead of the default. (unless overridden on the commandline of a particular execution of ninja).
The text was updated successfully, but these errors were encountered: