diff options
author | Chun-wei Fan <fanchunwei@src.gnome.org> | 2018-06-06 17:00:06 +0800 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek.chauhan@gmail.com> | 2018-06-06 18:37:29 +0000 |
commit | 3c4c8bf7754bace455d379e6e7492bb5f81212d8 (patch) | |
tree | 97fe297dbf03d7342b4fdb148d8a7e59b9cf1ce3 | |
parent | f9f3a51243ee6ef3ed7ee44574faa164f4cc9d13 (diff) | |
download | meson-3c4c8bf7754bace455d379e6e7492bb5f81212d8.zip meson-3c4c8bf7754bace455d379e6e7492bb5f81212d8.tar.gz meson-3c4c8bf7754bace455d379e6e7492bb5f81212d8.tar.bz2 |
environment.py: Properly check platform on MSVC 2008
The 'Platform' envvar may not be set on Visual Studio 2008, at least
when using the SDK 7.0 compilers, so check the 'BUILD_PLAT' envvar so
that we do not mis-detect x64 build environments as x86.
-rw-r--r-- | mesonbuild/environment.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index 6339570..2453f51 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -171,9 +171,17 @@ def detect_windows_arch(compilers): for compiler in compilers.values(): # Check if we're using and inside an MSVC toolchain environment if compiler.id == 'msvc' and 'VCINSTALLDIR' in os.environ: - # 'Platform' is only set when the target arch is not 'x86'. - # It's 'x64' when targeting x86_64 and 'arm' when targeting ARM. - platform = os.environ.get('Platform', 'x86').lower() + if float(compiler.get_toolset_version()) < 10.0: + # On MSVC 2008 and earlier, check 'BUILD_PLAT', where + # 'Win32' means 'x86' + platform = os.environ.get('BUILD_PLAT', 'x86') + if platform == 'Win32': + return 'x86' + else: + # On MSVC 2010 and later 'Platform' is only set when the + # target arch is not 'x86'. It's 'x64' when targeting + # x86_64 and 'arm' when targeting ARM. + platform = os.environ.get('Platform', 'x86').lower() if platform == 'x86': return platform if compiler.id == 'gcc' and compiler.has_builtin_define('__i386__'): |