diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f71ab77..2e0ad68 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -118,7 +118,7 @@ jobs: - {os: ubuntu-latest, rust: stable} - {os: windows-latest, rust: stable-msvc} - {os: windows-latest, rust: stable-gnu} - - {os: macos-11, rust: stable} + - {os: macos-12, rust: stable} - {os: macos-latest, rust: stable} defaults: run: diff --git a/netcdf-sys/build.rs b/netcdf-sys/build.rs index 3452e40..b8ef69d 100644 --- a/netcdf-sys/build.rs +++ b/netcdf-sys/build.rs @@ -294,6 +294,7 @@ fn main() { Version::new(4, 9, 0), Version::new(4, 9, 1), Version::new(4, 9, 2), + // Keep this list up to date with netcdf/build.rs ]; for version in &versions { diff --git a/netcdf/Cargo.toml b/netcdf/Cargo.toml index 96f09ab..ebb5cf4 100644 --- a/netcdf/Cargo.toml +++ b/netcdf/Cargo.toml @@ -35,6 +35,9 @@ mpi-sys = { workspace = true, optional = true } clap = { version = "4.5.1", features = ["derive"] } tempfile = "3.1.0" +[build-dependencies] +semver = "1.0.23" + [package.metadata.docs.rs] features = ["static"] rustdoc-args = ["--cfg", "docsrs"] diff --git a/netcdf/build.rs b/netcdf/build.rs index f60dc97..8d62f36 100644 --- a/netcdf/build.rs +++ b/netcdf/build.rs @@ -1,5 +1,32 @@ +use semver::Version; + fn main() { println!("cargo::rustc-check-cfg=cfg(feature, values(\"has-mmap\"))"); + let versions = [ + Version::new(4, 4, 0), + Version::new(4, 4, 1), + Version::new(4, 5, 0), + Version::new(4, 6, 0), + Version::new(4, 6, 1), + Version::new(4, 6, 2), + Version::new(4, 6, 3), + Version::new(4, 7, 0), + Version::new(4, 7, 1), + Version::new(4, 7, 2), + Version::new(4, 7, 3), + Version::new(4, 7, 4), + Version::new(4, 8, 0), + Version::new(4, 8, 1), + Version::new(4, 9, 0), + Version::new(4, 9, 1), + Version::new(4, 9, 2), + // Keep this list up to date with netcdf-sys/build.rs + ]; + + for version in &versions { + println!("cargo::rustc-check-cfg=cfg(feature, values(\"{version}\"))"); + } + if std::env::var("DEP_NETCDF_HAS_MMAP").is_ok() { println!("cargo::rustc-cfg=feature=\"has-mmap\""); }