diff options
Diffstat (limited to 'mesonbuild/dependencies/misc.py')
-rw-r--r-- | mesonbuild/dependencies/misc.py | 46 |
1 files changed, 44 insertions, 2 deletions
diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py index e6f52a5..b9f8bb6 100644 --- a/mesonbuild/dependencies/misc.py +++ b/mesonbuild/dependencies/misc.py @@ -14,14 +14,13 @@ # This file contains the detection logic for miscellaneous external dependencies. +from pathlib import Path import functools import os import re import shlex import sysconfig -from pathlib import Path - from .. import mlog from .. import mesonlib from ..environment import detect_cpu_family @@ -33,6 +32,49 @@ from .base import ( ) +class HDF5Dependency(ExternalDependency): + + def __init__(self, environment, kwargs): + language = kwargs.get('language', 'c') + super().__init__('hdf5', environment, language, kwargs) + kwargs['required'] = False + kwargs['silent'] = True + self.is_found = False + + pkgconfig_files = ['hdf5'] + + if language not in ('c', 'cpp', 'fortran'): + raise DependencyException('Language {} is not supported with HDF5.'.format(language)) + + for pkg in pkgconfig_files: + try: + pkgdep = PkgConfigDependency(pkg, environment, kwargs, language=self.language) + if pkgdep.found(): + self.compile_args = pkgdep.get_compile_args() + # derive needed libraries by language + link_args = pkgdep.get_link_args() + lang_link_args = [] + for larg in link_args: + lpath = Path(larg) + if lpath.is_file(): + if language == 'c': + lang_link_args.append(str(lpath.parent / (lpath.stem + '_hl' + lpath.suffix))) + lang_link_args.append(larg) + elif language == 'cpp': + lang_link_args.append(str(lpath.parent / (lpath.stem + '_hl_cpp' + lpath.suffix))) + lang_link_args.append(str(lpath.parent / (lpath.stem + '_cpp' + lpath.suffix))) + elif language == 'fortran': + lang_link_args.append(str(lpath.parent / (lpath.stem + 'hl_fortran' + lpath.suffix))) + lang_link_args.append(str(lpath.parent / (lpath.stem + '_fortran' + lpath.suffix))) + + self.link_args = lang_link_args + self.version = pkgdep.get_version() + self.is_found = True + self.pcdep = pkgdep + break + except Exception: + pass + class MPIDependency(ExternalDependency): def __init__(self, environment, kwargs): |