digitalmars.D.learn - Specify dmd or ldc compiler and version in a json dub file?
- data pulverizer (4/4) Aug 08 2017 Hi,
- Moritz Maxeiner (4/8) Aug 08 2017 You can't [1]. You can specify the compiler to use only on the
- data pulverizer (3/14) Aug 08 2017 How do you distribute packages with specific compiler
- Moritz Maxeiner (23/40) Aug 08 2017 If your code depends on capabilities of a specific D compiler, I
- data pulverizer (2/25) Aug 08 2017 Many thanks!
- Joakim (15/45) Aug 08 2017 I'll note that you can specify that dub use a particular D
- Bastiaan Veelo (8/10) Jan 20 2020 Update: you can at least specify these in the toolchain
- Andre Pany (7/18) Jan 20 2020 In the meantime, the dub settings json could also be placed in
Hi, I would like to know how to specify dmd or ldc compiler and version in a json dub file. Thanks in advance.
Aug 08 2017
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
Aug 08 2017
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:How do you distribute packages with specific compiler dependencies? I guess I could write it in the readme.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
Aug 08 2017
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: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-versionsOn Tuesday, 8 August 2017 at 09:17:02 UTC, data pulverizer wrote:How do you distribute packages with specific compiler dependencies? I guess I could write it in the readme.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
Aug 08 2017
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-versionsMany thanks!
Aug 08 2017
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: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.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-versionsMany thanks!
Aug 08 2017
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.
Jan 20 2020
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: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 AndreI 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.
Jan 20 2020