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/modules/gnome.py | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) (limited to 'mesonbuild/modules/gnome.py') diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py index 871cd48..2d16956 100644 --- a/mesonbuild/modules/gnome.py +++ b/mesonbuild/modules/gnome.py @@ -29,7 +29,9 @@ from . import GResourceTarget, GResourceHeaderTarget, GirTarget, TypelibTarget, from . import get_include_args from . import ExtensionModule from . import ModuleReturnValue -from ..mesonlib import MesonException, OrderedSet, Popen_safe, extract_as_list +from ..mesonlib import ( + MachineChoice, MesonException, OrderedSet, Popen_safe, extract_as_list +) from ..dependencies import Dependency, PkgConfigDependency, InternalDependency from ..interpreterbase import noKwargs, permittedKwargs, FeatureNew, FeatureNewKwargs @@ -531,11 +533,7 @@ class GnomeModule(ExtensionModule): ret = [] for lang in langs: - if state.environment.is_cross_build(): - link_args = state.environment.properties.host.get_external_link_args(lang) - else: - link_args = state.environment.coredata.get_external_link_args(lang) - + link_args = state.environment.coredata.get_external_link_args(MachineChoice.HOST, lang) for link_arg in link_args: if link_arg.startswith('-L'): ret.append(link_arg) @@ -720,10 +718,7 @@ class GnomeModule(ExtensionModule): def _get_external_args_for_langs(self, state, langs): ret = [] for lang in langs: - if state.environment.is_cross_build(): - ret += state.environment.properties.host.get_external_args(lang) - else: - ret += state.environment.coredata.get_external_args(lang) + ret += state.environment.coredata.get_external_args(MachineChoice.HOST, lang) return ret @staticmethod @@ -1048,13 +1043,11 @@ This will become a hard error in the future.''') ldflags.update(internal_ldflags) ldflags.update(external_ldflags) + cflags.update(state.environment.coredata.get_external_args(MachineChoice.HOST, 'c')) + ldflags.update(state.environment.coredata.get_external_link_args(MachineChoice.HOST, 'c')) if state.environment.is_cross_build(): - cflags.update(state.environment.properties.host.get_external_args('c')) - ldflags.update(state.environment.properties.host.get_external_link_args('c')) compiler = state.environment.coredata.cross_compilers.get('c') else: - cflags.update(state.environment.coredata.get_external_args('c')) - ldflags.update(state.environment.coredata.get_external_link_args('c')) compiler = state.environment.coredata.compilers.get('c') compiler_flags = self._get_langs_compilers_flags(state, [('c', compiler)]) -- cgit v1.1