diff options
author | Nicole Mazzuca <npmazzuca@gmail.com> | 2018-10-22 09:45:32 -0700 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2018-10-27 16:09:38 +0300 |
commit | d5bf869dec5f456337174e999b9e5d42f30178c3 (patch) | |
tree | 885b3bcafc36fbdbad25d5dcd8e6a03466878506 /mesonbuild | |
parent | 0d33916841a198f4ee085d57bdebf23358ec3879 (diff) | |
download | meson-d5bf869dec5f456337174e999b9e5d42f30178c3.zip meson-d5bf869dec5f456337174e999b9e5d42f30178c3.tar.gz meson-d5bf869dec5f456337174e999b9e5d42f30178c3.tar.bz2 |
add support for `/permissive-`
We do this with `std_ver=vc++NM` - `vc++` does not add `/permissive-`,
while `std_ver=c++NM` adds `/permissive-`.
Diffstat (limited to 'mesonbuild')
-rw-r--r-- | mesonbuild/compilers/cpp.py | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/mesonbuild/compilers/cpp.py b/mesonbuild/compilers/cpp.py index 66ae0e5..ac44676 100644 --- a/mesonbuild/compilers/cpp.py +++ b/mesonbuild/compilers/cpp.py @@ -309,13 +309,13 @@ class VisualStudioCPPCompiler(VisualStudioCCompiler, CPPCompiler): self.base_options = ['b_pch', 'b_vscrt'] # FIXME add lto, pgo and the like def get_options(self): - cpp_stds = ['none', 'c++11'] - # Visual Studio 2015 Update 3 and later + cpp_stds = ['none', 'c++11', 'vc++11'] + # Visual Studio 2015 and later if version_compare(self.version, '>=19'): - cpp_stds.extend(['c++14', 'c++latest']) + cpp_stds.extend(['c++14', 'vc++14', 'c++latest', 'vc++latest']) # Visual Studio 2017 and later if version_compare(self.version, '>=19.11'): - cpp_stds.append('c++17') + cpp_stds.extend(['c++17', 'vc++17']) opts = CPPCompiler.get_options(self) opts.update({'cpp_eh': coredata.UserComboOption('cpp_eh', @@ -338,10 +338,20 @@ class VisualStudioCPPCompiler(VisualStudioCCompiler, CPPCompiler): if eh.value != 'none': args.append('/EH' + eh.value) - std = options['cpp_std'] - if std.value == 'none': + vc_version_map = { + 'none': (True, None), + 'vc++11': (True, 11), + 'vc++14': (True, 14), + 'vc++17': (True, 17), + 'c++11': (False, 11), + 'c++14': (False, 14), + 'c++17': (False, 17)} + + permissive, ver = vc_version_map[options['cpp_std'].value] + + if ver is None: pass - elif std.value == 'c++11': + elif ver == 11: # Note: there is no explicit flag for supporting C++11; we attempt to do the best we can # which means setting the C++ standard version to C++14, in compilers that support it # (i.e., after VS2015U3) @@ -353,7 +363,10 @@ class VisualStudioCPPCompiler(VisualStudioCCompiler, CPPCompiler): else: mlog.warning('This version of MSVC does not support cpp_std arguments') else: - args.append('/std:' + std.value) + args.append('/std:c++{}'.format(ver)) + + if not permissive and version_compare(self.version, '>=19.11'): + args.append('/permissive-') return args |