www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - How to target ldc compiler only in dub

reply data pulverizer <data.pulverizer gmail.com> writes:
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
May 26 2020
next sibling parent reply mw <mingwu gmail.com> writes:
On Tuesday, 26 May 2020 at 22:28:14 UTC, data pulverizer wrote:
 I am trying to build a package to target LDC compiler only. I
set env: LDC=<your ldc install root> DUB = $(LDC)/bin/dub then, run this new dub: $(DUB) build
May 26 2020
parent reply data pulverizer <data.pulverizer gmail.com> writes:
On Wednesday, 27 May 2020 at 00:52:55 UTC, mw wrote:
 On Tuesday, 26 May 2020 at 22:28:14 UTC, data pulverizer wrote:
 I am trying to build a package to target LDC compiler only. I
set env: LDC=<your ldc install root> DUB = $(LDC)/bin/dub then, run this new dub: $(DUB) build
Thanks. Building with `dub run --compiler=ldc2` works so I think I'll do that instead.
May 26 2020
parent reply mw <mingwu gmail.com> writes:
On Wednesday, 27 May 2020 at 00:54:45 UTC, data pulverizer wrote:
 On Wednesday, 27 May 2020 at 00:52:55 UTC, mw wrote:
 On Tuesday, 26 May 2020 at 22:28:14 UTC, data pulverizer wrote:
 I am trying to build a package to target LDC compiler only. I
set env: LDC=<your ldc install root> DUB = $(LDC)/bin/dub then, run this new dub: $(DUB) build
Thanks. Building with `dub run --compiler=ldc2` works so I think I'll do that instead.
And you can use option dub -v to verify it's calling the correct compiler cmd.
May 26 2020
parent reply data pulverizer <data.pulverizer gmail.com> writes:
On Wednesday, 27 May 2020 at 01:06:48 UTC, mw wrote:
 And you can use option

 dub -v

 to verify it's calling the correct compiler cmd.
Thanks. Is there anyway to verify that the flags I am passing to the compiler are being used?
May 26 2020
parent reply Mike Parker <aldacron gmail.com> writes:
On Wednesday, 27 May 2020 at 01:41:47 UTC, data pulverizer wrote:
 On Wednesday, 27 May 2020 at 01:06:48 UTC, mw wrote:
 And you can use option

 dub -v

 to verify it's calling the correct compiler cmd.
Thanks. Is there anyway to verify that the flags I am passing to the compiler are being used?
dub -v It shows you the full compiler command line.
May 26 2020
parent data pulverizer <data.pulverizer gmail.com> writes:
On Wednesday, 27 May 2020 at 02:09:48 UTC, Mike Parker wrote:
 Thanks. Is there anyway to verify that the flags I am passing 
 to the compiler are being used?
dub -v It shows you the full compiler command line.
Ah, I forgot to force the rebuild. Thanks.
May 26 2020
prev sibling parent Mathias LANG <geod24 gmail.com> writes:
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
May 26 2020