Install multiple executables with DUB
d.forum at webfreak.org
Fri Sep 4 08:18:44 UTC 2020
On Thursday, 3 September 2020 at 08:22:25 UTC, glis-glis wrote:
> I have a few modules for parsing different file formats and a
> folder with d-scripts using these parsers to perform
> manipulations, extract information, ...
> Until now, I just added
> #!/usr/bin/env rdmd
> to the d-scripts and run them that way, but I'd like to make
> the scripts available to my collaborators without them being
> required to install dmd & co, so I'll have to compile the
> I usually would just write a makefile for that, but I thought
> I'd give DUB a go. Unfortunately, the DUB-documentation is a
> little thin and I cannot find a way to tell DUB
> "compile all the files in the scripts folder and put the binary
> to the bin folder". How do I do that?
Option 1: (recommended for multiple single file binaries)
use preBuildCommands to invoke dub or dmd for each of your
scripts you need
Compatibility tip: use the special $DUB and $DC variables, see
If built often, consider using rdmd for easy caching or make this
a sub-package which you depend on which will therefore only be
rebuilt in case of changes to that sub-path folder. Add a glob of
"extraDependencyFiles" matching your script files to make the
package rebuild on script changes.
Option 2: (recommended for multiple larger binaries)
use sub-packages and make your root package targetType: none to
build all child packages, see
dependency ":a" version="*"
dependency ":b" version="*"
$ dub build
Note: this only works if your package is targetType none, use
targetName and targetPath to customize how the exe is called and
where it's placed
More information about the Digitalmars-d-learn