aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Hirsch, Ph.D <scivision@users.noreply.github.com>2019-01-31 20:42:53 -0500
committerNirbheek Chauhan <nirbheek.chauhan@gmail.com>2019-02-01 07:26:32 +0000
commit8821c0aadcc901f1a624e082a59a385ed6725d98 (patch)
tree3b7979fd7ef827b20d9c91b4f8faa1efc03919ec
parente1a83793ae986db44bc810c36a8ea8090d81fe3f (diff)
downloadmeson-8821c0aadcc901f1a624e082a59a385ed6725d98.zip
meson-8821c0aadcc901f1a624e082a59a385ed6725d98.tar.gz
meson-8821c0aadcc901f1a624e082a59a385ed6725d98.tar.bz2
better handle variable HDF5 setups, update Fortran compiler def
-rw-r--r--mesonbuild/compilers/fortran.py4
-rw-r--r--mesonbuild/dependencies/base.py1
-rw-r--r--mesonbuild/dependencies/misc.py24
-rw-r--r--mesonbuild/dependencies/platform.py2
-rw-r--r--test cases/frameworks/25 hdf5/main.cpp6
-rw-r--r--test cases/frameworks/25 hdf5/meson.build25
6 files changed, 30 insertions, 32 deletions
diff --git a/mesonbuild/compilers/fortran.py b/mesonbuild/compilers/fortran.py
index a8e8e25..eea1660 100644
--- a/mesonbuild/compilers/fortran.py
+++ b/mesonbuild/compilers/fortran.py
@@ -267,8 +267,8 @@ class FortranCompiler(Compiler):
return CCompiler._get_trials_from_pattern(pattern, directory, libname)
@staticmethod
- def _get_file_from_list(files) -> List[str]:
- return CCompiler._get_file_from_list(files)
+ def _get_file_from_list(env, files: List[str]) -> str:
+ return CCompiler._get_file_from_list(env, files)
class GnuFortranCompiler(GnuCompiler, FortranCompiler):
def __init__(self, exelist, version, compiler_type, is_cross, exe_wrapper=None, defines=None, **kwargs):
diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py
index 586c716..9da0d7c 100644
--- a/mesonbuild/dependencies/base.py
+++ b/mesonbuild/dependencies/base.py
@@ -19,7 +19,6 @@ import copy
import functools
import os
import re
-import stat
import json
import shlex
import shutil
diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py
index fb2b9db..208f063 100644
--- a/mesonbuild/dependencies/misc.py
+++ b/mesonbuild/dependencies/misc.py
@@ -52,23 +52,25 @@ class HDF5Dependency(ExternalDependency):
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:
+ pd_link_args = pkgdep.get_link_args()
+ link_args = []
+ for larg in pd_link_args:
lpath = Path(larg)
if lpath.is_file():
if 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)))
+ link_args.append(str(lpath.parent / (lpath.stem + '_hl_cpp' + lpath.suffix)))
+ 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)))
+ link_args.append(str(lpath.parent / (lpath.stem + 'hl_fortran' + lpath.suffix)))
+ link_args.append(str(lpath.parent / (lpath.stem + '_fortran' + lpath.suffix)))
- # C is used by other languages
- lang_link_args.append(str(lpath.parent / (lpath.stem + '_hl' + lpath.suffix)))
- lang_link_args.append(larg)
+ # HDF5 C libs are required by other HDF5 languages
+ link_args.append(str(lpath.parent / (lpath.stem + '_hl' + lpath.suffix)))
+ link_args.append(larg)
+ else:
+ link_args.append(larg)
- self.link_args = lang_link_args
+ self.link_args = link_args
self.version = pkgdep.get_version()
self.is_found = True
self.pcdep = pkgdep
diff --git a/mesonbuild/dependencies/platform.py b/mesonbuild/dependencies/platform.py
index 20d3bd6..7e9f9d8 100644
--- a/mesonbuild/dependencies/platform.py
+++ b/mesonbuild/dependencies/platform.py
@@ -15,8 +15,6 @@
# This file contains the detection logic for external dependencies that are
# platform-specific (generally speaking).
-from .. import mesonlib
-
from .base import ExternalDependency, DependencyException
diff --git a/test cases/frameworks/25 hdf5/main.cpp b/test cases/frameworks/25 hdf5/main.cpp
index 2baff36..477e76b 100644
--- a/test cases/frameworks/25 hdf5/main.cpp
+++ b/test cases/frameworks/25 hdf5/main.cpp
@@ -9,7 +9,7 @@ unsigned maj, min, rel;
ier = H5open();
if (ier) {
- std::cerr << "Unable to initialize HDF5: %d" << ier << std::endl;
+ std::cerr << "Unable to initialize HDF5: " << ier << std::endl;
return EXIT_FAILURE;
}
@@ -18,11 +18,11 @@ if (ier) {
std::cerr << "HDF5 did not initialize!" << std::endl;
return EXIT_FAILURE;
}
-printf("C++ HDF5 version %d.%d.%d\n", maj, min, rel);
+std::cout << "C++ HDF5 version " << maj << "." << min << "." << rel << std::endl;
ier = H5close();
if (ier) {
- std::cerr << "Unable to close HDF5: %d" << ier << std::endl;
+ std::cerr << "Unable to close HDF5: " << ier << std::endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
diff --git a/test cases/frameworks/25 hdf5/meson.build b/test cases/frameworks/25 hdf5/meson.build
index e225a35..9033354 100644
--- a/test cases/frameworks/25 hdf5/meson.build
+++ b/test cases/frameworks/25 hdf5/meson.build
@@ -12,30 +12,29 @@ endif
# --- C tests
h5c = dependency('hdf5', language : 'c', required : false)
if not h5c.found()
- error('MESON_SKIP_TEST: HDF5 not found, skipping.')
+ error('MESON_SKIP_TEST: HDF5 C library not found, skipping HDF5 framework tests.')
endif
-exec = executable('exec', 'main.c',
- dependencies : h5c)
+exec = executable('exec', 'main.c', dependencies : h5c)
test('HDF5 C', exec)
# --- C++ tests
-h5cpp = dependency('hdf5', language : 'cpp')
-execpp = executable('execpp', 'main.cpp',
- dependencies : h5cpp)
-
-test('HDF5 C++', execpp)
-
+h5cpp = dependency('hdf5', language : 'cpp', required : false)
+if h5cpp.found()
+ execpp = executable('execpp', 'main.cpp', dependencies : h5cpp)
+ test('HDF5 C++', execpp)
+endif
# --- Fortran tests
if build_machine.system() != 'windows'
add_languages('fortran')
- h5f = dependency('hdf5', language : 'fortran')
- exef = executable('exef', 'main.f90',
- dependencies : h5f)
+ h5f = dependency('hdf5', language : 'fortran', required : false)
+ if h5f.found()
+ exef = executable('exef', 'main.f90', dependencies : h5f)
- test('HDF5 Fortran', exef)
+ test('HDF5 Fortran', exef)
+ endif
endif
# Check we can apply a version constraint