Merge pull request #2849 from polarina/vsregenfix

Fix Visual Studio version detection for the `vs` backend
pull/2838/head
Jussi Pakkanen 7 years ago committed by GitHub
commit a9c57e17a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      mesonbuild/backend/vs2010backend.py
  2. 1
      mesonbuild/mesonmain.py

@ -29,10 +29,9 @@ from ..environment import Environment
def autodetect_vs_version(build):
vs_version = os.getenv('VisualStudioVersion', None)
vs_install_dir = os.getenv('VSINSTALLDIR', None)
if not vs_version and not vs_install_dir:
raise MesonException('Could not detect Visual Studio: VisualStudioVersion and VSINSTALLDIR are unset!\n'
'Are we inside a Visual Studio build environment? '
'You can also try specifying the exact backend to use.')
if not vs_install_dir:
raise MesonException('Could not detect Visual Studio: Environment variable VSINSTALLDIR is not set!\n'
'Are you running meson from the Visual Studio Developer Command Prompt?')
# VisualStudioVersion is set since Visual Studio 12.0, but sometimes
# vcvarsall.bat doesn't set it, so also use VSINSTALLDIR
if vs_version == '14.0' or 'Visual Studio 14' in vs_install_dir:

@ -172,6 +172,7 @@ class MesonApp:
elif self.options.backend == 'vs':
from .backend import vs2010backend
g = vs2010backend.autodetect_vs_version(b)
env.coredata.set_builtin_option('backend', g.name)
mlog.log('Auto detected Visual Studio backend:', mlog.bold(g.name))
elif self.options.backend == 'vs2010':
from .backend import vs2010backend

Loading…
Cancel
Save