Skip to content

Commit a9428ed

Browse files
authored
Merge pull request #95 from mulimoen/feature/hdf5-1.12.0
2 parents 78af557 + cf2eacf commit a9428ed

File tree

14 files changed

+546
-72
lines changed

14 files changed

+546
-72
lines changed

.github/workflows/ci.yml

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,31 @@ jobs:
3535
command: ${{matrix.command}}
3636
args: "${{matrix.command == 'fmt' && '--all -- --check' || '-- -D warnings'}}"
3737

38+
brew:
39+
name: brew
40+
runs-on: macos-latest
41+
strategy:
42+
fail-fast: false
43+
matrix:
44+
include:
45+
- {version: [email protected]}
46+
- {version: [email protected]}
47+
- {version: [email protected]}
48+
- {version: hdf5-mpi, mpi: true}
49+
steps:
50+
- name: Checkout repository
51+
uses: actions/checkout@v2
52+
with: {submodules: true}
53+
- name: Install Rust (${{matrix.rust}})
54+
uses: actions-rs/toolchain@v1
55+
with: {toolchain: stable, profile: minimal, override: true}
56+
- name: Install HDF5 (${{matrix.version}})
57+
run: brew install ${{matrix.version}}
58+
- name: Build and test all crates
59+
run: |
60+
[ "${{matrix.mpi}}" != "" ] && FEATURES=mpio
61+
cargo test -vv --features="$FEATURES"
62+
3863
conda:
3964
name: conda
4065
runs-on: ${{matrix.os}}-latest
@@ -55,6 +80,9 @@ jobs:
5580
- {os: macos, version: 1.10.5, mpi: openmpi, channel: conda-forge, rust: beta}
5681
- {os: ubuntu, version: 1.10.6, channel: anaconda, rust: stable}
5782
- {os: ubuntu, version: 1.10.6, mpi: mpich, channel: conda-forge, rust: nightly}
83+
- {os: ubuntu, version: 1.12.0, mpi: openmpi, channel: conda-forge, rust: stable}
84+
- {os: macos, version: 1.12.0, channel: conda-forge, rust: stable}
85+
- {os: windows, version: 1.12.0, channel: conda-forge, rust: stable}
5886
defaults:
5987
run:
6088
shell: bash -l {0}
@@ -102,26 +130,6 @@ jobs:
102130
- name: Build and test all crates
103131
run: cargo test --workspace -v --features hdf5-sys/static,hdf5-sys/zlib --exclude hdf5-derive
104132

105-
brew:
106-
name: brew
107-
runs-on: macos-latest
108-
strategy:
109-
fail-fast: false
110-
matrix:
111-
version: [1.8, '1.10']
112-
rust: [stable]
113-
steps:
114-
- name: Checkout repository
115-
uses: actions/checkout@v2
116-
with: {submodules: true}
117-
- name: Install Rust (${{matrix.rust}})
118-
uses: actions-rs/toolchain@v1
119-
with: {toolchain: '${{matrix.rust}}', profile: minimal, override: true}
120-
- name: Install HDF5 (${{matrix.version}})
121-
run: brew install hdf5@${{matrix.version}}
122-
- name: Build and test all crates
123-
run: cargo test -v
124-
125133
apt:
126134
name: apt
127135
runs-on: ubuntu-${{matrix.ubuntu}}

hdf5-sys/build.rs

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ impl Version {
2525
}
2626

