Skip to content

Commit 3c3db07

Browse files
committed
Merge remote-tracking branch 'mulimoen/feature/static-multi-versions'
2 parents 268cd29 + 571ca1b commit 3c3db07

File tree

25 files changed

+117
-80
lines changed

25 files changed

+117
-80
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
include:
5959
- {version: hdf5@1.8}
6060
- {version: hdf5@1.10}
61-
- {version: hdf5@1.12}
61+
# - {version: hdf5@1.12}
6262
- {version: hdf5-mpi, mpi: true}
6363
steps:
6464
- name: Checkout repository
@@ -132,10 +132,10 @@ jobs:
132132
fail-fast: false
133133
matrix:
134134
include:
135-
- {os: ubuntu, rust: stable}
136-
- {os: windows, rust: stable-msvc}
137-
- {os: windows, rust: stable-gnu}
138-
- {os: macos, rust: stable}
135+
- {os: ubuntu, rust: stable, h5version: 1_13}
136+
- {os: windows, rust: stable-msvc, h5version: 1_12}
137+
- {os: windows, rust: stable-gnu, h5version: 1_10}
138+
- {os: macos, rust: stable, h5version: 1_10}
139139
steps:
140140
- name: Checkout repository
141141
uses: actions/checkout@v2
@@ -144,9 +144,9 @@ jobs:
144144
uses: actions-rs/toolchain@v1
145145
with: {toolchain: '${{matrix.rust}}', profile: minimal, override: true}
146146
- name: Build and test all crates
147-
run: cargo test --workspace -v --features hdf5-sys/static,hdf5-sys/zlib --exclude hdf5-derive
147+
run: cargo test --workspace -v --features hdf5-sys/static,hdf5-sys/zlib,hdf5-src/${{matrix.h5version}} --exclude hdf5-derive
148148
- name: Build and test with filters
149-
run: cargo test --workspace -v --features hdf5-sys/static,hdf5-sys/zlib,lzf,blosc --exclude hdf5-derive
149+
run: cargo test --workspace -v --features hdf5-sys/static,hdf5-sys/zlib,lzf,blosc,hdf5-src/${{matrix.h5version}} --exclude hdf5-derive
150150
if: matrix.rust != 'stable-gnu'
151151
- name: Run examples
152152
run: |

.gitmodules

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1-
[submodule "hdf5"]
2-
path = hdf5-src/ext/hdf5
1+
[submodule "hdf5-src/ext/1_13_0"]
2+
path = hdf5-src/ext/1_13
3+
url = https://github.com/HDFGroup/hdf5.git
4+
[submodule "hdf5-src/ext/1_12_0"]
5+
path = hdf5-src/ext/1_12
6+
url = https://github.com/HDFGroup/hdf5.git
7+
[submodule "hdf5-src/ext/1_10_0"]
8+
path = hdf5-src/ext/1_10
39
url = https://github.com/HDFGroup/hdf5.git

hdf5-src/Cargo.toml

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "hdf5-src"
33
version = "0.8.1" # !V
44
authors = ["Ivan Smirnov <i.s.smirnov@gmail.com>"]
55
keywords = ["hdf5"]
6-
license-file = "ext/hdf5/COPYING"
6+
license-file = "ext/1_13/COPYING"
77
build = "build.rs"
88
repository = "https://github.com/aldanor/hdf5-rust"
99
homepage = "https://github.com/aldanor/hdf5-rust"
@@ -13,25 +13,36 @@ links = "hdf5src"
1313
readme = "README.md"
1414
categories = ["ffi"]
1515
exclude = [
16-
"ext/hdf5/bin/**",
17-
"ext/hdf5/c++/**",
18-
"ext/hdf5/examples/**",
19-
"ext/hdf5/fortran/**",
20-
"ext/hdf5/java/**",
21-
"ext/hdf5/release_docs/**",
22-
"ext/hdf5/test/**",
23-
"ext/hdf5/testpar/**",
24-
"ext/hdf5/tools/**",
25-
"ext/hdf5/hl/test/**",
26-
"ext/hdf5/hl/tools/**",
27-
"ext/hdf5/hl/examples/**",
16+
"ext/*/bin/**",
17+
"ext/*/c++/**",
18+
"ext/*/examples/**",
19+
"ext/*/fortran/**",
20+
"ext/*/java/**",
21+
"ext/*/release_docs/**",
22+
"ext/*/test/**",
23+
"ext/*/testpar/**",
24+
"ext/*/tools/**",
25+
"ext/*/m4/**",
26+
"ext/*/configure",
27+
"ext/*/MANIFEST",
28+
"ext/*/hl/test/**",
29+
"ext/*/hl/tools/**",
30+
"ext/*/hl/examples/**",
31+
"ext/*/hl/fortran/**",
32+
"ext/*/hl/c++/**",
33+
"ext/*/oxygen/**",
34+
"ext/*/doxygen/**",
35+
"ext/*/config/cmake_ext_mod/hdf.icns",
2836
]
2937

