Skip to content

Commit

Permalink
Whitelist features (versions) emitted by netcdf-sys
Browse files Browse the repository at this point in the history
  • Loading branch information
magnusuMET committed Jul 31, 2024
1 parent 010b07d commit d382ce3
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions netcdf-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 3 additions & 0 deletions netcdf/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
27 changes: 27 additions & 0 deletions netcdf/build.rs
Original file line number Diff line number Diff line change
@@ -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\"");
}
Expand Down

0 comments on commit d382ce3

Please sign in to comment.