diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2020-01-08 15:39:33 -0800 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2020-01-29 09:11:24 -0800 |
commit | 0dbe9f6159b427d6688d3b1b39c08584889b6b48 (patch) | |
tree | 3927cd70665a71e1cb6dd53b2b816cd7e6da89fe | |
parent | 773cc7b4b0540fd9a88d89f4179a3ffad11276ae (diff) | |
download | meson-0dbe9f6159b427d6688d3b1b39c08584889b6b48.zip meson-0dbe9f6159b427d6688d3b1b39c08584889b6b48.tar.gz meson-0dbe9f6159b427d6688d3b1b39c08584889b6b48.tar.bz2 |
dependencies: Use DependencyFactory for gl
-rw-r--r-- | mesonbuild/dependencies/__init__.py | 4 | ||||
-rw-r--r-- | mesonbuild/dependencies/ui.py | 24 |
2 files changed, 10 insertions, 18 deletions
diff --git a/mesonbuild/dependencies/__init__.py b/mesonbuild/dependencies/__init__.py index 14eb50b..e1fc6c6 100644 --- a/mesonbuild/dependencies/__init__.py +++ b/mesonbuild/dependencies/__init__.py @@ -26,7 +26,7 @@ from .mpi import MPIDependency from .scalapack import ScalapackDependency from .misc import (BlocksDependency, CursesDependency, NetCDFDependency, OpenMPDependency, ThreadDependency, ShadercDependency, cups_factory, gpgme_factory, libgcrypt_factory, libwmf_factory, pcap_factory, python3_factory) from .platform import AppleFrameworks -from .ui import GLDependency, GnuStepDependency, Qt4Dependency, Qt5Dependency, SDL2Dependency, WxDependency, vulkan_factory +from .ui import GnuStepDependency, Qt4Dependency, Qt5Dependency, SDL2Dependency, WxDependency, gl_factory, vulkan_factory packages.update({ @@ -63,7 +63,7 @@ packages.update({ 'appleframeworks': AppleFrameworks, # From ui: - 'gl': GLDependency, + 'gl': gl_factory, 'gnustep': GnuStepDependency, 'qt4': Qt4Dependency, 'qt5': Qt5Dependency, diff --git a/mesonbuild/dependencies/ui.py b/mesonbuild/dependencies/ui.py index 016e324..02800b8 100644 --- a/mesonbuild/dependencies/ui.py +++ b/mesonbuild/dependencies/ui.py @@ -34,9 +34,9 @@ from .base import ExtraFrameworkDependency, PkgConfigDependency from .base import ConfigToolDependency, process_method_kw, DependencyFactory -class GLDependency(ExternalDependency): - def __init__(self, environment, kwargs): - super().__init__('gl', environment, kwargs) +class GLDependencySystem(ExternalDependency): + def __init__(self, name: str, environment, kwargs): + super().__init__(name, environment, kwargs) if self.env.machines[self.for_machine].is_darwin(): self.is_found = True @@ -51,19 +51,6 @@ class GLDependency(ExternalDependency): # FIXME: Detect version using self.clib_compiler 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, 'gl', environment, kwargs)) - - if DependencyMethods.SYSTEM in methods: - candidates.append(functools.partial(GLDependency, environment, kwargs)) - - return candidates - @staticmethod def get_methods(): if mesonlib.is_osx() or mesonlib.is_windows(): @@ -652,6 +639,11 @@ class VulkanDependencySystem(ExternalDependency): def log_tried(self): return 'system' +gl_factory = DependencyFactory( + 'gl', + [DependencyMethods.PKGCONFIG, DependencyMethods.SYSTEM], + system_class=GLDependencySystem, +) vulkan_factory = DependencyFactory( 'vulkan', |