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 29, 2024
1 parent 023a58a commit 20b6012
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
2 changes: 2 additions & 0 deletions netcdf-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,8 @@ fn main() {
Version::new(4, 9, 0),
Version::new(4, 9, 1),
Version::new(4, 9, 2),
Version::new(4, 9, 3),
// 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"]
28 changes: 28 additions & 0 deletions netcdf/build.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
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),
Version::new(4, 9, 3),
// 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 20b6012

Please sign in to comment.