Is there a field for specifying the compiler to use in dub.json? I'd basically like to have separate configurations for compiling with dmd and gdc (because one is 64bit and the other 32) and I was wondering if this option is available. For now I'll just batch file it, but I was curious as I can't find anything.
On Tue, 22 Jul 2014 19:40:40 GMT, Roderick Gibson wrote:
Is there a field for specifying the compiler to use in dub.json? I'd basically like to have separate configurations for compiling with dmd and gdc (because one is 64bit and the other 32) and I was wondering if this option is available. For now I'll just batch file it, but I was curious as I can't find anything.
This is something that is only controllable from the outside. So having a batch file that runs something like dub build --arch=x86_64 --compiler=GDC
would be about the only solution so far.
If this turns out to be a more frequent need, we could think about adding a new feature for that - either something in dub.json
, or maybe in a separate dub-build-list.json
(or similar) file.
On Wed, 23 Jul 2014 09:53:09 GMT, Sönke Ludwig wrote:
On Tue, 22 Jul 2014 19:40:40 GMT, Roderick Gibson wrote:
Is there a field for specifying the compiler to use in dub.json? I'd basically like to have separate configurations for compiling with dmd and gdc (because one is 64bit and the other 32) and I was wondering if this option is available. For now I'll just batch file it, but I was curious as I can't find anything.
This is something that is only controllable from the outside. So having a batch file that runs something like
dub build --arch=x86_64 --compiler=GDC
would be about the only solution so far.If this turns out to be a more frequent need, we could think about adding a new feature for that - either something in
dub.json
, or maybe in a separatedub-build-list.json
(or similar) file.
Makes sense, I figured it was kind of an uncommon use case. Thanks!
On Wed, 23 Jul 2014 20:32:33 GMT, Roderick Gibson wrote:
Makes sense, I figured it was kind of an uncommon use case. Thanks!
I can imagine some use cases:
- Since DMD, GDC and LDC don't exactly have the same command line interface you might want to use a flag that doesn't exist on any of the other compilers.
In theory this could already be supported since Dub allows you to suffix any/most configuration options with a version identifier. Both GDC and LDC provides version identifiers to detect if they're used. But I don't know how Dub detects which version identifiers should apply
- Since D is changing and breaking code so frequently it might be good to be able to lock down a package for a given version of D/the compiler
/Jacob Carlborg
On Wed, 23 Jul 2014 09:53:09 GMT, Sönke Ludwig wrote:
...
Is there a field for specifying the compiler to use in dub.json? I'd basically like to have separate configurations for compiling with dmd and gdc (because one is 64bit and the other 32) and I was wondering if this option is available. For now I'll just batch file it, but I was curious as I can't find anything.
This is something that is only controllable from the outside. So having a batch file that runs something like
dub build --arch=x86_64 --compiler=GDC
would be about the only solution so far.If this turns out to be a more frequent need, we could think about adding a new feature for that - either something in
dub.json
, or maybe in a separatedub-build-list.json
(or similar) file.
Hi Sonke,
I'm finding using gdc useful to avoid bugs in the dmd compiler, why do you have compiler agnostic config options but no way to define a specific compiler?
Would be great to have different configs set up for each compiler in my dub.json file.
Does this exist now?
Cheers,
Rory
Am 15.06.2015 um 09:01 schrieb Rory:
On Wed, 23 Jul 2014 09:53:09 GMT, Sönke Ludwig wrote:
...Is there a field for specifying the compiler to use in dub.json? I'd basically like to have separate configurations for compiling with dmd and gdc (because one is 64bit and the other 32) and I was wondering if this option is available. For now I'll just batch file it, but I was curious as I can't find anything.
This is something that is only controllable from the outside. So having a batch file that runs something like
dub build --arch=x86_64 --compiler=GDC
would be about the only solution so far.If this turns out to be a more frequent need, we could think about adding a new feature for that - either something in
dub.json
, or maybe in a separatedub-build-list.json
(or similar) file.Hi Sonke,
I'm finding using gdc useful to avoid bugs in the dmd compiler, why do you have compiler agnostic config options but no way to define a specific compiler?
Would be great to have different configs set up for each compiler in my dub.json file.
Does this exist now?
Cheers,
Rory
You can use the "platforms" field in a configuration section to create
configurations for specific compilers:
{
"name": "my-package",
"configurations": [
{
"name": "gdc-stuff",
"platforms": ["gdc"]
}
]
}
However, usually you'd just use platform suffixes for compiler specific
settings (e.g. "buildOptions-gdc": [...]
), as it keeps things closer
together and produces less redundant package descriptions.
The thing with both of these approaches is that the user will still have
to select the compiler used. So even if there is only a single
configuration for "gdc", DUB will try the default compiler and just
errors out if that doesn't happen to be GDC.
The design goal has always been to try to make packages automatically
cross-platform and cross-compiler compatible if possible, so
artificially forcing a package to a particular compiler would probably
go a little too far. But I see at least two possible approaches that
would still make sense to implement:
- Having a "preferredCompilers" field in the build description, which
contains a priority ordered list of compiler binary names - Letting the list of installed compilers participate in the
configuration resolution process, thus automatically choosing a matching
compiler instead of the default one if the choices are limited.