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/d.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'mesonbuild/compilers/d.py') diff --git a/mesonbuild/compilers/d.py b/mesonbuild/compilers/d.py index 3065ac7..1390694 100644 --- a/mesonbuild/compilers/d.py +++ b/mesonbuild/compilers/d.py @@ -14,7 +14,9 @@ import os.path, subprocess -from ..mesonlib import EnvironmentException, version_compare, is_windows, is_osx +from ..mesonlib import ( + EnvironmentException, MachineChoice, version_compare, is_windows, is_osx +) from .compilers import ( CompilerType, @@ -306,12 +308,17 @@ class DCompiler(Compiler): # Add link flags needed to find dependencies args += d.get_link_args() + if env.is_cross_build() and not self.is_cross: + for_machine = MachineChoice.BUILD + else: + for_machine = MachineChoice.HOST + if mode == 'compile': # Add DFLAGS from the env - args += env.coredata.get_external_args(self.language) + args += env.coredata.get_external_args(for_machine, self.language) elif mode == 'link': # Add LDFLAGS from the env - args += env.coredata.get_external_link_args(self.language) + args += env.coredata.get_external_link_args(for_machine, self.language) # extra_args must override all other arguments, so we add them last args += extra_args return args -- cgit v1.1