aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/dependencies/misc.py
diff options
context:
space:
mode:
authorAndrei Alexeyev <0x416b617269@gmail.com>2019-04-02 22:47:10 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2019-04-02 22:47:10 +0300
commit8209180c760fe9dcbe6b3e81fbce233ff1c35a31 (patch)
tree67e2fa3ed36c20747200b7a96b132af8dc153a4f /mesonbuild/dependencies/misc.py
parent38273ac6684fd5b19d123427c43e851bc0b98b1b (diff)
downloadmeson-8209180c760fe9dcbe6b3e81fbce233ff1c35a31.zip
meson-8209180c760fe9dcbe6b3e81fbce233ff1c35a31.tar.gz
meson-8209180c760fe9dcbe6b3e81fbce233ff1c35a31.tar.bz2
Add shaderc dependency lookup logic
Diffstat (limited to 'mesonbuild/dependencies/misc.py')
-rw-r--r--mesonbuild/dependencies/misc.py47
1 files changed, 47 insertions, 0 deletions
diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py
index 52e8ee6..76eccfb 100644
--- a/mesonbuild/dependencies/misc.py
+++ b/mesonbuild/dependencies/misc.py
@@ -117,6 +117,7 @@ class HDF5Dependency(ExternalDependency):
except Exception:
pass
+
class NetCDFDependency(ExternalDependency):
def __init__(self, environment, kwargs):
@@ -666,3 +667,49 @@ class LibGCryptDependency(ExternalDependency):
@staticmethod
def get_methods():
return [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL]
+
+
+class ShadercDependency(ExternalDependency):
+
+ def __init__(self, environment, kwargs):
+ super().__init__('shaderc', environment, None, kwargs)
+
+ static_lib = 'shaderc_combined'
+ shared_lib = 'shaderc_shared'
+
+ libs = [shared_lib, static_lib]
+ if self.static:
+ libs.reverse()
+
+ cc = self.get_compiler()
+
+ for lib in libs:
+ self.link_args = cc.find_library(lib, environment, [])
+ if self.link_args is not None:
+ self.is_found = True
+
+ if self.static and lib != static_lib:
+ mlog.warning('Static library {!r} not found for dependency {!r}, may '
+ 'not be statically linked'.format(static_lib, self.name))
+
+ break
+
+ def log_tried(self):
+ return 'system'
+
+ @classmethod
+ def _factory(cls, environment, kwargs):
+ methods = cls._process_method_kw(kwargs)
+ candidates = []
+
+ if DependencyMethods.SYSTEM in methods:
+ candidates.append(functools.partial(ShadercDependency, environment, kwargs))
+
+ if DependencyMethods.PKGCONFIG in methods:
+ candidates.append(functools.partial(PkgConfigDependency, 'shaderc', environment, kwargs))
+
+ return candidates
+
+ @staticmethod
+ def get_methods():
+ return [DependencyMethods.SYSTEM, DependencyMethods.PKGCONFIG]