Specifying executable names in DUB
Andre Pany
andre at s-e-a-p.de
Tue Jun 18 05:33:26 UTC 2019
On Tuesday, 18 June 2019 at 02:13:46 UTC, Dave wrote:
> Greetings,
>
> This might be totally obvious, but I can't seem to figure out
> how to specify an executable's name&path to be different for
> each build types in my DUB package. For example, if my project
> is named "dlang_test", I might want something like so:
>
> dub build --build=debug
>
> yields either
>
> bin/dlang_test-debug.exe
>
> or possibly
>
> bin/debug/dlang_test.exe
>
> if I did
>
> dub build --build=release
>
> I might get either
>
> bin/dlang_test-release.exe
>
> or
>
> bin/release/dlang_test.exe
>
> When I read the section on build types
> (https://dub.pm/package-format-json.html#build-types), it
> specifically mentions that a "buildTypes" entry can override
> the build settings, but *not* "targetName" and "targetPath",
> which is what I think I want here.
>
> Is there any reason why this is disallowed? Or is there a more
> canonical way of achieving this with DUB? What I described
> above is often found in other build tools, such as CMake and
> Visual Studio, which makes me think I'm missing something
> obvious here.
>
> Thanks!
You can specify the names by adding a configuration "debug" and a
configuration "unittest". While dub is using the first
configuration in the list as default configuration for command
"dub build" it will use configuration "unittest" for command "dub
test".
Kind regards
Andre
More information about the Digitalmars-d-learn
mailing list