aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/interpreter.py
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2017-02-07 15:00:25 +0530
committerJussi Pakkanen <jpakkane@gmail.com>2017-02-07 20:55:24 +0200
commit781e69094a79cd8e736868c0f8c40874e91026c0 (patch)
tree24c2243664914d2a9877b149eac77c1c637fba82 /mesonbuild/interpreter.py
parent4dae59dfeac2af2f48e54d504293757a10834619 (diff)
downloadmeson-781e69094a79cd8e736868c0f8c40874e91026c0.zip
meson-781e69094a79cd8e736868c0f8c40874e91026c0.tar.gz
meson-781e69094a79cd8e736868c0f8c40874e91026c0.tar.bz2
dependencies: Distinguish native/cross while caching
Closes https://github.com/mesonbuild/meson/issues/1366
Diffstat (limited to 'mesonbuild/interpreter.py')
-rw-r--r--mesonbuild/interpreter.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index cb5b617..007a7d5 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -1788,6 +1788,15 @@ class Interpreter(InterpreterBase):
raise InvalidArguments('''Characters <, > and = are forbidden in target names. To specify version
requirements use the version keyword argument instead.''')
identifier = dependencies.get_dep_identifier(name, kwargs)
+ # Check if we want this as a cross-dep or a native-dep
+ # FIXME: Not all dependencies support such a distinction right now,
+ # and we repeat this check inside dependencies that do. We need to
+ # consolidate this somehow.
+ is_cross = self.environment.is_cross_build()
+ if 'native' in kwargs and is_cross:
+ want_cross = not kwargs['native']
+ else:
+ want_cross = is_cross
# Check if we've already searched for and found this dep
cached_dep = None
if identifier in self.coredata.deps:
@@ -1804,6 +1813,9 @@ requirements use the version keyword argument instead.''')
# so we properly go into fallback/error code paths
if kwargs.get('required', True) and not getattr(cached_dep, 'required', False):
cached_dep = None
+ # Don't reuse cached dep if one is a cross-dep and the other is a native dep
+ if not getattr(cached_dep, 'want_cross', is_cross) == want_cross:
+ cached_dep = None
if cached_dep:
dep = cached_dep