d: Prefer MSVC and LLVM linker over optlink when available

The optlink linker is slowly getting phased out now since DMD ships with the LLVM linker, so it can be used when Visual Studio is not installed.
pull/6090/head
GoaLitiuM 5 years ago
parent 212a05b87e
commit 4f83c47880
  1. 24
      mesonbuild/environment.py

@ -1369,12 +1369,15 @@ class Environment:
# LDC seems to require a file # LDC seems to require a file
m = self.machines[for_machine] m = self.machines[for_machine]
if m.is_windows() or m.is_cygwin(): if m.is_windows() or m.is_cygwin():
# Getting LDC on windows to give useful linker output when not if is_msvc:
# doing real work is painfully hard. It ships with a verison of linker = MSVCDynamicLinker(for_machine, version=version)
# lld-link, so just assume that we're going to use lld-link else:
# with it. # Getting LDC on windows to give useful linker output when not
_, o, _ = Popen_safe(['lld-link.exe', '--version']) # doing real work is painfully hard. It ships with a verison of
linker = ClangClDynamicLinker(for_machine, version=search_version(o)) # lld-link, so just assume that we're going to use lld-link
# with it.
_, o, _ = Popen_safe(['lld-link.exe', '--version'])
linker = ClangClDynamicLinker(for_machine, version=search_version(o))
else: else:
with tempfile.NamedTemporaryFile(suffix='.d') as f: with tempfile.NamedTemporaryFile(suffix='.d') as f:
linker = self._guess_nix_linker( linker = self._guess_nix_linker(
@ -1393,7 +1396,14 @@ class Environment:
# DMD seems to require a file # DMD seems to require a file
m = self.machines[for_machine] m = self.machines[for_machine]
if m.is_windows() or m.is_cygwin(): if m.is_windows() or m.is_cygwin():
linker = OptlinkDynamicLinker(for_machine, version=full_version) if is_msvc:
linker = MSVCDynamicLinker(for_machine, version=version)
elif arch == 'x86':
linker = OptlinkDynamicLinker(for_machine, version=full_version)
else:
# DMD ships with lld-link
_, o, _ = Popen_safe(['lld-link.exe', '--version'])
linker = ClangClDynamicLinker(for_machine, version=search_version(o))
else: else:
with tempfile.NamedTemporaryFile(suffix='.d') as f: with tempfile.NamedTemporaryFile(suffix='.d') as f:
linker = self._guess_nix_linker( linker = self._guess_nix_linker(

Loading…
Cancel
Save