Skip to content

Commit

Permalink
Fix detection of D linker in MSVC environments
Browse files Browse the repository at this point in the history
Rather than trying to figure out if we're using MSVC based on
environment variables, then trying to get the C compiler and test some
attributes, get the C compiler and see if it's MSVC. This is much more
reliable and we were already doing it anyway.
  • Loading branch information
dcbaker committed Nov 26, 2019
1 parent 294b331 commit f71e7d3
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions mesonbuild/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -1339,10 +1339,11 @@ def detect_d_compiler(self, for_machine: MachineChoice):
info = self.machines[for_machine]

# Detect the target architecture, required for proper architecture handling on Windows.
c_compiler = {}
is_msvc = mesonlib.is_windows() and 'VCINSTALLDIR' in os.environ
if is_msvc:
c_compiler = {'c': self.detect_c_compiler(for_machine)} # MSVC compiler is required for correct platform detection.
# MSVC compiler is required for correct platform detection.
c_compiler = {'c': self.detect_c_compiler(for_machine)}
is_msvc = isinstance(c_compiler['c'], VisualStudioCCompiler)
if not is_msvc:
c_compiler = {}

arch = detect_cpu_family(c_compiler)
if is_msvc and arch == 'x86':
Expand Down

0 comments on commit f71e7d3

Please sign in to comment.