| 1 |
project( |
| 2 |
'hdf5_framework', |
| 3 |
'c', |
| 4 |
default_options : ['cpp_std=c++11'], |
| 5 |
) |
| 6 |
|
| 7 |
# NOTE: all HDF5 languages must have HDF5 C library working. |
| 8 |
|
| 9 |
method = get_option('method') |
| 10 |
|
| 11 |
# --- C tests |
| 12 |
h5c = dependency('hdf5', language : 'c', required : false, method : method) |
| 13 |
if not h5c.found() |
| 14 |
error('MESON_SKIP_TEST: HDF5 C library not found.') |
| 15 |
endif |
| 16 |
exec = executable('exec', 'main.c', dependencies : h5c) |
| 17 |
test('HDF5 C', exec, timeout: 30) |
| 18 |
|
| 19 |
# --- C++ tests |
| 20 |
if add_languages('cpp', required: false) |
| 21 |
h5cpp = dependency('hdf5', language : 'cpp', required : false, disabler: true, method : method) |
| 22 |
execpp = executable('execpp', 'main.cpp', dependencies : h5cpp) |
| 23 |
test('HDF5 C++', execpp, timeout: 30) |
| 24 |
endif |
| 25 |
|
| 26 |
test_fortran = add_languages('fortran', required: false) |
| 27 |
|
| 28 |
if test_fortran |
| 29 |
cpp = meson.get_compiler('cpp') |
| 30 |
fc = meson.get_compiler('fortran') |
| 31 |
fs = import('fs') |
| 32 |
|
| 33 |
if host_machine.system() == 'darwin' and cpp.get_id() == 'clang' and fc.get_id() == 'gcc' |
| 34 |
# Search paths don't work correctly here and -lgfortran doesn't work |
| 35 |
test_fortran = false |
| 36 |
elif host_machine.system() == 'windows' and cpp.get_id() != 'gcc' and fc.get_id() == 'gcc' |
| 37 |
# mixing gfortran with non-gcc doesn't work on windows |
| 38 |
test_fortran = false |
| 39 |
elif fs.is_dir('/ci') and '-I' not in run_command('h5fc', '-show').stdout() |
| 40 |
# h5fc does not include needed -I flags when HDF5 is built using CMake |
| 41 |
# https://github.com/HDFGroup/hdf5/issues/5660 |
| 42 |
test_fortran = false |
| 43 |
endif |
| 44 |
|
| 45 |
# --- Fortran tests |
| 46 |
if test_fortran |
| 47 |
h5f = dependency('hdf5', language : 'fortran', required : false, disabler: true, method : method) |
| 48 |
exef = executable('exef', 'main.f90', dependencies : h5f) |
| 49 |
test('HDF5 Fortran', exef, timeout: 30) |
| 50 |
endif |
| 51 |
endif |
| 52 |
|
| 53 |
# Check we can apply a version constraint |
| 54 |
if h5c.version() != 'unknown' |
| 55 |
dependency('hdf5', version: '>=@0@'.format(h5c.version())) |
| 56 |
endif |