From 361f7484d2fe9d1cf03b66a66d785618694aa62c Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Mon, 16 Oct 2023 14:22:12 -0400 Subject: Remove duplicated code to canonicalize b_vscrt option value Add a common function that infers vscrt from buildtype in Compiler base class. --- mesonbuild/compilers/asm.py | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) (limited to 'mesonbuild/compilers/asm.py') diff --git a/mesonbuild/compilers/asm.py b/mesonbuild/compilers/asm.py index 19f7b64..392a082 100644 --- a/mesonbuild/compilers/asm.py +++ b/mesonbuild/compilers/asm.py @@ -124,28 +124,7 @@ class NasmCompiler(Compiler): def get_crt_link_args(self, crt_val: str, buildtype: str) -> T.List[str]: if not self.info.is_windows(): return [] - if crt_val in self.crt_args: - return self.crt_args[crt_val] - assert crt_val in {'from_buildtype', 'static_from_buildtype'} - dbg = 'mdd' - rel = 'md' - if crt_val == 'static_from_buildtype': - dbg = 'mtd' - rel = 'mt' - # Match what build type flags used to do. - if buildtype == 'plain': - return [] - elif buildtype == 'debug': - return self.crt_args[dbg] - elif buildtype == 'debugoptimized': - return self.crt_args[rel] - elif buildtype == 'release': - return self.crt_args[rel] - elif buildtype == 'minsize': - return self.crt_args[rel] - else: - assert buildtype == 'custom' - raise EnvironmentException('Requested C runtime based on buildtype, but buildtype is "custom".') + return self.crt_args[self.get_crt_val(crt_val, buildtype)] class YasmCompiler(NasmCompiler): id = 'yasm' -- cgit v1.1