diff options
author | Marios Staikopoulos <marios@staik.net> | 2021-01-17 11:04:22 -0800 |
---|---|---|
committer | Eli Schwartz <eschwartz93@gmail.com> | 2021-01-20 14:11:16 -0500 |
commit | f8681b12e1f1eaf84a9f0d83b16b68ad639fa9d3 (patch) | |
tree | 5f648797154b23eaba39b7fe1b65c276cb19e1fd | |
parent | d808429a483c0cac7e2d27ba68d0d9d4ca13053e (diff) | |
download | meson-f8681b12e1f1eaf84a9f0d83b16b68ad639fa9d3.zip meson-f8681b12e1f1eaf84a9f0d83b16b68ad639fa9d3.tar.gz meson-f8681b12e1f1eaf84a9f0d83b16b68ad639fa9d3.tar.bz2 |
MSVC and Clang-Cl Compiler Argument Cleanup
This commit performs some cleanup for the msvc and clang-cl arguments.
* "Disable Debug" (`/Od`) is no longer manually specified for optimization levels {`0`,`g`} (it is already the default for MSVC).
* "Run Time Checking" (`/RTC1`) removed from `debug` buildtype by default
* Clang-CL `debug` buildtype arguments now match MSVC arguments
* There is now no difference between `buildtype` flags and `debug` + `optimization` flags
-rw-r--r-- | docs/markdown/snippets/msvc_argument_changes.md | 16 | ||||
-rw-r--r-- | mesonbuild/compilers/mixins/visualstudio.py | 33 |
2 files changed, 22 insertions, 27 deletions
diff --git a/docs/markdown/snippets/msvc_argument_changes.md b/docs/markdown/snippets/msvc_argument_changes.md new file mode 100644 index 0000000..26f849b --- /dev/null +++ b/docs/markdown/snippets/msvc_argument_changes.md @@ -0,0 +1,16 @@ +## MSVC/Clang-Cl Argument Changes/Cleanup + +* "Disable Debug" (`/Od`) is no longer manually specified for optimization levels {`0`,`g`} (it is already the default for MSVC). +* "Run Time Checking" (`/RTC1`) removed from `debug` buildtype by default +* Clang-CL `debug` buildtype arguments now match MSVC arguments +* There is now no difference between `buildtype` flags and `debug` + `optimization` flags + +The /Od flag has been removed, as it is already the default in the MSVC compilers, and conflicts with other user options. + +/RTC1 conflicts with other RTC argument types as there are many different options, and has been removed by default. +Run Time Checking can be enabled by manually adding `/RTC1` or other RTC flags of your choice. + +The `debug` buildtype for clang-cl added additional arguments compared to MSVC, which had more to do with optimization than debug. The arguments removed are `/Ob0`, `/Od`, `/RTC1`. (`/Zi` was also removed, but it is already added by default when debug is enabled.) + +If these are important issues for you and would like builtin toggle options, +please file an issue in the Meson bug tracker.
\ No newline at end of file diff --git a/mesonbuild/compilers/mixins/visualstudio.py b/mesonbuild/compilers/mixins/visualstudio.py index 61ee7cf..c5d39c3 100644 --- a/mesonbuild/compilers/mixins/visualstudio.py +++ b/mesonbuild/compilers/mixins/visualstudio.py @@ -60,31 +60,13 @@ vs64_instruction_set_args = { 'neon': None, } # T.Dicst[str, T.Optional[T.List[str]]] -msvc_buildtype_args = { - 'plain': [], - 'debug': ["/RTC1"], - 'debugoptimized': [], - 'release': [], - 'minsize': [], - 'custom': [], -} # type: T.Dict[str, T.List[str]] - -# Clang-cl /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': ['/Od', '/Ob0'], - 'g': ['/O0'], + '0': [], # /Od is default in msvc, no need to specify it + 'g': [], # No specific flag to optimize debugging, /Zi or /ZI will create debug information '1': ['/O1'], - '2': ['/O2', '/Ob1'], - '3': ['/O2', '/Ob2', '/Gw'], - 's': ['/O1', '/Gw'], # Implies /Os. + '2': ['/O2'], + '3': ['/O2', '/Gw'], + 's': ['/O1', '/Gw'], } # type: T.Dict[str, T.List[str]] msvc_debug_args = { @@ -183,7 +165,7 @@ class VisualStudioLikeCompiler(Compiler, metaclass=abc.ABCMeta): return ['/Fo' + target] def get_buildtype_args(self, buildtype: str) -> T.List[str]: - return msvc_buildtype_args[buildtype] + return [] def get_debug_args(self, is_debug: bool) -> T.List[str]: return msvc_debug_args[is_debug] @@ -432,6 +414,3 @@ 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] |