How to target ldc compiler only in dub

Mathias LANG geod24 at gmail.com
Wed May 27 02:31:51 UTC 2020


On Tuesday, 26 May 2020 at 22:28:14 UTC, data pulverizer wrote:
> Hi,
>
> I am trying to build a package to target LDC compiler only. I 
> have both dmd and ldc2 (1.18.0) installed on my system. The dub 
> file is:
>
> ```
> {
> 	"authors": [
> 		"Me"
> 	],
> 	"copyright": "Copyright © 2020, Me",
> 	"dependencies": {
> 		"mir-algorithm": "~>3.8.12",
> 		"mir-random": "~>2.2.14"
> 	},
> 	"description": "Some Cool Stuff",
> 	"license": "MIT",
> 	"name": "myPackage",
> 	"dflags": [
> 		"-O", "--release", "--boundscheck=off",
> 		"--ffast-math", "-mcpu=native"],
> 	"toolchainRequirements": {
> 		"dmd": "no",
> 		"gdc": "no",
> 		"ldc": ">=1.18.0"
> 	},
> 	"targetType": "executable"
> }
> ```
>
> I get the message:
>
> ```
> Installed dmd 2.090.1 is not supported by myPackage. Supported 
> compiler(s):
>   - ldc: >=1.18.0
> ```
>
> Thanks

Add a `dub.settings.json` with:
```
{
     "defaultCompiler": "ldc2"
}
```

Like we did: 
https://github.com/bpfkorea/agora/blob/38b2c33cc56acdeeabce8158bf3231a1f51eb5b1/dub.settings.json


More information about the Digitalmars-d-learn mailing list