aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/environment.py
diff options
context:
space:
mode:
authorGoaLitiuM <goalitium@kapsi.fi>2019-10-21 16:22:39 +0300
committerGoaLitiuM <goalitium@kapsi.fi>2019-10-21 16:22:39 +0300
commit4f83c478801ec0cdcbe301a451056f780e2e5e76 (patch)
tree0c1fe1b36a65422df35a7b9359be93180be51335 /mesonbuild/environment.py
parent212a05b87ed34f921dfd07142305389dbfa9bb7d (diff)
downloadmeson-4f83c478801ec0cdcbe301a451056f780e2e5e76.zip
meson-4f83c478801ec0cdcbe301a451056f780e2e5e76.tar.gz
meson-4f83c478801ec0cdcbe301a451056f780e2e5e76.tar.bz2
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.
Diffstat (limited to 'mesonbuild/environment.py')
-rw-r--r--mesonbuild/environment.py24
1 files changed, 17 insertions, 7 deletions
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
index c75077a..99428c7 100644
--- a/mesonbuild/environment.py
+++ b/mesonbuild/environment.py
@@ -1369,12 +1369,15 @@ class Environment:
# LDC seems to require a file
m = self.machines[for_machine]
if m.is_windows() or m.is_cygwin():
- # Getting LDC on windows to give useful linker output when not
- # doing real work is painfully hard. It ships with a verison of
- # 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))
+ if is_msvc:
+ linker = MSVCDynamicLinker(for_machine, version=version)
+ else:
+ # Getting LDC on windows to give useful linker output when not
+ # doing real work is painfully hard. It ships with a verison of
+ # 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:
with tempfile.NamedTemporaryFile(suffix='.d') as f:
linker = self._guess_nix_linker(
@@ -1393,7 +1396,14 @@ class Environment:
# DMD seems to require a file
m = self.machines[for_machine]
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:
with tempfile.NamedTemporaryFile(suffix='.d') as f:
linker = self._guess_nix_linker(