diff options
Diffstat (limited to 'mesonbuild')
-rw-r--r-- | mesonbuild/dependencies/detect.py | 41 |
1 files changed, 17 insertions, 24 deletions
diff --git a/mesonbuild/dependencies/detect.py b/mesonbuild/dependencies/detect.py index b5c9251..dea70a2 100644 --- a/mesonbuild/dependencies/detect.py +++ b/mesonbuild/dependencies/detect.py @@ -192,37 +192,30 @@ def _build_external_dependency_list(name: str, env: 'Environment', for_machine: candidates: T.List['DependencyGenerator'] = [] - # If it's explicitly requested, use the dub detection method (only) - if 'dub' == kwargs.get('method', ''): - candidates.append(functools.partial(DubDependency, name, env, kwargs)) - return candidates - - # If it's explicitly requested, use the pkgconfig detection method (only) - if 'pkg-config' == kwargs.get('method', ''): - candidates.append(functools.partial(PkgConfigDependency, name, env, kwargs)) - return candidates - - # If it's explicitly requested, use the CMake detection method (only) - if 'cmake' == kwargs.get('method', ''): - candidates.append(functools.partial(CMakeDependency, name, env, kwargs)) - return candidates + if kwargs.get('method', 'auto') == 'auto': + # Just use the standard detection methods. + methods = ['pkg-config', 'extraframework', 'cmake'] + else: + # If it's explicitly requested, use that detection method (only). + methods = [kwargs['method']] - # If it's explicitly requested, use the Extraframework detection method (only) - if 'extraframework' == kwargs.get('method', ''): - # On OSX, also try framework dependency detector - if env.machines[for_machine].is_darwin(): - candidates.append(functools.partial(ExtraFrameworkDependency, name, env, kwargs)) - return candidates + # Exclusive to when it is explicitly requested + if 'dub' in methods: + candidates.append(functools.partial(DubDependency, name, env, kwargs)) - # Otherwise, just use the pkgconfig and cmake dependency detector - if 'auto' == kwargs.get('method', 'auto'): + # Preferred first candidate for auto. + if 'pkg-config' in methods: candidates.append(functools.partial(PkgConfigDependency, name, env, kwargs)) - # On OSX, also try framework dependency detector + # On OSX only, try framework dependency detector. + if 'extraframework' in methods: if env.machines[for_machine].is_darwin(): candidates.append(functools.partial(ExtraFrameworkDependency, name, env, kwargs)) - # Only use CMake as a last resort, since it might not work 100% (see #6113) + # Only use CMake: + # - if it's explicitly requested + # - as a last resort, since it might not work 100% (see #6113) + if 'cmake' in methods: candidates.append(functools.partial(CMakeDependency, name, env, kwargs)) return candidates |