diff options
author | GoaLitiuM <goalitium@kapsi.fi> | 2019-10-21 16:22:39 +0300 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2019-11-07 17:31:57 +0530 |
commit | b10e3f8b1f596c10c98833efcc4c214fc22092d4 (patch) | |
tree | 97e5897d9068db6ddc9ed781fca474b4aa33de2f | |
parent | d0ca05498fcceff45a4800f86c89ceca6d805a51 (diff) | |
download | meson-b10e3f8b1f596c10c98833efcc4c214fc22092d4.zip meson-b10e3f8b1f596c10c98833efcc4c214fc22092d4.tar.gz meson-b10e3f8b1f596c10c98833efcc4c214fc22092d4.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.
-rw-r--r-- | mesonbuild/environment.py | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index 0033d0b..4ee18d2 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -1324,12 +1324,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( @@ -1344,7 +1347,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( |