diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 88a72e462..c1b7f4e12 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.12} - {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_14} + - {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: | @@ -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 0edcd7721..d1df8a64b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,9 @@ -[submodule "hdf5"] - path = hdf5-src/ext/hdf5 +[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/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 diff --git a/hdf5-src/Cargo.toml b/hdf5-src/Cargo.toml index a773fdaf7..632908151 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_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 86d5d60f1..58201f627 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_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") { + 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"); @@ -23,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/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_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 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) {