aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/dependencies/factory.py6
-rw-r--r--mesonbuild/dependencies/misc.py9
2 files changed, 11 insertions, 4 deletions
diff --git a/mesonbuild/dependencies/factory.py b/mesonbuild/dependencies/factory.py
index 9346abe..2844cf4 100644
--- a/mesonbuild/dependencies/factory.py
+++ b/mesonbuild/dependencies/factory.py
@@ -49,6 +49,10 @@ if T.TYPE_CHECKING:
T.List[DependencyGenerator]
]
+ # This should be str, Environment, T.Dict[str, T.Any], T.Optional[str]
+ # But if you try that, you get error: Cannot infer type of lambda
+ CmakeDependencyFunc = T.Callable[..., CMakeDependency]
+
class DependencyFactory:
"""Factory to get dependencies from multiple sources.
@@ -77,7 +81,7 @@ class DependencyFactory:
pkgconfig_name: T.Optional[str] = None,
pkgconfig_class: 'T.Type[PkgConfigDependency]' = PkgConfigDependency,
cmake_name: T.Optional[str] = None,
- cmake_class: 'T.Type[CMakeDependency]' = CMakeDependency,
+ cmake_class: 'T.Union[T.Type[CMakeDependency], CmakeDependencyFunc]' = CMakeDependency,
configtool_class: 'T.Optional[T.Type[ConfigToolDependency]]' = None,
framework_name: T.Optional[str] = None,
framework_class: 'T.Type[ExtraFrameworkDependency]' = ExtraFrameworkDependency,
diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py
index 5441b34..c769077 100644
--- a/mesonbuild/dependencies/misc.py
+++ b/mesonbuild/dependencies/misc.py
@@ -693,18 +693,21 @@ intl_factory = DependencyFactory(
openssl_factory = DependencyFactory(
'openssl',
- [DependencyMethods.PKGCONFIG, DependencyMethods.SYSTEM],
+ [DependencyMethods.PKGCONFIG, DependencyMethods.SYSTEM, DependencyMethods.CMAKE],
system_class=OpensslSystemDependency,
+ cmake_class=lambda name, env, kwargs: CMakeDependency('OpenSSL', env, dict(kwargs, modules=['OpenSSL::Crypto', 'OpenSSL::SSL'])),
)
libcrypto_factory = DependencyFactory(
'libcrypto',
- [DependencyMethods.PKGCONFIG, DependencyMethods.SYSTEM],
+ [DependencyMethods.PKGCONFIG, DependencyMethods.SYSTEM, DependencyMethods.CMAKE],
system_class=OpensslSystemDependency,
+ cmake_class=lambda name, env, kwargs: CMakeDependency('OpenSSL', env, dict(kwargs, modules=['OpenSSL::Crypto'])),
)
libssl_factory = DependencyFactory(
'libssl',
- [DependencyMethods.PKGCONFIG, DependencyMethods.SYSTEM],
+ [DependencyMethods.PKGCONFIG, DependencyMethods.SYSTEM, DependencyMethods.CMAKE],
system_class=OpensslSystemDependency,
+ cmake_class=lambda name, env, kwargs: CMakeDependency('OpenSSL', env, dict(kwargs, modules=['OpenSSL::SSL'])),
)