Specify dmd or ldc compiler and version in a json dub file?

2017-08-08 Thread data pulverizer via Digitalmars-d-learn

Hi,

I would like to know how to specify dmd or ldc compiler and 
version in a json dub file.


Thanks in advance.


Specify dmd or ldc compiler and version in a json dub file?

2020-09-17 Thread Imperatorn via Digitalmars-d-learn

https://forum.dlang.org/post/nnxbwdypwepymgerz...@forum.dlang.org

On Tuesday, 8 August 2017 at 09:17:02 UTC, data pulverizer wrote:

Hi,

I would like to know how to specify dmd or ldc compiler and 
version in a json dub file.


Thanks in advance.


https://dub.pm/settings.html


Re: Specify dmd or ldc compiler and version in a json dub file?

2017-08-08 Thread Moritz Maxeiner via Digitalmars-d-learn

On Tuesday, 8 August 2017 at 09:17:02 UTC, data pulverizer wrote:

Hi,

I would like to know how to specify dmd or ldc compiler and 
version in a json dub file.


Thanks in advance.


You can't [1]. You can specify the compiler to use only on the 
dub command line via `--compiler=`.


[1] https://code.dlang.org/package-format?lang=json


Re: Specify dmd or ldc compiler and version in a json dub file?

2017-08-08 Thread data pulverizer via Digitalmars-d-learn

On Tuesday, 8 August 2017 at 09:21:54 UTC, Moritz Maxeiner wrote:
On Tuesday, 8 August 2017 at 09:17:02 UTC, data pulverizer 
wrote:

Hi,

I would like to know how to specify dmd or ldc compiler and 
version in a json dub file.


Thanks in advance.


You can't [1]. You can specify the compiler to use only on the 
dub command line via `--compiler=`.


[1] https://code.dlang.org/package-format?lang=json


How do you distribute packages with specific compiler 
dependencies? I guess I could write it in the readme.


Re: Specify dmd or ldc compiler and version in a json dub file?

2017-08-08 Thread Moritz Maxeiner via Digitalmars-d-learn

On Tuesday, 8 August 2017 at 09:31:49 UTC, data pulverizer wrote:
On Tuesday, 8 August 2017 at 09:21:54 UTC, Moritz Maxeiner 
wrote:
On Tuesday, 8 August 2017 at 09:17:02 UTC, data pulverizer 
wrote:

Hi,

I would like to know how to specify dmd or ldc compiler and 
version in a json dub file.


Thanks in advance.


You can't [1]. You can specify the compiler to use only on the 
dub command line via `--compiler=`.


[1] https://code.dlang.org/package-format?lang=json


How do you distribute packages with specific compiler 
dependencies? I guess I could write it in the readme.


If your code depends on capabilities of a specific D compiler, I 
wouldn't depend on build tools for that, I'd make it clear in the 
source code via conditional compilation [1]:


---
version (DigitalMars)
{
}
else version (LDC)
{
}
else
{
static assert (0, "Unsupported D compiler");
}
---

There's no equivalent for the frontend version, though AFAIK.

If it's not your code that needs something compiler specific, but 
you just want to control which is used, don't use dub as a build 
tool, use another (cmake, meson, write your own compilation 
"script" in D), and set it's invocation as a prebuildcommand in 
the dub package file (make sure dub's source file list is empty).


[1] http://dlang.org/spec/version.html#predefined-versions


Re: Specify dmd or ldc compiler and version in a json dub file?

2017-08-08 Thread data pulverizer via Digitalmars-d-learn

On Tuesday, 8 August 2017 at 09:51:40 UTC, Moritz Maxeiner wrote:
If your code depends on capabilities of a specific D compiler, 
I wouldn't depend on build tools for that, I'd make it clear in 
the source code via conditional compilation [1]:


---
version (DigitalMars)
{
}
else version (LDC)
{
}
else
{
static assert (0, "Unsupported D compiler");
}
---

There's no equivalent for the frontend version, though AFAIK.

If it's not your code that needs something compiler specific, 
but you just want to control which is used, don't use dub as a 
build tool, use another (cmake, meson, write your own 
compilation "script" in D), and set it's invocation as a 
prebuildcommand in the dub package file (make sure dub's source 
file list is empty).


[1] http://dlang.org/spec/version.html#predefined-versions


Many thanks!


Re: Specify dmd or ldc compiler and version in a json dub file?

2017-08-08 Thread Joakim via Digitalmars-d-learn

On Tuesday, 8 August 2017 at 10:07:54 UTC, data pulverizer wrote:
On Tuesday, 8 August 2017 at 09:51:40 UTC, Moritz Maxeiner 
wrote:
If your code depends on capabilities of a specific D compiler, 
I wouldn't depend on build tools for that, I'd make it clear 
in the source code via conditional compilation [1]:


---
version (DigitalMars)
{
}
else version (LDC)
{
}
else
{
static assert (0, "Unsupported D compiler");
}
---

There's no equivalent for the frontend version, though AFAIK.

If it's not your code that needs something compiler specific, 
but you just want to control which is used, don't use dub as a 
build tool, use another (cmake, meson, write your own 
compilation "script" in D), and set it's invocation as a 
prebuildcommand in the dub package file (make sure dub's 
source file list is empty).


[1] http://dlang.org/spec/version.html#predefined-versions


Many thanks!


I'll note that you can specify that dub use a particular D 
compiler for building all your own D packages, by creating a file 
called .dub/settings.json in your home directory, and putting the 
full path to the compiler you want in there, like so:


  {
"defaultCompiler": "/home/datapulverizer/ldc-1.3/bin/ldc2"
  }

Ldc uses a file like that to make sure the dub binary it comes 
with uses ldc, not dmd, so you can look at that file for an 
example.


However, it sounds like you want to ensure that all users of a 
package are forced to use a particular D compiler, while this 
will just make sure that your dub binary will always use the D 
compiler you want.


Re: Specify dmd or ldc compiler and version in a json dub file?

2020-01-20 Thread Bastiaan Veelo via Digitalmars-d-learn

On Tuesday, 8 August 2017 at 09:17:02 UTC, data pulverizer wrote:
I would like to know how to specify dmd or ldc compiler and 
version in a json dub file.


Update: you can at least specify these in the toolchain 
requirements section: 
https://dub.pm/package-format-json.html#toolchain-requirements


I myself am looking for ways to satisfy these automatically, 
using a tool like dvm (https://code.dlang.org/packages/dvm) in 
preBuildCommands.


Bastiaan.


Re: Specify dmd or ldc compiler and version in a json dub file?

2020-01-20 Thread Andre Pany via Digitalmars-d-learn

On Monday, 20 January 2020 at 11:54:43 UTC, Bastiaan Veelo wrote:
On Tuesday, 8 August 2017 at 09:17:02 UTC, data pulverizer 
wrote:
I would like to know how to specify dmd or ldc compiler and 
version in a json dub file.


Update: you can at least specify these in the toolchain 
requirements section: 
https://dub.pm/package-format-json.html#toolchain-requirements


I myself am looking for ways to satisfy these automatically, 
using a tool like dvm (https://code.dlang.org/packages/dvm) in 
preBuildCommands.


Bastiaan.


In the meantime, the dub settings json could also be placed in 
the project folder and has precedence. Although I would not 
recommend to distribute the file as it is meant for your local 
working computer.


Kind regards
Andre