holepunchto / bare-dev

Development tooling for Bare
Apache License 2.0
8 stars 2 forks source link

Add `parallel` option for cmake #14

Closed chm-diederichs closed 2 months ago

kasperisager commented 2 months ago

Perfect, that works as well!

chm-diederichs commented 2 months ago

As it currently stands, this will make all builds sequential by default as --parallel 1 is passed to CMake unless something else is specified. Let's use the number of available cores as the default instead; might as well put them to use!

I think by default cmake builds sequentially, maybe it is better to use os.availableParallelism() then, what do you think?

I'm just worried it may be a little aggressive to allocate all cores by default.. So maybe Math.max(1, os.availableParallelism() >> 1)?

mafintosh commented 2 months ago

i think the normal saturation default is cores + 1 from back in my day

kasperisager commented 2 months ago

The default depends on the build system used. Ninja, for example, will be as parallel as possible unless otherwise specified, whereas MSBuild will be strictly sequential.

chm-diederichs commented 2 months ago

Ok, in which case seems appropriate to defer to the build system default