From 16bad124caa7c84d6cabb2ca92d852183cdaa94d Mon Sep 17 00:00:00 2001 From: "Michael Hirsch, Ph.D" Date: Fri, 25 Oct 2019 17:12:26 -0400 Subject: [PATCH] meson: generalize finding to not hard error but disaber(). add windows msys2 defaults --- .github/workflows/{ci.yml => ci_linux.yml} | 2 +- README.md | 7 +------ cmake/meson.build | 19 ++++++++++++------- meson.build | 1 - 4 files changed, 14 insertions(+), 15 deletions(-) rename .github/workflows/{ci.yml => ci_linux.yml} (98%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci_linux.yml similarity index 98% rename from .github/workflows/ci.yml rename to .github/workflows/ci_linux.yml index c457e6ce..20bf4ca7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci_linux.yml @@ -1,4 +1,4 @@ -name: ci +name: ci_linux on: [push, pull_request] diff --git a/README.md b/README.md index b16e6257..49e590b9 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ [![DOI](https://zenodo.org/badge/128736984.svg)](https://zenodo.org/badge/latestdoi/128736984) -[![Actions Status](https://github.com/scivision/oo_hdf5_fortran/workflows/ci/badge.svg)](https://github.com/scivision/oo_hdf5_fortran/actions) +[![Actions Status](https://github.com/scivision/oo_hdf5_fortran/workflows/ci_linux/badge.svg)](https://github.com/scivision/oo_hdf5_fortran/actions) [![Actions Status](https://github.com/scivision/oo_hdf5_fortran/workflows/ci_mac/badge.svg)](https://github.com/scivision/oo_hdf5_fortran/actions) # Object-oriented Fortran 2018 HDF5 interface @@ -54,11 +54,6 @@ If HDF5 isn't found, you may need to specify on the command line: * `-Dh5libdir`: HDF5 library directory * `-Dh5incdir`: HDF5 include directory -For MSYS2 this might be like: - -```posh -meson build -Dh5libdir=c:/msys64/mingw64/lib -Dh5incdir=c:/msys64/mingw64/include/static -``` ### CMake diff --git a/cmake/meson.build b/cmake/meson.build index 0f823ba9..f4613097 100644 --- a/cmake/meson.build +++ b/cmake/meson.build @@ -30,6 +30,14 @@ if h5libdir == '' # assume homebrew h5libdir = '/usr/local/opt/hdf5/lib' h5incdir = include_directories('/usr/local/opt/hdf5/include') + elif os == 'windows' + # assume MSYS2 + h5libdir = 'c:/msys64/mingw64/lib' + if get_option('default_library') == 'static' + h5incdir = include_directories('c:/msys64/mingw64/include/static') + else + h5incdir = include_directories('c:/msys64/mingw64/include/shared') + endif else h5libdir = [] endif @@ -45,12 +53,9 @@ foreach name : ['hdf5', 'hdf5_fortran', 'hdf5_hl', 'hdf5_hl_fortran', # msys2 na endif endforeach -if hdf5_libs.length() == 0 - error('could not find HDF5 library') -endif - -hdf5 = hdf5_libs -if not fc.links('use h5lt; end', dependencies: hdf5, include_directories: h5incdir, name: 'HDF5') - warning('HDF5 possible linking problems: ' + h5run.stdout() + h5run.stderr()) +if not fc.links('use h5lt; end', dependencies: hdf5_libs, include_directories: h5incdir, name: 'HDF5') + hdf5 = disabler() +else + hdf5 = declare_dependency(dependencies: hdf5_libs, include_directories: h5incdir) endif diff --git a/meson.build b/meson.build index 31139aa6..808e3e71 100644 --- a/meson.build +++ b/meson.build @@ -10,7 +10,6 @@ subdir('src') ooh5 = library('oohdf5', sources: hdf5_src, dependencies: hdf5, - include_directories: h5incdir, install: true) # --- testing