I'm on Mac OS X and use the following bash script to run doxygen on around 10 source code libraries.
Problem is, doxygen runs the most time-consuming task "dot" (creates class diagrams) on separate threads by itself. This causes the wait command to not wait for the dot threads to finish. It effectively returns me to the command prompt right away (creating just the docs with doxygen is fast) while dot is still generating class diagrams in the background for another minute or so.
#!/bin/bash
DOXY="/Applications/Doxygen.app/Contents/Resources/doxygen"
#run doxygen on all configs
for config in doxygen*.config
do
$DOXY $config &
done
wait
I have tried enforcing dot to run on a single thread (DOT_NUM_THREADS=1) but that didn't help. I tried putting the wait command in the loop, but that only has doxygen take as long as it does without parallelizing, and still not wait for dot to finish.
I need to wait for the dot command to generate all class diagrams, or else I will be packaging/uploading incomplete docs in the next step.
How can I parallelize doxygen and have it wait for all threaded dot commands to finish?
Alternatively, is there a way for me to determine in the bash script if all dot commands have ended (I do not know what processes/threads doxygen actually spawns nor how to wait for them)?
UPDATE: I tried using xargs which properly waits for all dot threads to finish, but isn't any faster:
find . -name "doxygen*.config" | xargs -n 1 -P 8 doxygen
Problem here is I can't set 'n' (number) higher than 1 because then doxygen won't create all the docsets because it ignores the additional arguments.