aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/dependencies/ui.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2020-01-07 16:02:14 -0800
committerDylan Baker <dylan@pnwbakers.com>2020-01-29 09:11:24 -0800
commitc17fa3223f948742d802b4032f6b6a79a8542357 (patch)
treed9b0161c9763d2af11fc2946f433195c57fdb776 /mesonbuild/dependencies/ui.py
parent29b6d3e63ce6b18fa159a9d36de77c4f78c8bcc9 (diff)
downloadmeson-c17fa3223f948742d802b4032f6b6a79a8542357.zip
meson-c17fa3223f948742d802b4032f6b6a79a8542357.tar.gz
meson-c17fa3223f948742d802b4032f6b6a79a8542357.tar.bz2
dependencies: Use DependencyFactory for Vulkan
Diffstat (limited to 'mesonbuild/dependencies/ui.py')
-rw-r--r--mesonbuild/dependencies/ui.py30
1 files changed, 12 insertions, 18 deletions
diff --git a/mesonbuild/dependencies/ui.py b/mesonbuild/dependencies/ui.py
index 38c51b8..016e324 100644
--- a/mesonbuild/dependencies/ui.py
+++ b/mesonbuild/dependencies/ui.py
@@ -31,7 +31,7 @@ from ..environment import detect_cpu_family
from .base import DependencyException, DependencyMethods
from .base import ExternalDependency, ExternalProgram, NonExistingExternalProgram
from .base import ExtraFrameworkDependency, PkgConfigDependency
-from .base import ConfigToolDependency, process_method_kw
+from .base import ConfigToolDependency, process_method_kw, DependencyFactory
class GLDependency(ExternalDependency):
@@ -589,10 +589,10 @@ class WxDependency(ConfigToolDependency):
return candidates
-class VulkanDependency(ExternalDependency):
+class VulkanDependencySystem(ExternalDependency):
- def __init__(self, environment, kwargs):
- super().__init__('vulkan', environment, kwargs)
+ def __init__(self, name: str, environment, kwargs, language: T.Optional[str] = None):
+ super().__init__(name, environment, kwargs, language=language)
try:
self.vulkan_sdk = os.environ['VULKAN_SDK']
@@ -645,22 +645,16 @@ class VulkanDependency(ExternalDependency):
self.link_args.append(lib)
return
- @classmethod
- def _factory(cls, environment, kwargs):
- methods = process_method_kw(cls.get_methods(), kwargs)
- candidates = []
-
- if DependencyMethods.PKGCONFIG in methods:
- candidates.append(functools.partial(PkgConfigDependency, 'vulkan', environment, kwargs))
-
- if DependencyMethods.SYSTEM in methods:
- candidates.append(functools.partial(VulkanDependency, environment, kwargs))
-
- return candidates
-
@staticmethod
def get_methods():
- return [DependencyMethods.PKGCONFIG, DependencyMethods.SYSTEM]
+ return [DependencyMethods.SYSTEM]
def log_tried(self):
return 'system'
+
+
+vulkan_factory = DependencyFactory(
+ 'vulkan',
+ [DependencyMethods.PKGCONFIG, DependencyMethods.SYSTEM],
+ system_class=VulkanDependencySystem,
+)