DUB doesn't seem to respect my config, am I doing something wrong?

Jordan Wilson wilsonjord at gmail.com
Sun May 23 00:36:48 UTC 2021


On Saturday, 22 May 2021 at 20:28:56 UTC, rempas wrote:
> I've read the documentation about DUB's config (I'm using the 
> SDL format) and it seems that DUB completely ignores my config. 
> My config file is:
>
> ```
> name "test"
> description "Testing dub"
> authors "rempas"
> copyright "Copyright © 2021, rempas"
> license "AGPL-3.0"
> compiler "ldc2"
>
> configuration "development" {
>   platforms "linux"
>   build "dubug"
>   compiler "ldc2"
>   targetType "executable"
> }
>
> configuration "release" {
>   platforms "linux"
>   dflags "-Oz" platform="/bin/ldc2"
>   build "release"
>   compiler "ldc2"
>   targetType "executable"
> }
> ```
>
> I'm compiling using `dub --config=development` and I'm getting 
> the following line: `Performing "debug" build using 
> /usr/bin/dmd for x86_64`. The same exactly happens when I'm 
> trying to do the release config. If I disable the `targetType` 
> option, it seems that it's creating a library and I can also 
> manually change the compiler and the build-type so I don't know 
> what's going on....

Ignoring the "dubug" typo...normally, I think you pass compiler 
values directly to dub via the ```--compiler``` flag. For example:
```shell
dub --config=development --compiler=ldc2
```

Note: you can also pass "debug" and "release" builds (among 
others), like so:
```shell
dub -b "debug" --compiler=ldc2
```

Passing in the compiler allows any end user building your code to 
use whatever compiler they want. Otherwise, something like 
```toolchainRequirements dmd="no" ldc=">=1.21.0"``` may achieve 
what you want.

Thanks,

Jordan


More information about the Digitalmars-d-learn mailing list