From 01039a2c0b4f392d92719cbd80ef07528cddbf85 Mon Sep 17 00:00:00 2001 From: Magnus Ulimoen Date: Sun, 5 May 2024 16:36:15 +0200 Subject: [PATCH] Add wrapper for configuration set/get --- netcdf-sys/build.rs | 4 ++++ netcdf/Cargo.toml | 1 + netcdf/build.rs | 5 +++++ netcdf/src/lib.rs | 2 ++ 4 files changed, 12 insertions(+) diff --git a/netcdf-sys/build.rs b/netcdf-sys/build.rs index 4535078..35a1e36 100644 --- a/netcdf-sys/build.rs +++ b/netcdf-sys/build.rs @@ -306,6 +306,10 @@ fn main() { "cargo:rustc-cfg=feature=\"{}.{}.{}\"", version.major, version.minor, version.patch ); + println!( + "cargo:version_\"{}.{}.{}\"=1", + version.major, version.minor, version.patch + ); } } metaheader.emit_feature_flags(); diff --git a/netcdf/Cargo.toml b/netcdf/Cargo.toml index 8f32b43..91ebbaa 100644 --- a/netcdf/Cargo.toml +++ b/netcdf/Cargo.toml @@ -23,6 +23,7 @@ static = ["netcdf-sys/static"] ndarray = { version = "0.15", optional = true } netcdf-sys = { workspace = true } bitflags = "2.4.2" +libc = "0.2.154" [dev-dependencies] clap = { version = "4.5.1", features = ["derive"] } diff --git a/netcdf/build.rs b/netcdf/build.rs index 1d174dc..6b0d9be 100644 --- a/netcdf/build.rs +++ b/netcdf/build.rs @@ -2,4 +2,9 @@ fn main() { if std::env::var("DEP_NETCDF_HAS_MMAP").is_ok() { println!("cargo:rustc-cfg=feature=\"has-mmap\""); } + for (env, _value) in std::env::vars() { + if let Some(version) = env.strip_prefix("DEP_NETCDF_VERSION_") { + println!("cargo:rustc-cfg=feature={version}"); + } + } } diff --git a/netcdf/src/lib.rs b/netcdf/src/lib.rs index ae9df16..4f51e48 100644 --- a/netcdf/src/lib.rs +++ b/netcdf/src/lib.rs @@ -110,6 +110,8 @@ pub(crate) mod error; pub(crate) mod extent; pub(crate) mod file; pub(crate) mod group; +#[cfg(feature = "4.9.2")] +pub mod rc; pub mod types; pub(crate) mod variable;