diff options
author | Chun-wei Fan <fanc999@yahoo.com.tw> | 2023-01-10 15:28:37 +0800 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek.chauhan@gmail.com> | 2023-02-07 15:32:22 +0530 |
commit | 9bbceeee068190b2a7a622b368d7a4d54385fb22 (patch) | |
tree | a7188c27cd5116350145c16b098d606ce3a96d4a /mesonbuild/compilers | |
parent | 4fa5b2ee42adfb8120ae329b10cd9a85b0ae5740 (diff) | |
download | meson-9bbceeee068190b2a7a622b368d7a4d54385fb22.tar.gz |
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.
Diffstat (limited to 'mesonbuild/compilers')
-rw-r--r-- | mesonbuild/compilers/mixins/visualstudio.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/mesonbuild/compilers/mixins/visualstudio.py b/mesonbuild/compilers/mixins/visualstudio.py index 5a326dc4a..48d0bbbe7 100644 --- a/mesonbuild/compilers/mixins/visualstudio.py +++ b/mesonbuild/compilers/mixins/visualstudio.py @@ -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 |