From 19f81d3e33c70c9c902dabaad732e5d33bf05bd4 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Wed, 12 Dec 2018 00:19:03 -0500 Subject: Never access environment.properties downstream Instead use coredata.compiler_options.. This brings the cross and native code paths closer together, since both now use that. Command line options are interpreted just as before, for backwards compatibility. This does introduce some funny conditionals. In the future, I'd like to change the interpretation of command line options so - The logic is cross-agnostic, i.e. there are no conditions affected by `is_cross_build()`. - Compiler args for both the build and host machines can always be controlled by the command line. - Compiler args for both machines can always be controlled separately. --- mesonbuild/compilers/compilers.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'mesonbuild/compilers/compilers.py') diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index 317d91a..9a101bf 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -21,8 +21,8 @@ from .. import coredata from .. import mlog from .. import mesonlib from ..mesonlib import ( - EnvironmentException, MesonException, OrderedSet, version_compare, - Popen_safe + EnvironmentException, MachineChoice, MesonException, OrderedSet, + version_compare, Popen_safe ) """This file contains the data files of all compilers Meson knows @@ -1011,7 +1011,11 @@ class Compiler: opts = {} # build afresh every time # Take default values from env variables. - compile_args, link_args = self.get_args_from_envvars() + if not self.is_cross: + compile_args, link_args = self.get_args_from_envvars() + else: + compile_args = [] + link_args = [] description = 'Extra arguments passed to the {}'.format(self.get_display_language()) opts.update({ self.language + '_args': coredata.UserArrayOption( @@ -1083,10 +1087,9 @@ class Compiler: def get_cross_extra_flags(self, environment, link): extra_flags = [] if self.is_cross and environment: - props = environment.properties.host - extra_flags += props.get_external_args(self.language) + extra_flags += environment.coredata.get_external_args(MachineChoice.HOST, self.language) if link: - extra_flags += props.get_external_link_args(self.language) + extra_flags += environment.coredata.get_external_link_args(MachineChoice.HOST, self.language) return extra_flags def _get_compile_output(self, dirname, mode): -- cgit v1.1