Skip to content

Commit 0d7e7ef

Browse files
authored
Merge pull request #40 from jneuff/default-hdf-location-fedora
Find the default HDF5 location in Fedora Linux
2 parents 76b239a + 7da7db9 commit 0d7e7ef

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

hdf5-sys/build.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ fn run_command(cmd: &str, args: &[&str]) -> Option<String> {
6060
#[allow(dead_code)]
6161
fn is_inc_dir<P: AsRef<Path>>(path: P) -> bool {
6262
path.as_ref().join("H5pubconf.h").is_file()
63+
|| path.as_ref().join("H5pubconf-64.h").is_file()
6364
}
6465

6566
#[allow(dead_code)]
@@ -166,7 +167,8 @@ pub struct Header {
166167
impl Header {
167168
pub fn parse<P: AsRef<Path>>(inc_dir: P) -> Self {
168169
let inc_dir = inc_dir.as_ref();
169-
let header = inc_dir.join("H5pubconf.h");
170+
171+
let header = get_conf_header(inc_dir);
170172
println!("Parsing HDF5 config from:\n {:?}", header);
171173

172174
let contents = fs::read_to_string(header).unwrap();
@@ -207,6 +209,18 @@ impl Header {
207209
}
208210
}
209211

212+
fn get_conf_header<P: AsRef<Path>>(inc_dir: P) -> PathBuf {
213+
let inc_dir = inc_dir.as_ref();
214+
215+
if inc_dir.join("H5pubconf.h").is_file() {
216+
inc_dir.join("H5pubconf.h")
217+
} else if inc_dir.join("H5pubconf-64.h").is_file() {
218+
inc_dir.join("H5pubconf-64.h")
219+
} else {
220+
panic!("H5pubconf header not found in include directory");
221+
}
222+
}
223+
210224
#[derive(Clone, Debug, Default)]
211225
pub struct LibrarySearcher {
212226
pub version: Option<Version>,
@@ -262,6 +276,7 @@ mod unix {
262276
for (inc_dir, lib_dir) in &[
263277
("/usr/include/hdf5/serial", "/usr/lib/x86_64-linux-gnu/hdf5/serial"),
264278
("/usr/include", "/usr/lib/x86_64-linux-gnu"),
279+
("/usr/include", "/usr/lib64"),
265280
] {
266281
if is_inc_dir(inc_dir) {
267282
println!("Found HDF5 headers at:\n {:?}", inc_dir);

0 commit comments

Comments
 (0)