3038
[features]
3139
hl = []
3240
zlib = ["libz-sys"]
3341
deprecated = []
3442
threadsafe = []
43+
1_10 = []
44+
1_12 = []
45+
1_13 = []
3546

3647
[dependencies]
3748
libz-sys = { version = "1.0.25", features = ["static"], optional = true, default-features=false }

hdf5-src/build.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,15 @@ fn feature_enabled(feature: &str) -> bool {
66

77
fn main() {
88
println!("cargo:rerun-if-changed=build.rs");
9-
let mut cfg = cmake::Config::new("ext/hdf5");
9+
let mut cfg = if feature_enabled("1_13") {
10+
cmake::Config::new("ext/1_13")
11+
} else if feature_enabled("1_12") {
12+
cmake::Config::new("ext/1_12")
13+
} else if feature_enabled("1_10") {
14+
cmake::Config::new("ext/1_10")
15+
} else {
16+
cmake::Config::new("ext/1_10")
17+
};
1018

1119
// only build the static c library, disable everything else
1220
cfg.define("HDF5_NO_PACKAGES", "ON");
Submodule 1_10 updated from 0000000 to db30c2d

hdf5-src/ext/1_12

Submodule 1_12 added at 820695a

hdf5-src/ext/1_13

Submodule 1_13 added at 338c2c6

src/class.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::fmt;
22
use std::mem;
3-
use std::ptr;
3+
use std::ptr::{self, addr_of};
44

55
use crate::internal_prelude::*;
66

@@ -53,7 +53,7 @@ pub trait ObjectClass: Sized {
5353
unsafe fn cast_unchecked<T: ObjectClass>(self) -> T {
5454
// This method requires you to be 18 years or older to use it
5555
// (note: if it wasn't a trait method, it could be marked as const)
56-
let obj = ptr::read((&self as *const Self).cast());
56+
let obj = ptr::read(addr_of!(self).cast());
5757
mem::forget(self);
5858
obj
5959
}

src/dim.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ macro_rules! impl_tuple {
7272
#[inline]
7373
fn dims(&self) -> Vec<Ix> {
7474
unsafe {
75-
slice::from_raw_parts(self as *const _ as *const _, self.ndim())
75+
slice::from_raw_parts((self as *const Self).cast(), self.ndim())
7676
}.iter().cloned().collect()
7777
}
7878
}

src/error.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::error::Error as StdError;
33
use std::fmt;
44
use std::ops::Deref;
55
use std::panic;
6-
use std::ptr;
6+
use std::ptr::{self, addr_of_mut};
77

88
use ndarray::ShapeError;
99

@@ -95,7 +95,7 @@ impl ErrorStack {
9595
}
9696

9797
let mut data = CallbackData { stack: ExpandedErrorStack::new(), err: None };
98-
let data_ptr: *mut c_void = (&mut data as *mut CallbackData).cast::<c_void>();
98+
let data_ptr: *mut c_void = addr_of_mut!(data).cast::<c_void>();
9999

100100
let stack_id = self.handle().id();
101101
h5lock!({

0 commit comments

Comments
 (0)