diff options
author | John Ericson <git@JohnEricson.me> | 2018-12-12 00:19:03 -0500 |
---|---|---|
committer | John Ericson <git@JohnEricson.me> | 2019-02-02 13:59:14 -0500 |
commit | 19f81d3e33c70c9c902dabaad732e5d33bf05bd4 (patch) | |
tree | f86664395d7233bbba9e3c129c81c7056c6fa98b /mesonbuild/compilers/compilers.py | |
parent | 6dbe33d949237411b1291c30f5383885befb3554 (diff) | |
download | meson-19f81d3e33c70c9c902dabaad732e5d33bf05bd4.zip meson-19f81d3e33c70c9c902dabaad732e5d33bf05bd4.tar.gz meson-19f81d3e33c70c9c902dabaad732e5d33bf05bd4.tar.bz2 |
Never access environment.properties downstream
Instead use coredata.compiler_options.<machine>. 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.
Diffstat (limited to 'mesonbuild/compilers/compilers.py')
-rw-r--r-- | mesonbuild/compilers/compilers.py | 15 |
1 files changed, 9 insertions, 6 deletions
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): |