diff options
author | GoaLitiuM <goalitium@kapsi.fi> | 2018-08-18 12:51:26 +0300 |
---|---|---|
committer | GoaLitiuM <goalitium@kapsi.fi> | 2018-08-20 22:27:31 +0300 |
commit | 79f05b189a95e61cb6954765bc54cfcf05f1f3b1 (patch) | |
tree | 8068af8ef34d4c70f469933e8aae181a1b00e5c3 /mesonbuild/environment.py | |
parent | 6e00ab6236e9d65376ac8c603e1321a6a0af6b57 (diff) | |
download | meson-79f05b189a95e61cb6954765bc54cfcf05f1f3b1.zip meson-79f05b189a95e61cb6954765bc54cfcf05f1f3b1.tar.gz meson-79f05b189a95e61cb6954765bc54cfcf05f1f3b1.tar.bz2 |
Follow target platform defined in MSVC environment for Windows D compilation
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): |