I need to pass -j
argument to ninja while building Android app with gradle.
(on Windows)
Why do I need this? - We have huge unified c++ files that require lots of memory to compile. Currently I have no enough memory (~10GB free) to compile them in parallel on 8 cores. Thus clang fails when memory runs out.
I see that gradle runs cmake
with --build
key so I've tried to add my -j1
arg there. But seems arguments
field is used only for cmake generation, because it doesn't affect command line passed to cmake in build stage.
externalNativeBuild {
cmake {
cFlags "..."
cppFlags "..."
arguments "... -- -j1"
}
}
The only way I see now it to replace ninja
with some wrapper to pass -j
from there. But this is the last options I would like to use.
Appreciate any ideas about how to achieve this valid way.