diff --git a/netcdf-src/build.rs b/netcdf-src/build.rs index 1d48035..d979a1c 100644 --- a/netcdf-src/build.rs +++ b/netcdf-src/build.rs @@ -27,8 +27,19 @@ fn main() { println!("cargo:rerun-if-changed=build.rs"); let hdf5_incdir = std::env::var("DEP_HDF5_INCLUDE").unwrap(); - let hdf5_lib = std::env::var("DEP_HDF5_LIBRARY").unwrap(); - let hdf5_hl_lib = std::env::var("DEP_HDF5_HL_LIBRARY").unwrap(); + let mut hdf5_lib = std::env::var("DEP_HDF5_LIBRARY").unwrap(); + let mut hdf5_hl_lib = std::env::var("DEP_HDF5_HL_LIBRARY").unwrap(); + + #[cfg(unix)] + { + let hdf5_root = format!("{hdf5_incdir}/../"); + let mut hdf5_libdir = format!("{hdf5_root}/lib/"); + if !std::path::Path::new(&hdf5_libdir).exists() { + hdf5_libdir = format!("{hdf5_root}/lib64/"); + } + hdf5_lib = format!("{hdf5_libdir}/{hdf5_lib}.a"); + hdf5_hl_lib = format!("{hdf5_libdir}/{hdf5_hl_lib}.a"); + } let hdf5_version = get_hdf5_version(); diff --git a/netcdf-src/source b/netcdf-src/source index cbf1282..230ffaf 160000 --- a/netcdf-src/source +++ b/netcdf-src/source @@ -1 +1 @@ -Subproject commit cbf128203297f5a990f37b8c28f45455292d5e7b +Subproject commit 230ffaf4eb8534a3b8fac3eb4be8e88cf6d61ccd