Compilation is taking a ton of memory
Eugene Wissner
belka at caraus.de
Thu Jun 28 18:13:45 UTC 2018
On Thursday, 28 June 2018 at 16:24:07 UTC, H. S. Teoh wrote:
> On Thu, Jun 28, 2018 at 04:11:57PM +0000, crimaniak via
> Digitalmars-d wrote: [...]
>> The problem is aggravated by the fact that DUB compiles all
>> the sources in one DMD launch.
>
> Doesn't dub have an option to compile packages (i.e. subdirs)
> separately? Or does that only apply to dub packages, not to
> subdirs within a single project?
As far as I can see dub builds static libraries from dub
dependencies. But it passes all source files from one dub project
together to build final static library/executable. You can
actually use --verbose to see what commands a called.
>
>
>> I tried to solve this problem some time ago, and Sönke advised
>> using reggae (https://code.dlang.org/packages/reggae). I'm
>> still experimenting with different approaches and even wrote
>> my own utility helper
>> (https://code.dlang.org/packages/ifupdated).
> [...]
>
> This is one of the reasons I was not impressed by dub (sorry,
> Sonke). I continue to use SCons for my D projects. For dub
> dependencies, I just create a fake empty dub project with
> declared dependencies and run that separately for refreshing
> dependencies, but the actual compiling and linking is handled
> by SCons. Once a project gets beyond a certain size, you
> *need* more fine-grained control over exactly how the project
> should be built.
>
>
> T
Some more alternatives:
I have good experiance with "rake"-family of build systems. I've
seen ruby rake [1] itself being used for D projects.
For a smaller project of me I'm using shake [2]. You write your
build scripts in Haskell and since Haskell is a compiled
language, the build system should be compiled first, but it is
worth it, since shake is mature and very fast (I'm pretty sure it
is faster than python, ruby or js build systems and probably make
too). You can use it to run tests as well. I compile every source
file to an object file, put object files from dependencies to its
own static libraries and link everything together at the end. But
I should also admit, I'm not using dmd at all, but build
everything with gdc/gcc. The only problem is handling
dependencies and dependencies of dependencies if you have a lot
of them.
[1] https://ruby.github.io/rake/
[2] https://shakebuild.com/
More information about the Digitalmars-d
mailing list