aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers
diff options
context:
space:
mode:
authorVili Väinölä <vilivainola@gmail.com>2020-09-27 14:12:46 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2020-09-29 19:25:50 +0300
commitd1638a4fde5be879fe7778200b6ae6d59106a25e (patch)
tree0ce114f2e263ab0c965974f55963d657a769755d /mesonbuild/compilers
parent5f70984403e48e72e22991882ac6ffa03d6ce18e (diff)
downloadmeson-d1638a4fde5be879fe7778200b6ae6d59106a25e.zip
meson-d1638a4fde5be879fe7778200b6ae6d59106a25e.tar.gz
meson-d1638a4fde5be879fe7778200b6ae6d59106a25e.tar.bz2
compilers/VS: fix build to use optimization and debug flags
- Fixed using debug and optimization built-in options in MSVC. - Fixed that VS backend does not create pdb files in release mode. VS implicitly adds the debug fields if left out. - Fix that it is possible to add debug info with ninja backend with optimizations.
Diffstat (limited to 'mesonbuild/compilers')
-rw-r--r--mesonbuild/compilers/mixins/visualstudio.py34
1 files changed, 17 insertions, 17 deletions
diff --git a/mesonbuild/compilers/mixins/visualstudio.py b/mesonbuild/compilers/mixins/visualstudio.py
index d9abb95..77f8dfc 100644
--- a/mesonbuild/compilers/mixins/visualstudio.py
+++ b/mesonbuild/compilers/mixins/visualstudio.py
@@ -62,10 +62,10 @@ vs64_instruction_set_args = {
msvc_buildtype_args = {
'plain': [],
- 'debug': ["/ZI", "/Ob0", "/Od", "/RTC1"],
- 'debugoptimized': ["/Zi", "/Ob1"],
- 'release': ["/Ob2", "/Gw"],
- 'minsize': ["/Zi", "/Gw"],
+ 'debug': ["/ZI", "/RTC1"],
+ 'debugoptimized': [],
+ 'release': [],
+ 'minsize': [],
'custom': [],
} # type: T.Dict[str, T.List[str]]
@@ -79,17 +79,17 @@ clangcl_buildtype_args = msvc_buildtype_args.copy()
clangcl_buildtype_args['debug'] = ['/Zi', '/Ob0', '/Od', '/RTC1']
msvc_optimization_args = {
- '0': [],
+ '0': ['/Od', '/Ob0'],
'g': ['/O0'],
'1': ['/O1'],
- '2': ['/O2'],
- '3': ['/O2'],
- 's': ['/O1'], # Implies /Os.
+ '2': ['/O2', '/Ob1'],
+ '3': ['/O2', '/Ob2', '/Gw'],
+ 's': ['/O1', '/Gw'], # Implies /Os.
} # type: T.Dict[str, T.List[str]]
msvc_debug_args = {
False: [],
- True: [] # Fixme!
+ True: ['/Zi']
} # type: T.Dict[bool, T.List[str]]
@@ -182,12 +182,18 @@ class VisualStudioLikeCompiler(Compiler, metaclass=abc.ABCMeta):
return ['/Fe' + target]
return ['/Fo' + target]
- def get_optimization_args(self, optimization_level: str) -> T.List[str]:
- return msvc_optimization_args[optimization_level]
+ def get_buildtype_args(self, buildtype: str) -> T.List[str]:
+ return msvc_buildtype_args[buildtype]
def get_debug_args(self, is_debug: bool) -> T.List[str]:
return msvc_debug_args[is_debug]
+ def get_optimization_args(self, optimization_level: str) -> T.List[str]:
+ args = msvc_optimization_args[optimization_level]
+ if mesonlib.version_compare(self.version, '<18.0'):
+ args = [arg for arg in args if arg != '/Gw']
+ return args
+
def get_dependency_gen_args(self, outtarget: str, outfile: str) -> T.List[str]:
return []
@@ -409,12 +415,6 @@ class MSVCCompiler(VisualStudioLikeCompiler):
return None
return super().get_instruction_set_args(instruction_set)
- def get_buildtype_args(self, buildtype: str) -> T.List[str]:
- args = msvc_buildtype_args[buildtype]
- if mesonlib.version_compare(self.version, '<18.0'):
- args = [arg for arg in args if arg != '/Gw']
- return args
-
def get_pch_base_name(self, header: str) -> str:
return os.path.basename(header)