|
|
@ -15,11 +15,13 @@ |
|
|
|
# This file contains the detection logic for miscellaneous external dependencies. |
|
|
|
# This file contains the detection logic for miscellaneous external dependencies. |
|
|
|
|
|
|
|
|
|
|
|
import subprocess |
|
|
|
import subprocess |
|
|
|
|
|
|
|
import shutil |
|
|
|
from pathlib import Path |
|
|
|
from pathlib import Path |
|
|
|
|
|
|
|
|
|
|
|
from .. import mlog |
|
|
|
from .. import mlog |
|
|
|
from ..mesonlib import split_args |
|
|
|
from ..mesonlib import split_args, listify |
|
|
|
from .base import DependencyException, ExternalDependency, ExternalProgram, PkgConfigDependency |
|
|
|
from .base import (DependencyException, DependencyMethods, ExternalDependency, ExternalProgram, |
|
|
|
|
|
|
|
PkgConfigDependency) |
|
|
|
|
|
|
|
|
|
|
|
class HDF5Dependency(ExternalDependency): |
|
|
|
class HDF5Dependency(ExternalDependency): |
|
|
|
|
|
|
|
|
|
|
@ -29,23 +31,23 @@ class HDF5Dependency(ExternalDependency): |
|
|
|
kwargs['required'] = False |
|
|
|
kwargs['required'] = False |
|
|
|
kwargs['silent'] = True |
|
|
|
kwargs['silent'] = True |
|
|
|
self.is_found = False |
|
|
|
self.is_found = False |
|
|
|
|
|
|
|
methods = listify(self.methods) |
|
|
|
|
|
|
|
|
|
|
|
# 1. pkg-config |
|
|
|
if language not in ('c', 'cpp', 'fortran'): |
|
|
|
|
|
|
|
raise DependencyException('Language {} is not supported with HDF5.'.format(language)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if set([DependencyMethods.AUTO, DependencyMethods.PKGCONFIG]).intersection(methods): |
|
|
|
|
|
|
|
PCEXE = shutil.which('pkg-config') |
|
|
|
|
|
|
|
if PCEXE: |
|
|
|
pkgconfig_files = ['hdf5', 'hdf5-serial'] |
|
|
|
pkgconfig_files = ['hdf5', 'hdf5-serial'] |
|
|
|
# some distros put hdf5-1.2.3.pc with version number in .pc filename. |
|
|
|
# some distros put hdf5-1.2.3.pc with version number in .pc filename. |
|
|
|
try: |
|
|
|
ret = subprocess.run([PCEXE, '--list-all'], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, |
|
|
|
ret = subprocess.run(['pkg-config', '--list-all'], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, |
|
|
|
|
|
|
|
universal_newlines=True) |
|
|
|
universal_newlines=True) |
|
|
|
if ret.returncode == 0: |
|
|
|
if ret.returncode == 0: |
|
|
|
for pkg in ret.stdout.split('\n'): |
|
|
|
for pkg in ret.stdout.split('\n'): |
|
|
|
if pkg.startswith(('hdf5')): |
|
|
|
if pkg.startswith(('hdf5')): |
|
|
|
pkgconfig_files.append(pkg.split(' ', 1)[0]) |
|
|
|
pkgconfig_files.append(pkg.split(' ', 1)[0]) |
|
|
|
pkgconfig_files = list(set(pkgconfig_files)) # dedupe |
|
|
|
pkgconfig_files = list(set(pkgconfig_files)) # dedupe |
|
|
|
except FileNotFoundError: |
|
|
|
|
|
|
|
# pkg-config was not available |
|
|
|
|
|
|
|
pass |
|
|
|
|
|
|
|
if language not in ('c', 'cpp', 'fortran'): |
|
|
|
|
|
|
|
raise DependencyException('Language {} is not supported with HDF5.'.format(language)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for pkg in pkgconfig_files: |
|
|
|
for pkg in pkgconfig_files: |
|
|
|
pkgdep = PkgConfigDependency(pkg, environment, kwargs, language=self.language) |
|
|
|
pkgdep = PkgConfigDependency(pkg, environment, kwargs, language=self.language) |
|
|
@ -94,7 +96,7 @@ class HDF5Dependency(ExternalDependency): |
|
|
|
self.pcdep = pkgdep |
|
|
|
self.pcdep = pkgdep |
|
|
|
return |
|
|
|
return |
|
|
|
|
|
|
|
|
|
|
|
# 2. compiler wrapper fallback |
|
|
|
if DependencyMethods.AUTO in methods: |
|
|
|
wrappers = {'c': 'h5cc', 'cpp': 'h5c++', 'fortran': 'h5fc'} |
|
|
|
wrappers = {'c': 'h5cc', 'cpp': 'h5c++', 'fortran': 'h5fc'} |
|
|
|
comp_args = [] |
|
|
|
comp_args = [] |
|
|
|
link_args = [] |
|
|
|
link_args = [] |
|
|
@ -121,3 +123,8 @@ class HDF5Dependency(ExternalDependency): |
|
|
|
self.compile_args = comp_args |
|
|
|
self.compile_args = comp_args |
|
|
|
self.link_args = link_args |
|
|
|
self.link_args = link_args |
|
|
|
self.is_found = True |
|
|
|
self.is_found = True |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
|
|
def get_methods(): |
|
|
|
|
|
|
|
return [DependencyMethods.AUTO, DependencyMethods.PKGCONFIG] |
|
|
|