aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2020-01-06 13:59:11 -0800
committerDylan Baker <dylan@pnwbakers.com>2020-01-28 10:52:00 -0800
commit3f8d6af9c2110bc1b3c94dd7b638d5b7eb1208c0 (patch)
treedf59ad40583f25865fbb8b74b60b1614523972ca /mesonbuild/compilers
parent0f47ca95c1291ed954bf6a84783208d5538ef881 (diff)
downloadmeson-3f8d6af9c2110bc1b3c94dd7b638d5b7eb1208c0.zip
meson-3f8d6af9c2110bc1b3c94dd7b638d5b7eb1208c0.tar.gz
meson-3f8d6af9c2110bc1b3c94dd7b638d5b7eb1208c0.tar.bz2
compilers: Use /Zi instead of /ZI with clang-cl
Clang-cl doesn't support /ZI, so we need to use either /Zi or /Z7, which both do the same thing for clang-cl (though not for msvc) Fixes #6414
Diffstat (limited to 'mesonbuild/compilers')
-rw-r--r--mesonbuild/compilers/mixins/visualstudio.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/mesonbuild/compilers/mixins/visualstudio.py b/mesonbuild/compilers/mixins/visualstudio.py
index 525a87e..a994379 100644
--- a/mesonbuild/compilers/mixins/visualstudio.py
+++ b/mesonbuild/compilers/mixins/visualstudio.py
@@ -61,6 +61,15 @@ msvc_buildtype_args = {
'custom': [],
} # type: T.Dict[str, T.List[str]]
+# Clang-cl doesn't have /ZI, and /Zi and /Z7 do the same thing
+# quoting the docs (https://clang.llvm.org/docs/MSVCCompatibility.html):
+#
+# Clang emits relatively complete CodeView debug information if /Z7 or /Zi is
+# passed. Microsoft’s link.exe will transform the CodeView debug information
+# into a PDB
+clangcl_buildtype_args = msvc_buildtype_args.copy()
+clangcl_buildtype_args['debug'] = ['/Zi', '/Ob0', '/Od', '/RTC1']
+
msvc_optimization_args = {
'0': [],
'g': ['/O0'],
@@ -130,9 +139,6 @@ class VisualStudioLikeCompiler(metaclass=abc.ABCMeta):
def get_always_args(self) -> T.List[str]:
return self.always_args
- def get_buildtype_args(self, buildtype: str) -> T.List[str]:
- return msvc_buildtype_args[buildtype]
-
def get_pch_suffix(self) -> str:
return 'pch'
@@ -398,7 +404,7 @@ class MSVCCompiler(VisualStudioLikeCompiler):
return super().get_instruction_set_args(instruction_set)
def get_buildtype_args(self, buildtype: str) -> T.List[str]:
- args = super().get_buildtype_args(buildtype)
+ args = msvc_buildtype_args[buildtype]
if mesonlib.version_compare(self.version, '<18.0'):
args = [arg for arg in args if arg != '/Gw']
return args
@@ -426,3 +432,6 @@ class ClangClCompiler(VisualStudioLikeCompiler):
def get_pch_base_name(self, header: str) -> str:
return header
+
+ def get_buildtype_args(self, buildtype: str) -> T.List[str]:
+ return clangcl_buildtype_args[buildtype]