Visual Studio: Drop /utf-8 if it is not supported
We assume /utf-8 for all C builds unless /source-charset or /execution-charset is specified, but then this will cause trouble for Visual Studio 2013 or earler since the /utf-8 flag is only supported since Visual Studio 2015. Specifically, if we try to check whether compiler flags are supported, those checks will fail since /utf-8 is never supported on these older Visual Studio versions. Drop /utf-8 from get_always_args() if we are using Visual Studio 2013 or earlier.
This commit is contained in:
parent
4fa5b2ee42
commit
9bbceeee06
|
@ -105,6 +105,8 @@ class VisualStudioLikeCompiler(Compiler, metaclass=abc.ABCMeta):
|
|||
# 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.
|
||||
# It is also dropped if Visual Studio 2013 or earlier is used, since it would
|
||||
# not be supported in that case.
|
||||
always_args = ['/nologo', '/showIncludes', '/utf-8']
|
||||
warn_args = {
|
||||
'0': [],
|
||||
|
@ -429,6 +431,14 @@ class MSVCCompiler(VisualStudioLikeCompiler):
|
|||
args = ['/FS'] + args
|
||||
return args
|
||||
|
||||
# Override CCompiler.get_always_args
|
||||
# We want to drop '/utf-8' for Visual Studio 2013 and earlier
|
||||
def get_always_args(self) -> T.List[str]:
|
||||
if mesonlib.version_compare(self.version, '<19.00'):
|
||||
if '/utf-8' in self.always_args:
|
||||
self.always_args.remove('/utf-8')
|
||||
return self.always_args
|
||||
|
||||
def get_instruction_set_args(self, instruction_set: str) -> T.Optional[T.List[str]]:
|
||||
if self.version.split('.')[0] == '16' and instruction_set == 'avx':
|
||||
# VS documentation says that this exists and should work, but
|
||||
|
|
Loading…
Reference in New Issue