diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2019-04-17 19:14:26 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2019-04-18 00:24:39 +0530 |
commit | e91dd1fe6550a2835de8e961119e3f2cf4695b9b (patch) | |
tree | c6d05069c9c19d4679d9f4c59f454ceaf0f91852 | |
parent | 2942467148749e84868a79dd47dc4d31d4c75789 (diff) | |
download | meson-e91dd1fe6550a2835de8e961119e3f2cf4695b9b.tar.gz |
vs: Update toolset table for VS 2019
Also add a test to ensure that we don't forget it in the future.
-rw-r--r-- | mesonbuild/compilers/c.py | 3 | ||||
-rwxr-xr-x | run_unittests.py | 16 |
2 files changed, 19 insertions, 0 deletions
diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py index 12f7838a4..da9a5dc07 100644 --- a/mesonbuild/compilers/c.py +++ b/mesonbuild/compilers/c.py @@ -1674,6 +1674,9 @@ class VisualStudioCCompiler(CCompiler): return '14.0' # (Visual Studio 2015) elif version < 1920: return '14.1' # (Visual Studio 2017) + elif version < 1930: + return '14.2' # (Visual Studio 2019) + mlog.warning('Could not find toolset for version {!r}'.format(self.version)) return None def get_default_include_dirs(self): diff --git a/run_unittests.py b/run_unittests.py index aa93ee39e..b28eab287 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -958,6 +958,22 @@ class InternalTests(unittest.TestCase): self.assertEqual(ver_a.__cmp__(ver_b), result) self.assertEqual(ver_b.__cmp__(ver_a), -result) + def test_msvc_toolset_version(self): + ''' + Ensure that the toolset version returns the correct value for this MSVC + ''' + env = get_fake_env() + cc = env.detect_c_compiler(False) + if cc.get_argument_syntax() != 'msvc': + raise unittest.SkipTest('Test only applies to MSVC-like compilers') + toolset_ver = cc.get_toolset_version() + self.assertIsNotNone(toolset_ver) + self.assertIn('VCToolsVersion', os.environ) + vctools_ver = os.environ['VCToolsVersion'] + self.assertTrue(vctools_ver.startswith(toolset_ver), + msg='{!r} does not start with {!r}'.format(vctools_ver, toolset_ver)) + + @unittest.skipIf(is_tarball(), 'Skipping because this is a tarball release') class DataTests(unittest.TestCase): |