Skip to content

Commit 0f74c43

Browse files
authored
Merge pull request #145 from mulimoen/fix-hdf5-include-directive
Patch netcdf-c to include correct hdf5
2 parents a77ae80 + 0d16ffb commit 0f74c43

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

netcdf-src/build.rs

+13-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,19 @@ fn main() {
2727
println!("cargo:rerun-if-changed=build.rs");
2828

2929
let hdf5_incdir = std::env::var("DEP_HDF5_INCLUDE").unwrap();
30-
let hdf5_lib = std::env::var("DEP_HDF5_LIBRARY").unwrap();
31-
let hdf5_hl_lib = std::env::var("DEP_HDF5_HL_LIBRARY").unwrap();
30+
let mut hdf5_lib = std::env::var("DEP_HDF5_LIBRARY").unwrap();
31+
let mut hdf5_hl_lib = std::env::var("DEP_HDF5_HL_LIBRARY").unwrap();
32+
33+
#[cfg(unix)]
34+
{
35+
let hdf5_root = format!("{hdf5_incdir}/../");
36+
let mut hdf5_libdir = format!("{hdf5_root}/lib/");
37+
if !std::path::Path::new(&hdf5_libdir).exists() {
38+
hdf5_libdir = format!("{hdf5_root}/lib64/");
39+
}
40+
hdf5_lib = format!("{hdf5_libdir}/{hdf5_lib}.a");
41+
hdf5_hl_lib = format!("{hdf5_libdir}/{hdf5_hl_lib}.a");
42+
}
3243

3344
let hdf5_version = get_hdf5_version();
3445

netcdf-src/source

Submodule source updated 1 file

0 commit comments

Comments
 (0)