Dub and compilation

Mike Parker via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Apr 10 23:45:11 PDT 2017


On Tuesday, 11 April 2017 at 05:15:37 UTC, Russel Winder wrote:
> As I understand it, Dub compiles a downloaded dependency into 
> the local Dub cache. This means you cannot store a debug build 
> and a release build for multiple architectures and different 
> compilers, at the same time, and you only get a .a file, no .so 
> file.
>

DUB downloads the source of dependencies from github and stores 
it all in the system cache. Each package has its own versioned 
folder in the cache and, when compiled, is given a .dub 
subdirectory in the package root. Beneath that is a 'build' 
directory, with more subdirectories containing the compiled 
binaries, each directory named according to the build 
configuration.

For example, in my system DUB cache I can find the following tree 
for my most recent version of DerelictUtil:

- derelict-util-3.0.0-alpha.2
-- derelict-util
--- .dub
---- build
----- 
library-debug-windows-x86_64-dmd_2073-1A55853403BAAAABC81F905E0C646FAE
----- 
library-debug-windows-x86_64-dmd_2073-95AB5FFC7D0B24B49867C17EFB3ABAE2
----- 
library-debug-windows-x86-dmd_2073-28A666061AF3118C33673AAFB9F3BFDE

You'd have to ask Sönke or someone familiar with the internals 
what the hash represents, but I suspect it has to do with the 
project for which the package was compiled.

Each of the output directories has a copy of DerelictUtil.lib. It 
could just as easily be a shared library if the dependency allows 
that as a configuration.



More information about the Digitalmars-d-learn mailing list