aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/environment.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2018-09-16 14:40:55 +0300
committerGitHub <noreply@github.com>2018-09-16 14:40:55 +0300
commitb9f229a4940999fd2976e64aa8a51358cce52fdb (patch)
tree4a60e54787f0920c772b9e7fc144847b559f2ac1 /mesonbuild/environment.py
parent0e89b03be63c8b0a4ffb530cc20dc29aa01844db (diff)
parent5b0ad0f8adfa9c64def004bc96e931f1df803bc2 (diff)
downloadmeson-b9f229a4940999fd2976e64aa8a51358cce52fdb.zip
meson-b9f229a4940999fd2976e64aa8a51358cce52fdb.tar.gz
meson-b9f229a4940999fd2976e64aa8a51358cce52fdb.tar.bz2
Merge pull request #4175 from GoaLitiuM/d-archfixes
D: Improve target architecture handling
Diffstat (limited to 'mesonbuild/environment.py')
-rw-r--r--mesonbuild/environment.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
index 35e934a..81ba54c 100644
--- a/mesonbuild/environment.py
+++ b/mesonbuild/environment.py
@@ -829,22 +829,22 @@ This is probably wrong, it should always point to the native compiler.''' % evar
version = search_version(out)
full_version = out.split('\n', 1)[0]
- # Detect which MSVC build environment is currently active.
- is_64 = False
+ # Detect the target architecture, required for proper architecture handling on Windows.
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)}
+ is_msvc = mesonlib.is_windows() and 'VCINSTALLDIR' in os.environ
+ if is_msvc:
+ c_compiler = {'c': self.detect_c_compiler(want_cross)} # MSVC compiler is required for correct platform detection.
- if detect_cpu_family(c_compiler) == 'x86_64':
- is_64 = True
+ arch = detect_cpu_family(c_compiler)
+ if is_msvc and arch == 'x86':
+ arch = 'x86_mscoff'
if 'LLVM D compiler' in out:
- return compilers.LLVMDCompiler(exelist, version, is_cross, is_64, full_version=full_version)
+ return compilers.LLVMDCompiler(exelist, version, is_cross, arch, full_version=full_version)
elif 'gdc' in out:
- return compilers.GnuDCompiler(exelist, version, is_cross, is_64, full_version=full_version)
+ return compilers.GnuDCompiler(exelist, version, is_cross, arch, full_version=full_version)
elif 'The D Language Foundation' in out or 'Digital Mars' in out:
- return compilers.DmdDCompiler(exelist, version, is_cross, is_64, full_version=full_version)
+ return compilers.DmdDCompiler(exelist, version, is_cross, arch, full_version=full_version)
raise EnvironmentException('Unknown compiler "' + ' '.join(exelist) + '"')
def detect_swift_compiler(self):