diff options
Diffstat (limited to 'mesonbuild')
-rw-r--r-- | mesonbuild/compilers/compilers.py | 32 | ||||
-rw-r--r-- | mesonbuild/modules/unstable_external_project.py | 8 |
2 files changed, 22 insertions, 18 deletions
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index 234ce06..41e1036 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -91,18 +91,22 @@ languages_using_cppflags = {'c', 'cpp', 'objc', 'objcpp'} # type: T.Set[str] soregex = re.compile(r'.*\.so(\.[0-9]+)?(\.[0-9]+)?(\.[0-9]+)?$') # Environment variables that each lang uses. -cflags_mapping = {'c': 'CFLAGS', - 'cpp': 'CXXFLAGS', - 'cuda': 'CUFLAGS', - 'objc': 'OBJCFLAGS', - 'objcpp': 'OBJCXXFLAGS', - 'fortran': 'FFLAGS', - 'd': 'DFLAGS', - 'vala': 'VALAFLAGS', - 'rust': 'RUSTFLAGS'} # type: T.Dict[str, str] - -cexe_mapping = {'c': 'CC', - 'cpp': 'CXX'} +CFLAGS_MAPPING: T.Mapping[str, str] = { + 'c': 'CFLAGS', + 'cpp': 'CXXFLAGS', + 'cuda': 'CUFLAGS', + 'objc': 'OBJCFLAGS', + 'objcpp': 'OBJCXXFLAGS', + 'fortran': 'FFLAGS', + 'd': 'DFLAGS', + 'vala': 'VALAFLAGS', + 'rust': 'RUSTFLAGS', +} + +CEXE_MAPPING: T.Mapping = { + 'c': 'CC', + 'cpp': 'CXX', +} # All these are only for C-linkable languages; see `clink_langs` above. @@ -1207,13 +1211,13 @@ def get_args_from_envvars(lang: str, Returns a tuple of (compile_flags, link_flags) for the specified language from the inherited environment """ - if lang not in cflags_mapping: + if lang not in CFLAGS_MAPPING: return [], [] compile_flags = [] # type: T.List[str] link_flags = [] # type: T.List[str] - env_compile_flags = get_env_var(for_machine, is_cross, cflags_mapping[lang]) + env_compile_flags = get_env_var(for_machine, is_cross, CFLAGS_MAPPING[lang]) if env_compile_flags is not None: compile_flags += split_args(env_compile_flags) diff --git a/mesonbuild/modules/unstable_external_project.py b/mesonbuild/modules/unstable_external_project.py index 7249078..809b590 100644 --- a/mesonbuild/modules/unstable_external_project.py +++ b/mesonbuild/modules/unstable_external_project.py @@ -23,7 +23,7 @@ from ..mesonlib import (MesonException, Popen_safe, MachineChoice, from ..interpreterbase import InterpreterObject, InterpreterException, FeatureNew from ..interpreterbase import stringArgs, permittedKwargs from ..interpreter import Interpreter, DependencyHolder, InstallDir -from ..compilers.compilers import cflags_mapping, cexe_mapping +from ..compilers.compilers import CFLAGS_MAPPING, CEXE_MAPPING from ..dependencies.base import InternalDependency, PkgConfigDependency from ..environment import Environment from ..mesonlib import OptionKey @@ -110,11 +110,11 @@ class ExternalProject(InterpreterObject): link_args = [] self.run_env = os.environ.copy() for lang, compiler in self.env.coredata.compilers[MachineChoice.HOST].items(): - if any(lang not in i for i in (cexe_mapping, cflags_mapping)): + if any(lang not in i for i in (CEXE_MAPPING, CFLAGS_MAPPING)): continue cargs = self.env.coredata.get_external_args(MachineChoice.HOST, lang) - self.run_env[cexe_mapping[lang]] = self._quote_and_join(compiler.get_exelist()) - self.run_env[cflags_mapping[lang]] = self._quote_and_join(cargs) + self.run_env[CEXE_MAPPING[lang]] = self._quote_and_join(compiler.get_exelist()) + self.run_env[CFLAGS_MAPPING[lang]] = self._quote_and_join(cargs) if not link_exelist: link_exelist = compiler.get_linker_exelist() link_args = self.env.coredata.get_external_link_args(MachineChoice.HOST, lang) |