Specify LDC to compile specific files
Rainer Schuetze
r.sagitario at gmx.de
Sun Mar 3 21:48:09 UTC 2019
On 03/03/2019 17:44, Michelle Long wrote:
> On Saturday, 2 March 2019 at 17:03:20 UTC, Jacob Carlborg wrote:
>> On 2019-03-02 05:49, Michelle Long wrote:
>>> The problem with LDC is that it is very slow to compile. About 10x
>>> slower than dmd. Unfortunately certain things need ldc to function
>>> such as dcompute.
>>>
>>> It would be nice if one could specify certain files to compile for
>>> ldc only.
>>>
>>>
>>> I guess the only way to accomplish this is to create a new project in
>>> the solution and use LDC for that?
>>
>> Perhaps this is a question specific for Visual Studio and I'm not sure
>> exactly what you're looking for. But generally speaking you could add
>> `version (LDC):` at the top of a file and it would only be compiled if
>> LDC is the compiler.
>>
>
> But one can only select one compiler using the build configuration. So
> in Visual D one has to use one compiler per project(one can switch at a
> click but that is it).
>
> So version is useless to be able to do both.
>
> Visual D could have a combo but it would then require versioning all the
> files.
>
>
> If they are not ABI it might be a real problem getting it to work ;/
>
>
>> If you're using Dub you can do something like:
>>
>> "sourceFiles-ldc": ["some_file.d"]
>
>
> And doing so will use dmd for all the others, compile some_file.d using
> ldc and then work all the details out?
>
> This is essentially what I'm asking for in Visual D so to speak. To mark
> a file to use LDC and it will effectively do what dub is doing(if it is
> doing it as I stated).
>
Reading the documentation at
https://dub.pm/package-format-json.html#build-settings I assume it adds
source files specific to the compiler selection, but won't mix different
compilers.
Maybe a mixture works if you only declare extern(C) functions and use
-betterC, but that doesn't seem like a common use case.
With a bit of manual configuration, you could try to build the specific
files with the "custom" build tool, but you'll have to setup the full
command line and dependencies yourself.
More information about the Digitalmars-d-ide
mailing list