diff options
Diffstat (limited to 'mesonbuild/dependencies/python.py')
-rw-r--r-- | mesonbuild/dependencies/python.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/mesonbuild/dependencies/python.py b/mesonbuild/dependencies/python.py index 478df6a..eaa9067 100644 --- a/mesonbuild/dependencies/python.py +++ b/mesonbuild/dependencies/python.py @@ -19,6 +19,8 @@ import typing as T from .. import mesonlib, mlog from .base import process_method_kw, DependencyMethods, DependencyTypeName, ExternalDependency, SystemDependency +from .configtool import ConfigToolDependency +from .factory import DependencyFactory from .framework import ExtraFrameworkDependency from .pkgconfig import PkgConfigDependency from ..environment import detect_cpu_family @@ -49,6 +51,21 @@ else: _Base = object +class Pybind11ConfigToolDependency(ConfigToolDependency): + + tools = ['pybind11-config'] + + # pybind11 in 2.10.4 added --version, sanity-check another flag unique to it + # in the meantime + skip_version = '--pkgconfigdir' + + def __init__(self, name: str, environment: Environment, kwargs: T.Dict[str, T.Any]): + super().__init__(name, environment, kwargs) + if not self.is_found: + return + self.compile_args = self.get_config_value(['--includes'], 'compile_args') + + class BasicPythonExternalProgram(ExternalProgram): def __init__(self, name: str, command: T.Optional[T.List[str]] = None, ext_prog: T.Optional[ExternalProgram] = None): @@ -371,3 +388,9 @@ def python_factory(env: 'Environment', for_machine: 'MachineChoice', candidates.append(functools.partial(PythonFrameworkDependency, 'Python', env, nkwargs, installation)) return candidates + +pybind11_factory = DependencyFactory( + 'pybind11', + [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL, DependencyMethods.CMAKE], + configtool_class=Pybind11ConfigToolDependency, +) |