2727
pub fn parse(s: &str) -> Option<Self> {
28-
let re = Regex::new(r"^(1)\.(8|10)\.(\d\d?)(_\d+)?(-patch\d+)?$").ok()?;
28+
let re = Regex::new(r"^(1)\.(8|10|12)\.(\d\d?)(_\d+)?(-patch\d+)?$").ok()?;
2929
let captures = re.captures(s)?;
3030
Some(Self {
3131
major: captures.get(1).and_then(|c| c.as_str().parse::<u8>().ok())?,
@@ -35,7 +35,10 @@ impl Version {
3535
}
3636

3737
pub fn is_valid(self) -> bool {
38-
self.major == 1 && ((self.minor == 8 && self.micro >= 4) || (self.minor == 10))
38+
self.major == 1
39+
&& ((self.minor == 8 && self.micro >= 4)
40+
|| (self.minor == 10)
41+
|| (self.minor == 12 && self.micro == 0))
3942
}
4043
}
4144

@@ -297,35 +300,55 @@ mod macos {
297300
}
298301
// We have to explicitly support homebrew since the HDF5 bottle isn't
299302
// packaged with pkg-config metadata.
300-
let (v18, v110) = if let Some(version) = config.version {
301-
(version.major == 1 && version.minor == 8, version.major == 1 && version.minor == 10)
303+
let (v18, v110, v112) = if let Some(version) = config.version {
304+
(
305+
version.major == 1 && version.minor == 8,
306+
version.major == 1 && version.minor == 10,
307+
version.major == 1 && version.minor == 12,
308+
)
302309
} else {
303-
(false, false)
310+
(false, false, false)
304311
};
305312
println!(
306313
"Attempting to find HDF5 via Homebrew ({})...",
307314
if v18 {
308315
"1.8.*"
309316
} else if v110 {
310317
"1.10.*"
318+
} else if v112 {
319+
"1.12.*"
311320
} else {
312321
"any version"
313322
}
314323
);
315-
if !v18 {
324+
if !(v18 || v110) {
325+
if let Some(out) = run_command("brew", &["--prefix", "[email protected]"]) {
326+
if is_root_dir(&out) {
327+
config.inc_dir = Some(PathBuf::from(out).join("include"));
328+
}
329+
}
330+
}
331+
if config.inc_dir.is_none() && !v18 {
316332
if let Some(out) = run_command("brew", &["--prefix", "[email protected]"]) {
317333
if is_root_dir(&out) {
318334
config.inc_dir = Some(PathBuf::from(out).join("include"));
319335
}
320336
}
321337
}
322-
if config.inc_dir.is_none() && !v110 {
338+
if config.inc_dir.is_none() {
323339
if let Some(out) = run_command("brew", &["--prefix", "[email protected]"]) {
324340
if is_root_dir(&out) {
325341
config.inc_dir = Some(PathBuf::from(out).join("include"));
326342
}
327343
}
328344
}
345+
if config.inc_dir.is_none() {
346+
if let Some(out) = run_command("brew", &["--prefix", "hdf5-mpi"]) {
347+
if is_root_dir(&out) {
348+
config.inc_dir = Some(PathBuf::from(out).join("include"));
349+
}
350+
}
351+
}
329352
if let Some(ref inc_dir) = config.inc_dir {
330353
println!("Found Homebrew HDF5 headers at:");
331354
println!(" {:?}", inc_dir);
@@ -592,6 +615,7 @@ impl Config {
592615
assert!(version >= Version::new(1, 8, 4), "required HDF5 version: >=1.8.4");
593616
let mut vs: Vec<_> = (5..=21).map(|v| Version::new(1, 8, v)).collect(); // 1.8.[5-21]
594617
vs.extend((0..=5).map(|v| Version::new(1, 10, v))); // 1.10.[0-5]
618+
vs.push(Version::new(1, 12, 0)); // 1.12.0
595619
for v in vs.into_iter().filter(|&v| version >= v) {
596620
println!("cargo:rustc-cfg=hdf5_{}_{}_{}", v.major, v.minor, v.micro);
597621
println!("cargo:version_{}_{}_{}=1", v.major, v.minor, v.micro);

hdf5-sys/src/h5f.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,16 +139,22 @@ extern "C" {
139139
)]
140140
pub fn H5Fset_latest_format(file_id: hid_t, latest_format: hbool_t) -> herr_t;
141141
pub fn H5Fis_hdf5(filename: *const c_char) -> htri_t;
142+
#[cfg(hdf5_1_12_0)]
143+
pub fn H5Fis_accessible(container_name: *const c_char, fapl_id: hid_t) -> htri_t;
142144
pub fn H5Fcreate(
143145
filename: *const c_char, flags: c_uint, create_plist: hid_t, access_plist: hid_t,
144146
) -> hid_t;
145147
pub fn H5Fopen(filename: *const c_char, flags: c_uint, access_plist: hid_t) -> hid_t;
146148
pub fn H5Freopen(file_id: hid_t) -> hid_t;
147149
pub fn H5Fflush(object_id: hid_t, scope: H5F_scope_t) -> herr_t;
148150
pub fn H5Fclose(file_id: hid_t) -> herr_t;
151+
#[cfg(hdf5_1_12_0)]
152+
pub fn H5Fdelete(filename: *const c_char, fapl_id: hid_t) -> herr_t;
149153
pub fn H5Fget_create_plist(file_id: hid_t) -> hid_t;
150154
pub fn H5Fget_access_plist(file_id: hid_t) -> hid_t;
151155
pub fn H5Fget_intent(file_id: hid_t, intent: *mut c_uint) -> herr_t;
156+
#[cfg(hdf5_1_12_0)]
157+
pub fn H5Fget_fileno(file_id: hid_t, fileno: *mut c_ulong) -> herr_t;
152158
pub fn H5Fget_obj_count(file_id: hid_t, types: c_uint) -> ssize_t;
153159
pub fn H5Fget_obj_ids(
154160
file_id: hid_t, types: c_uint, max_objs: size_t, obj_id_list: *mut hid_t,

hdf5-sys/src/h5i.rs

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,27 @@ pub enum H5I_type_t {
88
H5I_UNINIT = -2,
99
H5I_BADID = -1,
1010
H5I_FILE = 1,
11-
H5I_GROUP = 2,
12-
H5I_DATATYPE = 3,
13-
H5I_DATASPACE = 4,
14-
H5I_DATASET = 5,
15-
H5I_ATTR = 6,
11+
H5I_GROUP,
12+
H5I_DATATYPE,
13+
H5I_DATASPACE,
14+
H5I_DATASET,
15+
#[cfg(hdf5_1_12_0)]
16+
H5I_MAP,
17+
H5I_ATTR,
18+
#[cfg(not(hdf5_1_12_0))]
1619
#[cfg_attr(hdf5_1_10_2, deprecated(note = "deprecated in HDF5 1.10.2"))]
17-
H5I_REFERENCE = 7,
18-
H5I_VFL = 8,
19-
H5I_GENPROP_CLS = 9,
20-
H5I_GENPROP_LST = 10,
21-
H5I_ERROR_CLASS = 11,
22-
H5I_ERROR_MSG = 12,
23-
H5I_ERROR_STACK = 13,
24-
H5I_NTYPES = 14,
20+
H5I_REFERENCE,
21+
H5I_VFL,
22+
#[cfg(hdf5_1_12_0)]
23+
H5I_VOL,
24+
H5I_GENPROP_CLS,
25+
H5I_GENPROP_LST,
26+
H5I_ERROR_CLASS,
27+
H5I_ERROR_MSG,
28+
H5I_ERROR_STACK,
29+
#[cfg(hdf5_1_12_0)]
30+
H5I_SPACE_SEL_ITER,
31+
H5I_NTYPES,
2532
}
2633

2734
#[cfg(hdf5_1_10_0)]
@@ -35,6 +42,8 @@ pub const H5I_INVALID_HID: hid_t = -1;
3542
pub type H5I_free_t = Option<extern "C" fn(arg1: *mut c_void) -> herr_t>;
3643
pub type H5I_search_func_t =
3744
Option<extern "C" fn(obj: *mut c_void, id: hid_t, key: *mut c_void) -> c_int>;
45+
#[cfg(hdf5_1_12_0)]
46+
pub type H5I_iterate_func_t = Option<extern "C" fn(id: hid_t, udata: *mut c_void) -> herr_t>;
3847

3948
extern "C" {
4049
pub fn H5Iregister(type_: H5I_type_t, object: *const c_void) -> hid_t;
@@ -55,6 +64,8 @@ extern "C" {
5564
pub fn H5Idec_type_ref(type_: H5I_type_t) -> c_int;
5665
pub fn H5Iget_type_ref(type_: H5I_type_t) -> c_int;
5766
pub fn H5Isearch(type_: H5I_type_t, func: H5I_search_func_t, key: *mut c_void) -> *mut c_void;
67+
#[cfg(hdf5_1_12_0)]
68+
pub fn H5Iiterate(type_: H5I_type_t, op: H5I_iterate_func_t, op_data: *mut c_void) -> herr_t;
5869
pub fn H5Inmembers(type_: H5I_type_t, num_members: *mut hsize_t) -> herr_t;
5970
pub fn H5Itype_exists(type_: H5I_type_t) -> htri_t;
6071
pub fn H5Iis_valid(id: hid_t) -> htri_t;

0 commit comments

Comments
 (0)