aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/c.py
diff options
context:
space:
mode:
Diffstat (limited to 'mesonbuild/compilers/c.py')
-rw-r--r--mesonbuild/compilers/c.py39
1 files changed, 34 insertions, 5 deletions
diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py
index 1a0d6b2..c7092b8 100644
--- a/mesonbuild/compilers/c.py
+++ b/mesonbuild/compilers/c.py
@@ -30,8 +30,6 @@ from .compilers import (
GCC_MINGW,
get_largefile_args,
gnu_winlibs,
- msvc_buildtype_args,
- msvc_buildtype_linker_args,
msvc_winlibs,
vs32_instruction_set_args,
vs64_instruction_set_args,
@@ -1197,6 +1195,13 @@ class VisualStudioCCompiler(CCompiler):
ignore_libs = gnu_compiler_internal_libs
internal_libs = ()
+ crt_args = {'none': [],
+ 'md': ['/MD'],
+ 'mdd': ['/MDd'],
+ 'mt': ['/MT'],
+ 'mtd': ['/MTd'],
+ }
+
def __init__(self, exelist, version, is_cross, exe_wrap, is_64):
CCompiler.__init__(self, exelist, version, is_cross, exe_wrap)
self.id = 'msvc'
@@ -1206,7 +1211,7 @@ class VisualStudioCCompiler(CCompiler):
self.warn_args = {'1': ['/W2'],
'2': ['/W3'],
'3': ['/W4']}
- self.base_options = ['b_pch', 'b_ndebug'] # FIXME add lto, pgo and the like
+ self.base_options = ['b_pch', 'b_ndebug', 'b_vscrt'] # FIXME add lto, pgo and the like
self.is_64 = is_64
# Override CCompiler.get_always_args
@@ -1225,10 +1230,10 @@ class VisualStudioCCompiler(CCompiler):
return ['/MDd']
def get_buildtype_args(self, buildtype):
- return msvc_buildtype_args[buildtype]
+ return compilers.msvc_buildtype_args[buildtype]
def get_buildtype_linker_args(self, buildtype):
- return msvc_buildtype_linker_args[buildtype]
+ return compilers.msvc_buildtype_linker_args[buildtype]
def get_pch_suffix(self):
return 'pch'
@@ -1258,6 +1263,12 @@ class VisualStudioCCompiler(CCompiler):
return ['/Fe' + target]
return ['/Fo' + target]
+ def get_optimization_args(self, optimization_level):
+ return compilers.msvc_optimization_args[optimization_level]
+
+ def get_debug_args(self, is_debug):
+ return compilers.msvc_debug_args[is_debug]
+
def get_dependency_gen_args(self, outtarget, outfile):
return []
@@ -1440,6 +1451,24 @@ class VisualStudioCCompiler(CCompiler):
return []
return os.environ['INCLUDE'].split(os.pathsep)
+ def get_crt_compile_args(self, crt_val, buildtype):
+ if crt_val in self.crt_args:
+ return self.crt_args[crt_val]
+ assert(crt_val == 'from_buildtype')
+ # Match what build type flags used to do.
+ if buildtype == 'plain':
+ return []
+ elif buildtype == 'debug':
+ return self.crt_args['mdd']
+ elif buildtype == 'debugoptimized':
+ return self.crt_args['md']
+ elif buildtype == 'release':
+ return self.crt_args['md']
+ elif buildtype == 'minsize':
+ return self.crt_args['md']
+ else:
+ assert(buildtype == 'custom')
+ raise EnvironmentException('Requested C runtime based on buildtype, but buildtype is "custom".')
class ArmCCompiler(ArmCompiler, CCompiler):
def __init__(self, exelist, version, is_cross, exe_wrapper=None, **kwargs):