I don’t see anywhere in the sources of gprbuild
where the number of jobs can be controlled except by -j
.
However, the documentation suggests that you gan get the effect you want using an “aggregate project”. I wrapped one of my project files in an aggregate like so:
aggregate project Gnat_Util_Aggregate is
for Project_Files use ("gnat_util.gpr");
package Builder is
for Switches (others) use ("-j0");
end Builder;
end Gnat_Util_Aggregate;
The times for the plain project build on this 13” Macbook Pro were
70.17 real 66.33 user 2.85 sys
and for the aggregate project build
35.46 real 119.05 user 4.80 sys
(I have no idea what the “user” values mean! but I checked the “real” values and they match my wristwatch.)
I’ve reported the error on the GPRBuild documentation link above (it says for Switches (other)
, should be others
) to AdaCore.
UPDATE: following David’s justified complaint, and on a hunch, I tried this package Builder
trick in my plain project and it worked. I still don’t see where this happens in the sources.
For info, the undocumented switch -dm
reports the maximum number of simultaneous compilations (in both gnatmake
and gprbuild
).