diff options
Diffstat (limited to 'mesonbuild/environment.py')
-rw-r--r-- | mesonbuild/environment.py | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index c64fe59..346f5f4 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -833,12 +833,23 @@ This is probably wrong, it should always point to the native compiler.''' % evar raise EnvironmentException('Could not execute D compiler "%s"' % ' '.join(exelist)) version = search_version(out) full_version = out.split('\n', 1)[0] + + # Detect which MSVC build environment is currently active. + is_64 = False + c_compiler = {} + if mesonlib.is_windows() and 'VCINSTALLDIR' in os.environ: + # MSVC compiler is required for correct platform detection. + c_compiler = {'c': self.detect_c_compiler(want_cross)} + + if detect_cpu_family(c_compiler) == 'x86_64': + is_64 = True + if 'LLVM D compiler' in out: - return compilers.LLVMDCompiler(exelist, version, is_cross, full_version=full_version) + return compilers.LLVMDCompiler(exelist, version, is_cross, is_64, full_version=full_version) elif 'gdc' in out: - return compilers.GnuDCompiler(exelist, version, is_cross, full_version=full_version) + return compilers.GnuDCompiler(exelist, version, is_cross, is_64, full_version=full_version) elif 'The D Language Foundation' in out or 'Digital Mars' in out: - return compilers.DmdDCompiler(exelist, version, is_cross, full_version=full_version) + return compilers.DmdDCompiler(exelist, version, is_cross, is_64, full_version=full_version) raise EnvironmentException('Unknown compiler "' + ' '.join(exelist) + '"') def detect_swift_compiler(self): |