summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mesonbuild/compilers/mixins/visualstudio.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/mesonbuild/compilers/mixins/visualstudio.py b/mesonbuild/compilers/mixins/visualstudio.py
index 0ad4d8512..2839f6270 100644
--- a/mesonbuild/compilers/mixins/visualstudio.py
+++ b/mesonbuild/compilers/mixins/visualstudio.py
@@ -101,9 +101,7 @@ class VisualStudioLikeCompiler(Compiler, metaclass=abc.ABCMeta):
# /showIncludes is needed for build dependency tracking in Ninja
# See: https://ninja-build.org/manual.html#_deps
- # Assume UTF-8 sources by default, but self.unix_args_to_native() removes it
- # if `/source-charset` is set too.
- always_args = ['/nologo', '/showIncludes', '/utf-8']
+ always_args = ['/nologo', '/showIncludes'] # type: T.List[str]
warn_args = {
'0': [],
'1': ['/W2'],
@@ -117,6 +115,10 @@ class VisualStudioLikeCompiler(Compiler, metaclass=abc.ABCMeta):
self.base_options = {mesonlib.OptionKey(o) for o in ['b_pch', 'b_ndebug', 'b_vscrt']} # FIXME add lto, pgo and the like
self.target = target
self.is_64 = ('x64' in target) or ('x86_64' in target)
+ # Assume UTF-8 sources by default on Visual Studio 2015 or later, or clang,
+ # but self.unix_args_to_native() removes it if `/source-charset` is set too.
+ if isinstance(self, ClangClCompiler) or mesonlib.version_compare(self.version, '>=19.00'):
+ self.always_args = self.always_args + ['/utf-8']
# do some canonicalization of target machine
if 'x86_64' in target:
self.machine = 'x64'
@@ -130,10 +132,6 @@ class VisualStudioLikeCompiler(Compiler, metaclass=abc.ABCMeta):
self.machine = target
if mesonlib.version_compare(self.version, '>=19.28.29910'): # VS 16.9.0 includes cl 19.28.29910
self.base_options.add(mesonlib.OptionKey('b_sanitize'))
- # Exclude /utf-8 in self.always_args in VS2013 and earlier
- if not isinstance(self, ClangClCompiler):
- if mesonlib.version_compare(self.version, '<19.00'):
- self.always_args.remove('/utf-8')
assert self.linker is not None
self.linker.machine = self.machine