Good build system?
d.forum at webfreak.org
Sat Aug 15 16:15:08 UTC 2020
On Saturday, 15 August 2020 at 14:22:44 UTC, burt wrote:
> I have a project that is taking very long to compile (I'm on
> It consists of a bunch of precompiled library (.lib) files and
> some .d source files inside of my "source" directory. Currently
> I am using DUB and the .lib files are added to "sourceFiles" in
> dub.json, which works, but if I edit a single letter it will
> recompile everything.
> One alternative would be to split up my package into
> "subPackages" to avoid recompiling everything, but that would
> mean splitting up my current directory structure into a
> structure that is harder to navigate.
> Another alternative I tried is Reggae, but it doesn't work on
> 1. When calling .reggae/dcompile, it fails, because the Windows
> shell (intuitively as always) splits of the ".reggae" from
> "/dcompile" and treats them as separate arguments (managed to
> fix this by editing the Reggae source slightly, in
> payload\reggae\build.d : expandCmd).
> 2. Either it takes FOREVER to compile and link the thing, or it
> gets stuck in some kind of infinite loop.
> Anyway, it doesn't work.
> What kind of build system could I use to speed up compilation
> when editing very little, or could I configure DUB so it
> recompiles per file instead of per package?
> Thank you.
to speed up dub I recommend
1) split up your code base into multiple subpackages (isolated
packages of code as seen in vibe.d)
2a) try using --build-mode=allAtOnce which will compile the
entire project in one go (note that this will increase memory
2b) try using --build-mode=singleFile which will compile each
file separately and link them all together (note that this
eliminates any possible caching by the compiler, but reduces
memory usage which could also be a bottle neck)
Of these steps 1) will definitely help while developing as it
will not recompile the packages which didn't change. 2a) or 2b)
can be useful if you are on a very beefy machine or have memory
constraints on a low level machine
More information about the Digitalmars-d