From 87989586a489d951a267d6740df3f1faadaaff94 Mon Sep 17 00:00:00 2001 From: Magnus Ulimoen Date: Wed, 23 Mar 2022 17:54:47 +0100 Subject: [PATCH 01/14] Add source options for multiple hdf5 version --- .gitmodules | 10 ++++++++-- hdf5-src/Cargo.toml | 37 ++++++++++++++++++++++++------------- hdf5-src/build.rs | 10 +++++++++- hdf5-src/ext/{hdf5 => 1_10} | 0 hdf5-src/ext/1_12 | 1 + hdf5-src/ext/1_13 | 1 + 6 files changed, 43 insertions(+), 16 deletions(-) rename hdf5-src/ext/{hdf5 => 1_10} (100%) create mode 160000 hdf5-src/ext/1_12 create mode 160000 hdf5-src/ext/1_13 diff --git a/.gitmodules b/.gitmodules index 0edcd7721..49f7248ba 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,9 @@ -[submodule "hdf5"] - path = hdf5-src/ext/hdf5 +[submodule "hdf5-src/ext/1_13_0"] + path = hdf5-src/ext/1_13 + url = https://github.com/HDFGroup/hdf5.git +[submodule "hdf5-src/ext/1_12_0"] + path = hdf5-src/ext/1_12 + url = https://github.com/HDFGroup/hdf5.git +[submodule "hdf5-src/ext/1_10_0"] + path = hdf5-src/ext/1_10 url = https://github.com/HDFGroup/hdf5.git diff --git a/hdf5-src/Cargo.toml b/hdf5-src/Cargo.toml index a773fdaf7..3b5d02814 100644 --- a/hdf5-src/Cargo.toml +++ b/hdf5-src/Cargo.toml @@ -3,7 +3,7 @@ name = "hdf5-src" version = "0.8.1" # !V authors = ["Ivan Smirnov "] keywords = ["hdf5"] -license-file = "ext/hdf5/COPYING" +license-file = "ext/1_13/COPYING" build = "build.rs" repository = "https://github.com/aldanor/hdf5-rust" homepage = "https://github.com/aldanor/hdf5-rust" @@ -13,18 +13,26 @@ links = "hdf5src" readme = "README.md" categories = ["ffi"] exclude = [ - "ext/hdf5/bin/**", - "ext/hdf5/c++/**", - "ext/hdf5/examples/**", - "ext/hdf5/fortran/**", - "ext/hdf5/java/**", - "ext/hdf5/release_docs/**", - "ext/hdf5/test/**", - "ext/hdf5/testpar/**", - "ext/hdf5/tools/**", - "ext/hdf5/hl/test/**", - "ext/hdf5/hl/tools/**", - "ext/hdf5/hl/examples/**", + "ext/*/bin/**", + "ext/*/c++/**", + "ext/*/examples/**", + "ext/*/fortran/**", + "ext/*/java/**", + "ext/*/release_docs/**", + "ext/*/test/**", + "ext/*/testpar/**", + "ext/*/tools/**", + "ext/*/m4/**", + "ext/*/configure", + "ext/*/MANIFEST", + "ext/*/hl/test/**", + "ext/*/hl/tools/**", + "ext/*/hl/examples/**", + "ext/*/hl/fortran/**", + "ext/*/hl/c++/**", + "ext/*/oxygen/**", + "ext/*/doxygen/**", + "ext/*/config/cmake_ext_mod/hdf.icns", ] [features] @@ -32,6 +40,9 @@ hl = [] zlib = ["libz-sys"] deprecated = [] threadsafe = [] +1_10 = [] +1_12 = [] +1_13 = [] [dependencies] libz-sys = { version = "1.0.25", features = ["static", "libc"], optional = true, default-features=false } diff --git a/hdf5-src/build.rs b/hdf5-src/build.rs index 86d5d60f1..cdbc90cf3 100644 --- a/hdf5-src/build.rs +++ b/hdf5-src/build.rs @@ -6,7 +6,15 @@ fn feature_enabled(feature: &str) -> bool { fn main() { println!("cargo:rerun-if-changed=build.rs"); - let mut cfg = cmake::Config::new("ext/hdf5"); + let mut cfg = if feature_enabled("1_13") { + cmake::Config::new("ext/1_13") + } else if feature_enabled("1_12") { + cmake::Config::new("ext/1_12") + } else if feature_enabled("1_10") { + cmake::Config::new("ext/1_10") + } else { + cmake::Config::new("ext/1_10") + }; // only build the static c library, disable everything else cfg.define("HDF5_NO_PACKAGES", "ON"); diff --git a/hdf5-src/ext/hdf5 b/hdf5-src/ext/1_10 similarity index 100% rename from hdf5-src/ext/hdf5 rename to hdf5-src/ext/1_10 diff --git a/hdf5-src/ext/1_12 b/hdf5-src/ext/1_12 new file mode 160000 index 000000000..820695a78 --- /dev/null +++ b/hdf5-src/ext/1_12 @@ -0,0 +1 @@ +Subproject commit 820695a78e3a277daea1bdcbb8ad54b8ee6650a5 diff --git a/hdf5-src/ext/1_13 b/hdf5-src/ext/1_13 new file mode 160000 index 000000000..338c2c6cd --- /dev/null +++ b/hdf5-src/ext/1_13 @@ -0,0 +1 @@ +Subproject commit 338c2c6cd4bfb9d3001668ef74db178f10fe0abd From 80e268c01e753e7559817c32968cb18886f1cc98 Mon Sep 17 00:00:00 2001 From: Magnus Ulimoen Date: Wed, 23 Mar 2022 19:00:07 +0100 Subject: [PATCH 02/14] Add to CI --- .github/workflows/ci.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 88a72e462..2e4dc36b4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,7 +58,7 @@ jobs: include: - {version: hdf5@1.8} - {version: hdf5@1.10} - - {version: hdf5@1.12} + - {version: hdf5@1.13} - {version: hdf5-mpi, mpi: true} steps: - name: Checkout repository @@ -132,10 +132,10 @@ jobs: fail-fast: false matrix: include: - - {os: ubuntu, rust: stable} - - {os: windows, rust: stable-msvc} - - {os: windows, rust: stable-gnu} - - {os: macos, rust: stable} + - {os: ubuntu, rust: stable, h5version: 1_13} + - {os: windows, rust: stable-msvc, h5version: 1_12} + - {os: windows, rust: stable-gnu, h5version: 1_10} + - {os: macos, rust: stable, h5version: 1_10} steps: - name: Checkout repository uses: actions/checkout@v2 @@ -144,9 +144,9 @@ jobs: uses: actions-rs/toolchain@v1 with: {toolchain: '${{matrix.rust}}', profile: minimal, override: true} - name: Build and test all crates - run: cargo test --workspace -v --features hdf5-sys/static,hdf5-sys/zlib --exclude hdf5-derive + run: cargo test --workspace -v --features hdf5-sys/static,hdf5-sys/zlib,hdf5-src/${{matrix.h5version}} --exclude hdf5-derive - name: Build and test with filters - run: cargo test --workspace -v --features hdf5-sys/static,hdf5-sys/zlib,lzf,blosc --exclude hdf5-derive + run: cargo test --workspace -v --features hdf5-sys/static,hdf5-sys/zlib,lzf,blosc,hdf5-src/${{matrix.h5version}} --exclude hdf5-derive if: matrix.rust != 'stable-gnu' - name: Run examples run: | From c56091d780ea88c4d166b263e911e0d50701c8c9 Mon Sep 17 00:00:00 2001 From: Magnus Ulimoen Date: Wed, 6 Apr 2022 22:24:40 +0200 Subject: [PATCH 03/14] Skip brew hdf5@1.13/1.12 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2e4dc36b4..2f1ff60fd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,7 +58,7 @@ jobs: include: - {version: hdf5@1.8} - {version: hdf5@1.10} - - {version: hdf5@1.13} + # - {version: hdf5@1.12} - {version: hdf5-mpi, mpi: true} steps: - name: Checkout repository From 42fcdee9f6347a0949354ba6afb36b133f6e8c90 Mon Sep 17 00:00:00 2001 From: Magnus Ulimoen Date: Thu, 12 May 2022 18:27:55 +0200 Subject: [PATCH 04/14] Output hdf5 version in build script --- hdf5-sys/build.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hdf5-sys/build.rs b/hdf5-sys/build.rs index 13d73b189..056f154d2 100644 --- a/hdf5-sys/build.rs +++ b/hdf5-sys/build.rs @@ -604,6 +604,9 @@ impl Config { if feature_enabled("HL") { println!("cargo:hl_library=hdf5_hl"); } + + let version = self.header.version; + println!("cargo:h5version={}.{}.{}", version.major, version.minor, version.micro); } pub fn emit_cfg_flags(&self) { From 5ce92ff737d8027ca03858de4732ad94cbe009ad Mon Sep 17 00:00:00 2001 From: Magnus Ulimoen Date: Mon, 16 Jan 2023 21:44:16 +0100 Subject: [PATCH 05/14] Replace 1.13 with 1.14 --- .github/workflows/ci.yml | 10 +++++----- .gitmodules | 6 +++--- hdf5-src/Cargo.toml | 2 +- hdf5-src/build.rs | 5 +++-- hdf5-src/ext/1_13 | 1 - hdf5-src/ext/1_14 | 1 + 6 files changed, 13 insertions(+), 12 deletions(-) delete mode 160000 hdf5-src/ext/1_13 create mode 160000 hdf5-src/ext/1_14 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2f1ff60fd..c1b7f4e12 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -132,7 +132,7 @@ jobs: fail-fast: false matrix: include: - - {os: ubuntu, rust: stable, h5version: 1_13} + - {os: ubuntu, rust: stable, h5version: 1_14} - {os: windows, rust: stable-msvc, h5version: 1_12} - {os: windows, rust: stable-gnu, h5version: 1_10} - {os: macos, rust: stable, h5version: 1_10} @@ -194,7 +194,7 @@ jobs: fail-fast: false matrix: rust: [stable] - version: ["1.8", "1.10", "1.12", "1.13"] + version: ["1.8", "1.10", "1.12", "1.14"] steps: - name: Checkout repository uses: actions/checkout@v2 @@ -218,9 +218,9 @@ jobs: DL_PATH=hdf5-1.12.0-Std-win10_64-vs16.zip echo "MSI_PATH=hdf\\HDF5-1.12.0-win64.msi" >> $GITHUB_ENV else - VERSION=1.13.2 - DL_PATH=windows/hdf5-1.13.2-Std-win10_64-vs16.zip - echo "MSI_PATH=hdf\\HDF5-1.13.2-win64.msi" >> $GITHUB_ENV + VERSION=1.14.0 + DL_PATH=windows/hdf5-1.14.0-Std-win10_64-vs16.zip + echo "MSI_PATH=hdf\\HDF5-1.14.0-win64.msi" >> $GITHUB_ENV fi BASE_URL=https://support.hdfgroup.org/ftp/HDF5/releases echo "DL_URL=$BASE_URL/hdf5-${{matrix.version}}/hdf5-$VERSION/bin/$DL_PATH" >> $GITHUB_ENV diff --git a/.gitmodules b/.gitmodules index 49f7248ba..d1df8a64b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,9 +1,9 @@ -[submodule "hdf5-src/ext/1_13_0"] - path = hdf5-src/ext/1_13 - url = https://github.com/HDFGroup/hdf5.git [submodule "hdf5-src/ext/1_12_0"] path = hdf5-src/ext/1_12 url = https://github.com/HDFGroup/hdf5.git [submodule "hdf5-src/ext/1_10_0"] path = hdf5-src/ext/1_10 url = https://github.com/HDFGroup/hdf5.git +[submodule "hdf5-src/ext/1_14"] + path = hdf5-src/ext/1_14 + url = https://github.com/HDFGroup/hdf5.git diff --git a/hdf5-src/Cargo.toml b/hdf5-src/Cargo.toml index 3b5d02814..632908151 100644 --- a/hdf5-src/Cargo.toml +++ b/hdf5-src/Cargo.toml @@ -42,7 +42,7 @@ deprecated = [] threadsafe = [] 1_10 = [] 1_12 = [] -1_13 = [] +1_14 = [] [dependencies] libz-sys = { version = "1.0.25", features = ["static", "libc"], optional = true, default-features=false } diff --git a/hdf5-src/build.rs b/hdf5-src/build.rs index cdbc90cf3..58201f627 100644 --- a/hdf5-src/build.rs +++ b/hdf5-src/build.rs @@ -6,8 +6,8 @@ fn feature_enabled(feature: &str) -> bool { fn main() { println!("cargo:rerun-if-changed=build.rs"); - let mut cfg = if feature_enabled("1_13") { - cmake::Config::new("ext/1_13") + let mut cfg = if feature_enabled("1_14") { + cmake::Config::new("ext/1_14") } else if feature_enabled("1_12") { cmake::Config::new("ext/1_12") } else if feature_enabled("1_10") { @@ -31,6 +31,7 @@ fn main() { ] { cfg.define(option, "OFF"); } + cfg.define("DEFAULT_API_VERSION", "none"); // disable these by default, can be enabled via features for option in &[ diff --git a/hdf5-src/ext/1_13 b/hdf5-src/ext/1_13 deleted file mode 160000 index 338c2c6cd..000000000 --- a/hdf5-src/ext/1_13 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 338c2c6cd4bfb9d3001668ef74db178f10fe0abd diff --git a/hdf5-src/ext/1_14 b/hdf5-src/ext/1_14 new file mode 160000 index 000000000..0553fb7ac --- /dev/null +++ b/hdf5-src/ext/1_14 @@ -0,0 +1 @@ +Subproject commit 0553fb7ac7f03a919c91cdbbd5648b8aadbe05af From f031764191dcfb935bdc037594b691883d13bb1c Mon Sep 17 00:00:00 2001 From: Magnus Ulimoen Date: Mon, 16 Jan 2023 21:50:00 +0100 Subject: [PATCH 06/14] Add to changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cecdb32ab..748f11e6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,9 @@ - The `H5Type` derive macro now uses `proc-macro-error` to emit error messages. - MSRV is now `1.54` following a bump in a dependency. +- `hdf5-src` can now be built from several versions of `hdf5` using compile-time + flags. Enable this using the features `1_14`, `1_12`, or `1_10` of `hdf5-src`. + More recent versions take priority if multiple versions has been selected. ### Fixed From 11b85ec59aa460b5ddec6b562c889e516045b53b Mon Sep 17 00:00:00 2001 From: Alan Race Date: Tue, 7 Mar 2023 09:04:34 +0100 Subject: [PATCH 07/14] Enable `T` in `VarLenArray` to also contain a `VarLenArray` --- hdf5-src/ext/hdf5 | 2 +- hdf5-types/src/array.rs | 30 +++++++++++++++--------------- hdf5-types/src/h5type.rs | 2 +- src/lib.rs | 6 +++++- src/macros.rs | 1 + 5 files changed, 23 insertions(+), 18 deletions(-) diff --git a/hdf5-src/ext/hdf5 b/hdf5-src/ext/hdf5 index db30c2da6..83f81a642 160000 --- a/hdf5-src/ext/hdf5 +++ b/hdf5-src/ext/hdf5 @@ -1 +1 @@ -Subproject commit db30c2da68ece4a155e9e50c28ec16d6057509b2 +Subproject commit 83f81a64222e61c8cc25e48ccefa700631006aab diff --git a/hdf5-types/src/array.rs b/hdf5-types/src/array.rs index f5b8956c5..50cc70ed2 100644 --- a/hdf5-types/src/array.rs +++ b/hdf5-types/src/array.rs @@ -6,13 +6,13 @@ use std::ptr; use std::slice; #[repr(C)] -pub struct VarLenArray { +pub struct VarLenArray { len: usize, ptr: *const T, tag: PhantomData, } -impl VarLenArray { +impl VarLenArray { pub unsafe fn from_parts(p: *const T, len: usize) -> Self { let (len, ptr) = if !p.is_null() && len != 0 { let dst = crate::malloc(len * mem::size_of::()); @@ -50,7 +50,7 @@ impl VarLenArray { } } -impl Drop for VarLenArray { +impl Drop for VarLenArray { fn drop(&mut self) { if !self.ptr.is_null() { unsafe { @@ -64,14 +64,14 @@ impl Drop for VarLenArray { } } -impl Clone for VarLenArray { +impl Clone for VarLenArray { #[inline] fn clone(&self) -> Self { Self::from_slice(self) } } -impl Deref for VarLenArray { +impl Deref for VarLenArray { type Target = [T]; #[inline] @@ -84,58 +84,58 @@ impl Deref for VarLenArray { } } -impl<'a, T: Copy> From<&'a [T]> for VarLenArray { +impl<'a, T: Clone> From<&'a [T]> for VarLenArray { #[inline] fn from(arr: &[T]) -> Self { Self::from_slice(arr) } } -impl From> for Vec { +impl From> for Vec { #[inline] fn from(v: VarLenArray) -> Self { - v.iter().copied().collect() + v.iter().cloned().collect() } } -impl From<[T; N]> for VarLenArray { +impl From<[T; N]> for VarLenArray { #[inline] fn from(arr: [T; N]) -> Self { unsafe { Self::from_parts(arr.as_ptr(), arr.len()) } } } -impl Default for VarLenArray { +impl Default for VarLenArray { #[inline] fn default() -> Self { unsafe { Self::from_parts(ptr::null(), 0) } } } -impl PartialEq for VarLenArray { +impl PartialEq for VarLenArray { #[inline] fn eq(&self, other: &Self) -> bool { self.as_slice() == other.as_slice() } } -impl Eq for VarLenArray {} +impl Eq for VarLenArray {} -impl PartialEq<[T]> for VarLenArray { +impl PartialEq<[T]> for VarLenArray { #[inline] fn eq(&self, other: &[T]) -> bool { self.as_slice() == other } } -impl PartialEq<[T; N]> for VarLenArray { +impl PartialEq<[T; N]> for VarLenArray { #[inline] fn eq(&self, other: &[T; N]) -> bool { self.as_slice() == other } } -impl fmt::Debug for VarLenArray { +impl fmt::Debug for VarLenArray { #[inline] fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.as_slice().fmt(f) diff --git a/hdf5-types/src/h5type.rs b/hdf5-types/src/h5type.rs index 7f50dc12a..7b6f0d417 100644 --- a/hdf5-types/src/h5type.rs +++ b/hdf5-types/src/h5type.rs @@ -330,7 +330,7 @@ unsafe impl H5Type for [T; N] { } } -unsafe impl H5Type for VarLenArray { +unsafe impl H5Type for VarLenArray { #[inline] fn type_descriptor() -> TypeDescriptor { TypeDescriptor::VarLenArray(Box::new(::type_descriptor())) diff --git a/src/lib.rs b/src/lib.rs index 587b0539c..169e97bdb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -69,6 +69,10 @@ mod export { #[doc(hidden)] pub use crate::error::h5check; + pub mod macros { + pub use crate::macros::*; + } + pub use hdf5_derive::H5Type; pub use hdf5_types::H5Type; @@ -137,7 +141,7 @@ pub mod globals; mod handle; #[doc(hidden)] pub mod sync; -mod util; +pub mod util; mod hl; diff --git a/src/macros.rs b/src/macros.rs index 3f23fe972..513922e81 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -169,6 +169,7 @@ impl_h5get!(a: A, b: B); impl_h5get!(a: A, b: B, c: C); impl_h5get!(a: A, b: B, c: C, d: D); +#[macro_export] macro_rules! h5err { ($msg:expr, $major:expr, $minor:expr) => { let line = line!(); From cf43aa2ca9748ea2bcd098344f3456dc82d03fc9 Mon Sep 17 00:00:00 2001 From: Alan Race Date: Tue, 2 May 2023 11:25:24 +0200 Subject: [PATCH 08/14] Now tracking 1.12 branch --- .gitmodules | 6 +++--- hdf5-src/ext/1_12 | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitmodules b/.gitmodules index d1df8a64b..a4559d4d1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,9 +1,9 @@ +[submodule "hdf5-src/ext/1_10"] + path = hdf5-src/ext/1_10 + url = https://github.com/HDFGroup/hdf5.git [submodule "hdf5-src/ext/1_12_0"] path = hdf5-src/ext/1_12 url = https://github.com/HDFGroup/hdf5.git -[submodule "hdf5-src/ext/1_10_0"] - path = hdf5-src/ext/1_10 - url = https://github.com/HDFGroup/hdf5.git [submodule "hdf5-src/ext/1_14"] path = hdf5-src/ext/1_14 url = https://github.com/HDFGroup/hdf5.git diff --git a/hdf5-src/ext/1_12 b/hdf5-src/ext/1_12 index 820695a78..6bd9f7806 160000 --- a/hdf5-src/ext/1_12 +++ b/hdf5-src/ext/1_12 @@ -1 +1 @@ -Subproject commit 820695a78e3a277daea1bdcbb8ad54b8ee6650a5 +Subproject commit 6bd9f780620bc221b9a9521eca736e1a762844d0 From 1eaf47ce793562a65418cc10a8aed8aa4506ebc0 Mon Sep 17 00:00:00 2001 From: Alan Race Date: Tue, 2 May 2023 11:37:05 +0200 Subject: [PATCH 09/14] Enabling versions 1.12.2 and 1.12.3 --- hdf5-sys/build.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hdf5-sys/build.rs b/hdf5-sys/build.rs index 056f154d2..35c9fc2c2 100644 --- a/hdf5-sys/build.rs +++ b/hdf5-sys/build.rs @@ -614,7 +614,7 @@ impl Config { assert!(version >= Version::new(1, 8, 4), "required HDF5 version: >=1.8.4"); let mut vs: Vec<_> = (5..=21).map(|v| Version::new(1, 8, v)).collect(); // 1.8.[5-21] vs.extend((0..=8).map(|v| Version::new(1, 10, v))); // 1.10.[0-8] - vs.extend((0..=1).map(|v| Version::new(1, 12, v))); // 1.12.[0-1] + vs.extend((0..=3).map(|v| Version::new(1, 12, v))); // 1.12.[0-3] vs.extend((0..=0).map(|v| Version::new(1, 13, v))); // 1.13.[0-0] for v in vs.into_iter().filter(|&v| version >= v) { println!("cargo:rustc-cfg=feature=\"{}.{}.{}\"", v.major, v.minor, v.micro); From 4c21331b04cd2fdfef84edb86f86011967c99e15 Mon Sep 17 00:00:00 2001 From: Alan Race Date: Tue, 2 May 2023 11:52:35 +0200 Subject: [PATCH 10/14] Modified regex for version checking to cater for 1.12.3.1 --- hdf5-sys/build.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hdf5-sys/build.rs b/hdf5-sys/build.rs index 35c9fc2c2..d6c154fb0 100644 --- a/hdf5-sys/build.rs +++ b/hdf5-sys/build.rs @@ -29,7 +29,7 @@ impl Version { } pub fn parse(s: &str) -> Option { - let re = Regex::new(r"^(1)\.(8|10|12|13)\.(\d\d?)(_\d+)?(-patch\d+)?$").ok()?; + let re = Regex::new(r"^(1)\.(8|10|12|13)\.(\d\d?).(\d\d?)?(_\d+)?(-patch\d+)?$").ok()?; let captures = re.captures(s)?; Some(Self { major: captures.get(1).and_then(|c| c.as_str().parse::().ok())?, From dd4b2cdfa3015fe1646e3fc65236c4ac8dea6953 Mon Sep 17 00:00:00 2001 From: Alan Race Date: Tue, 2 May 2023 12:03:34 +0200 Subject: [PATCH 11/14] Update libz-sys library --- hdf5-src/Cargo.toml | 3 ++- hdf5-sys/Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/hdf5-src/Cargo.toml b/hdf5-src/Cargo.toml index 632908151..96b20d136 100644 --- a/hdf5-src/Cargo.toml +++ b/hdf5-src/Cargo.toml @@ -36,6 +36,7 @@ exclude = [ ] [features] +default = ["1_12"] hl = [] zlib = ["libz-sys"] deprecated = [] @@ -45,7 +46,7 @@ threadsafe = [] 1_14 = [] [dependencies] -libz-sys = { version = "1.0.25", features = ["static", "libc"], optional = true, default-features=false } +libz-sys = { version = "1.1.9", features = ["static", "libc"], optional = true, default-features=false } [build-dependencies] cmake = "0.1.44" diff --git a/hdf5-sys/Cargo.toml b/hdf5-sys/Cargo.toml index a318eb70a..4fc6c43e1 100644 --- a/hdf5-sys/Cargo.toml +++ b/hdf5-sys/Cargo.toml @@ -16,7 +16,7 @@ categories = ["ffi", "filesystem", "science"] [dependencies] libc = "0.2" mpi-sys = { version = "0.1", optional = true } -libz-sys = { version = "1.0.25", optional = true, default-features = false } +libz-sys = { version = "1.1.9", optional = true, default-features = false } hdf5-src = { path = "../hdf5-src", version = "0.8.1", optional = true } # !V # Please see README for further explanation of these feature flags From b77f0b4e92eebbcb2c0cec27c2782f6cbb283043 Mon Sep 17 00:00:00 2001 From: Alan Race Date: Tue, 2 May 2023 13:46:59 +0200 Subject: [PATCH 12/14] Updated 1.14 branch --- hdf5-src/ext/1_14 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hdf5-src/ext/1_14 b/hdf5-src/ext/1_14 index 0553fb7ac..6eb021b68 160000 --- a/hdf5-src/ext/1_14 +++ b/hdf5-src/ext/1_14 @@ -1 +1 @@ -Subproject commit 0553fb7ac7f03a919c91cdbbd5648b8aadbe05af +Subproject commit 6eb021b68a8b46bbc89844713f014e6ba729ca7d From eabdc73898830feabc55e50cb3ea887c6152ca7c Mon Sep 17 00:00:00 2001 From: Alan Race Date: Tue, 2 May 2023 18:04:06 +0200 Subject: [PATCH 13/14] Added version 1.14 to the list of enabled verisons --- hdf5-sys/build.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hdf5-sys/build.rs b/hdf5-sys/build.rs index d6c154fb0..f33c7200f 100644 --- a/hdf5-sys/build.rs +++ b/hdf5-sys/build.rs @@ -29,7 +29,7 @@ impl Version { } pub fn parse(s: &str) -> Option { - let re = Regex::new(r"^(1)\.(8|10|12|13)\.(\d\d?).(\d\d?)?(_\d+)?(-patch\d+)?$").ok()?; + let re = Regex::new(r"^(1)\.(8|10|12|13|14)\.(\d\d?).(\d\d?)?(_\d+)?(-patch\d+)?$").ok()?; let captures = re.captures(s)?; Some(Self { major: captures.get(1).and_then(|c| c.as_str().parse::().ok())?, @@ -616,6 +616,7 @@ impl Config { vs.extend((0..=8).map(|v| Version::new(1, 10, v))); // 1.10.[0-8] vs.extend((0..=3).map(|v| Version::new(1, 12, v))); // 1.12.[0-3] vs.extend((0..=0).map(|v| Version::new(1, 13, v))); // 1.13.[0-0] + vs.extend((0..=0).map(|v| Version::new(1, 14, v))); // 1.14.[0-0] for v in vs.into_iter().filter(|&v| version >= v) { println!("cargo:rustc-cfg=feature=\"{}.{}.{}\"", v.major, v.minor, v.micro); println!("cargo:version_{}_{}_{}=1", v.major, v.minor, v.micro); From 73fbc31a68b55bb6c3e7bcd47ea24730fe31e978 Mon Sep 17 00:00:00 2001 From: Alan Race Date: Wed, 3 May 2023 12:09:23 +0200 Subject: [PATCH 14/14] Updated build to use darling when cross compiling to macos --- hdf5-src/build.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hdf5-src/build.rs b/hdf5-src/build.rs index 58201f627..c7e11343e 100644 --- a/hdf5-src/build.rs +++ b/hdf5-src/build.rs @@ -68,6 +68,7 @@ fn main() { } let targeting_windows = env::var("CARGO_CFG_TARGET_OS").unwrap() == "windows"; + let targeting_macos = env::var("CARGO_CFG_TARGET_OS").unwrap() == "macos"; let debug_postfix = if targeting_windows { "_D" } else { "_debug" }; if feature_enabled("HL") { @@ -89,6 +90,11 @@ fn main() { cfg.define("CMAKE_CROSSCOMPILING_EMULATOR", wine_exec); } + if env::consts::OS != "macos" && targeting_macos { + println!("Cross compiling to macos, so setting emulator to darling"); + cfg.define("CMAKE_CROSSCOMPILING_EMULATOR", "darling"); + } + let dst = cfg.build(); println!("cargo:root={}", dst.display());