Skip to content
Martin Nowak edited this page Feb 18, 2015 · 20 revisions

Various Dub Recipes

###Creating windows package that has 32 and 64-bit dlls

  1. Create lib and lib64 folders in your project root (the same folder as dub.json)

  2. Put your 32-bit dll files in a lib folder and 64-bit dlls in lib64
    Dub offers copyFiles build setting that we will use to get things done. This option allows to copy files to the applications directory. Also this option can have platform specific suffixes, which we will use to copy specific files to each platform.

  3. Put these lines in your dub.json. They will copy every .dll file found in lib folder into application folder.

"copyFiles-windows-x86" : ["lib/*.dll"],
"copyFiles-windows-x86_64" : ["lib64/*.dll"],
  • Final folder structure:

    project
        dub.json
        /lib
              freetype.dll, etc.
        /lib64
              freetype.dll, etc. 64-bit version
    

###Working with submodules or packages that are not in the registry

It is a common practice to either have a project as a git submodule of a master project, or to use an unregistered project as a dependency for development.
In this setup, setting the project to depend on a project at a given path, rather than looking up the repository, can come handy.
Here's an example of such a package:

{ "name": "dlang-org", "dependencies": [ "libddoc": { "path": "./libddoc" }, "libdparse": { "path": "./libdparse" } ] }