diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2020-11-12 20:40:49 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-12 20:40:49 +0200 |
commit | 06de675df2172b6c6f9908686540ebf57b20db4a (patch) | |
tree | a6ac31a0767fcbff1dc3a761242187555448cb75 /mesonbuild/compilers/rust.py | |
parent | 41a79a0757eadf74ea6c3d8985400c56083b68cb (diff) | |
parent | ce46070b4ee69fe573ff4105d06b970445fea0aa (diff) | |
download | meson-06de675df2172b6c6f9908686540ebf57b20db4a.zip meson-06de675df2172b6c6f9908686540ebf57b20db4a.tar.gz meson-06de675df2172b6c6f9908686540ebf57b20db4a.tar.bz2 |
Merge pull request #7961 from dcbaker/submit/rust-color-output
Add color output support to rust
Diffstat (limited to 'mesonbuild/compilers/rust.py')
-rw-r--r-- | mesonbuild/compilers/rust.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/mesonbuild/compilers/rust.py b/mesonbuild/compilers/rust.py index 469859b..1be0cd8 100644 --- a/mesonbuild/compilers/rust.py +++ b/mesonbuild/compilers/rust.py @@ -17,7 +17,7 @@ import textwrap import typing as T from .. import coredata -from ..mesonlib import EnvironmentException, MachineChoice, Popen_safe +from ..mesonlib import EnvironmentException, MachineChoice, MesonException, Popen_safe from .compilers import Compiler, rust_buildtype_args, clike_debug_args if T.TYPE_CHECKING: @@ -52,6 +52,9 @@ class RustCompiler(Compiler): linker=linker) self.exe_wrapper = exe_wrapper self.id = 'rustc' + self.base_options.append('b_colorout') + if 'link' in self.linker.id: + self.base_options.append('b_vscrt') def needs_static_linker(self) -> bool: return False @@ -141,3 +144,12 @@ class RustCompiler(Compiler): if std.value != 'none': args.append('--edition=' + std.value) return args + + def get_crt_compile_args(self, crt_val: str, buildtype: str) -> T.List[str]: + # Rust handles this for us, we don't need to do anything + return [] + + def get_colorout_args(self, colortype: str) -> T.List[str]: + if colortype in {'always', 'never', 'auto'}: + return [f'--color={colortype}'] + raise MesonException(f'Invalid color type for rust {colortype}') |