diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2017-02-07 15:00:25 +0530 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2017-02-07 20:55:24 +0200 |
commit | 781e69094a79cd8e736868c0f8c40874e91026c0 (patch) | |
tree | 24c2243664914d2a9877b149eac77c1c637fba82 | |
parent | 4dae59dfeac2af2f48e54d504293757a10834619 (diff) | |
download | meson-781e69094a79cd8e736868c0f8c40874e91026c0.zip meson-781e69094a79cd8e736868c0f8c40874e91026c0.tar.gz meson-781e69094a79cd8e736868c0f8c40874e91026c0.tar.bz2 |
dependencies: Distinguish native/cross while caching
Closes https://github.com/mesonbuild/meson/issues/1366
-rw-r--r-- | mesonbuild/dependencies.py | 14 | ||||
-rw-r--r-- | mesonbuild/interpreter.py | 12 |
2 files changed, 19 insertions, 7 deletions
diff --git a/mesonbuild/dependencies.py b/mesonbuild/dependencies.py index 32e13b7..c894b0e 100644 --- a/mesonbuild/dependencies.py +++ b/mesonbuild/dependencies.py @@ -108,14 +108,14 @@ class PkgConfigDependency(Dependency): self.cargs = [] self.libs = [] if 'native' in kwargs and environment.is_cross_build(): - want_cross = not kwargs['native'] + self.want_cross = not kwargs['native'] else: - want_cross = environment.is_cross_build() + self.want_cross = environment.is_cross_build() self.name = name # When finding dependencies for cross-compiling, we don't care about # the 'native' pkg-config - if want_cross: + if self.want_cross: if 'pkgconfig' not in environment.cross_info.config['binaries']: if self.required: raise DependencyException('Pkg-config binary missing from cross file') @@ -142,7 +142,7 @@ class PkgConfigDependency(Dependency): if self.required: raise DependencyException('Pkg-config not found.') return - if want_cross: + if self.want_cross: self.type_string = 'Cross' else: self.type_string = 'Native' @@ -551,9 +551,9 @@ class BoostDependency(Dependency): self.environment = environment self.libdir = '' if 'native' in kwargs and environment.is_cross_build(): - want_cross = not kwargs['native'] + self.want_cross = not kwargs['native'] else: - want_cross = environment.is_cross_build() + self.want_cross = environment.is_cross_build() try: self.boost_root = os.environ['BOOST_ROOT'] if not os.path.isabs(self.boost_root): @@ -561,7 +561,7 @@ class BoostDependency(Dependency): except KeyError: self.boost_root = None if self.boost_root is None: - if want_cross: + if self.want_cross: raise DependencyException('BOOST_ROOT is needed while cross-compiling') if mesonlib.is_windows(): self.boost_root = self.detect_win_root() 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 |