Author Topic: 64-bit Windows build  (Read 7403 times)

0 Members and 1 Guest are viewing this topic.

Offline Forestidia86

  • Posts: 723
  • inactive
    • View Profile
Re: 64-bit Windows build
« Reply #15 on: April 14, 2024, 07:13:04 AM »
The win-build.bat specifies the compiler to ldc. The question is if this is necessary or should at least mentioned in the file name since somebody could just have dmd set up and get an error.

Offline Simon

  • Administrator
  • Posts: 3876
    • View Profile
    • Lix
Re: 64-bit Windows build
« Reply #16 on: April 16, 2024, 06:46:52 AM »
In the Windows 64-bit build instructions, we recommend to install LDC and then to double-click win-build.bat. This works well and I recommend this to everybody for release builds. LDC builds the fastest-running executables.

The win-build.bat specifies the compiler to ldc. The question is if this is necessary or should at least mentioned in the file name since somebody could just have dmd set up and get an error.

Now, if somebody installs only DMD and not LDC, he has diverged from the release notes early. I'll assume that he knows what he's doing. The build instructions even cover DMD and tell him to type the command manually. If he still double-clicks win-build.bat, he'll get the following error: Error Failed to spawn process "ldc2" (The system cannot find the given file.) Given that he see this only after he has willfully diverged from the build instructions and installed DMD instead of LDC, I'd say it's fine as it is. He can edit the script or type the build command manually.

I could also write win-build.bat to be compiler-agnostic, but then it'll pick DMD over LDC when both are installed. I encourage everybody to build release builds with LDC. DMD is better for active development, when you need the fastest-possible feedback and care less about producing fast-running binaries.

It should be possible to test in the script for installed compilers ahead of the dub call, e.g., with a Windows equivalent of Linux's which. Then you build with LDC explicitly only if LDC is found, otherwise you build in the compiler-agnostic way. If you want to investigate this, I'll be happy to merge it.



Readers may wonder: Why different compilers for different builds, aren't there build types? Yes, there are build types; you can instruct either compiler to build debug binaries or optimize for release. Still, you'll see the fastest build times with DMD without optimization, and you'll get the fastest-running binaries from LDC in release mode.

-- Simon
« Last Edit: April 16, 2024, 07:11:40 AM by Simon »