aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/interpreter.py
diff options
context:
space:
mode:
authorJohn Ericson <git@JohnEricson.me>2018-12-12 00:19:03 -0500
committerJohn Ericson <git@JohnEricson.me>2019-02-02 13:59:14 -0500
commit19f81d3e33c70c9c902dabaad732e5d33bf05bd4 (patch)
treef86664395d7233bbba9e3c129c81c7056c6fa98b /mesonbuild/interpreter.py
parent6dbe33d949237411b1291c30f5383885befb3554 (diff)
downloadmeson-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/interpreter.py')
-rw-r--r--mesonbuild/interpreter.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index fb4c468..2eb0720 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -36,6 +36,7 @@ import os, shutil, uuid
import re, shlex
import subprocess
from collections import namedtuple
+from itertools import chain
from pathlib import PurePath
import functools
@@ -998,8 +999,13 @@ class CompilerHolder(InterpreterObject):
idir = os.path.join(self.environment.get_source_dir(),
i.held_object.get_curdir(), idir)
args += self.compiler.get_include_args(idir, False)
+ native = kwargs.get('native', None)
+ if native:
+ for_machine = MachineChoice.BUILD
+ else:
+ for_machine = MachineChoice.HOST
if not nobuiltins:
- opts = self.environment.coredata.compiler_options
+ opts = self.environment.coredata.compiler_options[for_machine]
args += self.compiler.get_option_compile_args(opts)
if mode == 'link':
args += self.compiler.get_option_link_args(opts)
@@ -2454,8 +2460,9 @@ external dependencies (including libraries) must go to "dependencies".''')
def get_option_internal(self, optname):
# Some base options are not defined in some environments, return the
# default value from compilers.base_options in that case.
- for d in [self.coredata.base_options, compilers.base_options,
- self.coredata.builtins, self.coredata.compiler_options]:
+ for d in chain(
+ [self.coredata.base_options, compilers.base_options, self.coredata.builtins],
+ self.coredata.get_all_compiler_options()):
try:
return d[optname]
except KeyError: