`ninja` with multiple` build.ninja` files?
I would like to run multiple builds ninja
at the same time. Each assembly is in its own directory and has its own file build.ninja
.
I could just do the following:
cd <build-dir-1>
ninja &
cd <build-dir-2>
ninja &
...
cd <build-dir-last>
ninja
.... but there are several problems with this:
- By default, the number of threads used by Ninja is probably not optimal when running multiple independent assemblies at the same time.
- The exit, I hope, will alternate unwisely.
EDIT I could just as well just keep ninja
the foreground calls (which is what I am currently doing), but then there would be no easy way to evaluate what is currently happening (the whole) assembly.
So, I would like to do one of the following:
- combine files
build.ninja
into one large file that can do both builds in one callninja
. - run
ninja
with multiple target scriptsbuild.ninja
.
The second parameter doesn't seem to be supported ninja
, but the first seems like it can be done easily enough using subninja <build-dir-n>/build.ninja
. Has anyone done something like this before? Are there hidden pitfalls? Alternatively, I could just do the builds in sequence (i.e. the above sequence, but without &
s), but that doesn't seem like the right solution.
Register usage
I am using CMake
which generates a separate file build.ninja
for each build configuration (release and debug). I am targeting multiple platforms as well, so I have multiple compilers and CMake has to run separately for each platform. So if I want to build release and debug code for all platforms, I need to run ninja
multiple times.
source to share
No one has answered this question yet
Check out similar questions: