diff options
author | Jon Turney <jon.turney@dronecode.org.uk> | 2018-10-24 14:47:02 +0100 |
---|---|---|
committer | Jon Turney <jon.turney@dronecode.org.uk> | 2018-11-04 15:42:06 +0000 |
commit | a025c98d3082806321f53c4dfae9c738d1dc1584 (patch) | |
tree | 612004e694d1d22d34b7de549a4793ef4448d759 /mesonbuild/compilers | |
parent | 48351e70cd4732b913c49f6fd42621ff8b6d87f4 (diff) | |
download | meson-a025c98d3082806321f53c4dfae9c738d1dc1584.zip meson-a025c98d3082806321f53c4dfae9c738d1dc1584.tar.gz meson-a025c98d3082806321f53c4dfae9c738d1dc1584.tar.bz2 |
Qualify checks of self.version by self.id in VisualStudioC/CPPCompiler
Diffstat (limited to 'mesonbuild/compilers')
-rw-r--r-- | mesonbuild/compilers/c.py | 10 | ||||
-rw-r--r-- | mesonbuild/compilers/cpp.py | 17 |
2 files changed, 17 insertions, 10 deletions
diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py index b185dfb..ab62afd 100644 --- a/mesonbuild/compilers/c.py +++ b/mesonbuild/compilers/c.py @@ -1298,7 +1298,7 @@ class VisualStudioCCompiler(CCompiler): def get_buildtype_args(self, buildtype): args = compilers.msvc_buildtype_args[buildtype] - if version_compare(self.version, '<18.0'): + if self.id == 'msvc' and version_compare(self.version, '<18.0'): args = [arg for arg in args if arg != '/Gw'] return args @@ -1470,7 +1470,7 @@ class VisualStudioCCompiler(CCompiler): # build obviously, which is why we only do this when PCH is on. # This was added in Visual Studio 2013 (MSVC 18.0). Before that it was # always on: https://msdn.microsoft.com/en-us/library/dn502518.aspx - if pch and version_compare(self.version, '>=18.0'): + if pch and self.id == 'msvc' and version_compare(self.version, '>=18.0'): args = ['/FS'] + args return args @@ -1487,7 +1487,7 @@ class VisualStudioCCompiler(CCompiler): def get_instruction_set_args(self, instruction_set): if self.is_64: return vs64_instruction_set_args.get(instruction_set, None) - if self.version.split('.')[0] == '16' and instruction_set == 'avx': + if self.id == 'msvc' and self.version.split('.')[0] == '16' and instruction_set == 'avx': # VS documentation says that this exists and should work, but # it does not. The headers do not contain AVX intrinsics # and the can not be called. @@ -1495,6 +1495,10 @@ class VisualStudioCCompiler(CCompiler): return vs32_instruction_set_args.get(instruction_set, None) def get_toolset_version(self): + if self.id == 'clang-cl': + # I have no idea + return '14.1' + # See boost/config/compiler/visualc.cpp for up to date mapping try: version = int(''.join(self.version.split('.')[0:2])) diff --git a/mesonbuild/compilers/cpp.py b/mesonbuild/compilers/cpp.py index 1045c7d..65a1033 100644 --- a/mesonbuild/compilers/cpp.py +++ b/mesonbuild/compilers/cpp.py @@ -310,12 +310,15 @@ class VisualStudioCPPCompiler(VisualStudioCCompiler, CPPCompiler): def get_options(self): cpp_stds = ['none', 'c++11', 'vc++11'] - # Visual Studio 2015 and later - if version_compare(self.version, '>=19'): - 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.extend(['c++17', 'vc++17']) + if self.id == 'clang-cl': + cpp_stds.extend(['c++14', 'vc++14', 'c++17', 'vc++17', 'c++latest']) + else: + # Visual Studio 2015 and later + if version_compare(self.version, '>=19'): + 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.extend(['c++17', 'vc++17']) opts = CPPCompiler.get_options(self) opts.update({'cpp_eh': coredata.UserComboOption('cpp_eh', @@ -356,7 +359,7 @@ class VisualStudioCPPCompiler(VisualStudioCCompiler, CPPCompiler): # which means setting the C++ standard version to C++14, in compilers that support it # (i.e., after VS2015U3) # if one is using anything before that point, one cannot set the standard. - if version_compare(self.version, '>=19.00.24210'): + if self.id == 'clang-cl' or version_compare(self.version, '>=19.00.24210'): mlog.warning('MSVC does not support C++11; ' 'attempting best effort; setting the standard to C++14') args.append('/std:c++14') |