digitalmars.D.learn - Specifying executable names in DUB
- Dave (26/26) Jun 17 2019 Greetings,
- Jonathan M Davis (10/35) Jun 17 2019 As I understand it, dub does not provide the ability to alter the target
- Andre Pany (8/35) Jun 17 2019 You can specify the names by adding a configuration "debug" and a
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!
Jun 17 2019
On Monday, June 17, 2019 8:13:46 PM MDT Dave via Digitalmars-d-learn 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.As I understand it, dub does not provide the ability to alter the target name per build type. I don't know why, though if I had to guess, I would say that it probably has to do with how it already renames the target based on what is being generated and what the platform is (e.g. adding lib to the front and either .a or .so to the end on *nix systems when a library is being generated). However, it's probably possible to use the postBuildCommands setting to run cp or mv or whatever to get the target name you want for that particular configuration. - Jonathan M Davis
Jun 17 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
Jun 17 2019