Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 4e00367

Browse files
authoredFeb 18, 2025··
Merge pull request #148 from magnusuMET/feature/netcdf_c_v4.9.3
Use netCDF-c v4.9.3
2 parents 1e4d7d6 + cc765bf commit 4e00367

File tree

9 files changed

+29
-62
lines changed

9 files changed

+29
-62
lines changed
 

‎.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ jobs:
5050
- name: Check formatting
5151
run: cargo fmt -- --check
5252
- name: Documentation
53-
run: cargo doc --workspace --features netcdf/derive
53+
run: cargo doc --workspace --features netcdf/derive --exclude netcdf-src
5454
- name: Clippy
55-
run: cargo clippy --features netcdf/derive --workspace -- -D warnings
55+
run: cargo clippy --features netcdf/derive --workspace --exclude netcdf-src -- -D warnings
5656

5757
test_apt:
5858
name: test apt

‎.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[submodule "netcdf-src/source"]
22
path = netcdf-src/source
3-
url = https://github.com/magnusuMET/netcdf-c
3+
url = https://github.com/Unidata/netcdf-c

‎netcdf-src/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ dap = ["dep:link-cplusplus"]
3333
mpi = []
3434

3535
[dependencies]
36-
hdf5-sys = { workspace = true, features = ["hl", "deprecated", "zlib"] }
36+
hdf5-sys = { workspace = true, features = ["hl", "deprecated", "zlib", "static"] }
3737
libz-sys = { version = "1.0.25" }
3838
link-cplusplus = { version = "1.0.9", optional = true }
3939

‎netcdf-src/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
Dummy crate for building `netCDF` from source
44

5-
The current pinned version is 4.9.2
5+
The current pinned version is 4.9.3

‎netcdf-src/build.rs

Lines changed: 20 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -4,83 +4,48 @@ macro_rules! feature {
44
};
55
}
66

7-
fn get_hdf5_version() -> String {
8-
let (major, minor, patch) = std::env::vars()
9-
.filter_map(|(key, value)| {
10-
key.strip_prefix("DEP_HDF5_VERSION_").map(|key| {
11-
assert_eq!(value, "1");
12-
let mut version = key.split('_');
13-
let major: usize = version.next().unwrap().parse().unwrap();
14-
let minor: usize = version.next().unwrap().parse().unwrap();
15-
let patch: usize = version.next().unwrap().parse().unwrap();
16-
17-
(major, minor, patch)
18-
})
19-
})
20-
.max()
21-
.expect("Crate hdf5 should have emitted a hdf5 version");
22-
23-
format!("{major}.{minor}.{patch}")
24-
}
25-
267
fn main() {
278
println!("cargo::rerun-if-changed=build.rs");
289

2910
let hdf5_incdir = std::env::var("DEP_HDF5_INCLUDE").unwrap();
30-
let mut hdf5_lib = std::env::var("DEP_HDF5_LIBRARY").unwrap();
31-
let mut hdf5_hl_lib = std::env::var("DEP_HDF5_HL_LIBRARY").unwrap();
32-
33-
#[cfg(unix)]
34-
{
35-
let hdf5_root = format!("{hdf5_incdir}/../");
36-
let mut hdf5_libdir = format!("{hdf5_root}/lib/");
37-
if !std::path::Path::new(&hdf5_libdir).exists() {
38-
hdf5_libdir = format!("{hdf5_root}/lib64/");
39-
}
40-
hdf5_lib = format!("{hdf5_libdir}/{hdf5_lib}.a");
41-
hdf5_hl_lib = format!("{hdf5_libdir}/{hdf5_hl_lib}.a");
42-
}
43-
44-
let hdf5_version = get_hdf5_version();
11+
let hdf5_root = format!("{hdf5_incdir}/../");
4512

4613
let mut netcdf_config = cmake::Config::new("source");
4714
netcdf_config
4815
.define("BUILD_SHARED_LIBS", "OFF")
49-
.define("NC_FIND_SHARED_LIBS", "OFF")
50-
.define("BUILD_UTILITIES", "OFF")
51-
.define("ENABLE_EXAMPLES", "OFF")
52-
.define("ENABLE_DAP_REMOTE_TESTS", "OFF")
53-
.define("ENABLE_TESTS", "OFF")
54-
.define("ENABLE_EXTREME_NUMBERS", "OFF")
55-
.define("ENABLE_PARALLEL_TESTS", "OFF")
56-
.define("ENABLE_FILTER_TESTING", "OFF")
16+
.define("NETCDF_FIND_SHARED_LIBS", "OFF")
17+
.define("NETCDF_BUILD_UTILITIES", "OFF")
18+
.define("NETCDF_ENABLE_EXAMPLES", "OFF")
19+
.define("NETCDF_ENABLE_DAP_REMOTE_TESTS", "OFF")
20+
.define("NETCDF_ENABLE_TESTS", "OFF")
21+
.define("NETCDF_ENABLE_EXTREME_NUMBERS", "OFF")
22+
.define("NETCDF_ENABLE_FILTER_TESTING", "OFF")
23+
.define("NETCDF_ENABLE_PARALLEL_TESTS", "OFF")
24+
.define("NETCDF_ENABLE_FILTER_TESTING", "OFF")
5725
.define("ENABLE_BASH_SCRIPT_TESTING", "OFF")
58-
.define("ENABLE_PLUGINS", "OFF")
26+
.define("NETCDF_NETCDF_ENABLE_PLUGINS", "OFF")
5927
.define("PLUGIN_INSTALL_DIR", "OFF")
6028
//
61-
.define("HDF5_VERSION", &hdf5_version)
62-
.define("HDF5_C_LIBRARY", &hdf5_lib)
63-
.define("HDF5_HL_LIBRARY", &hdf5_hl_lib)
64-
.define("HDF5_INCLUDE_DIR", hdf5_incdir)
29+
.define("HDF5_ROOT", &hdf5_root)
30+
.define("HDF5_USE_STATIC_LIBRARIES", "ON")
6531
//
66-
.define("ENABLE_LIBXML2", "OFF") // Use bundled xml2
32+
.define("NETCDF_ENABLE_LIBXML2", "OFF") // Use bundled xml2
6733
//
68-
.define("ENABLE_PARALLEL4", "OFF") // TODO: Enable mpi support
34+
.define("NETCDF_ENABLE_PARALLEL4", "OFF") // TODO: Enable mpi support
6935
//
70-
.define("ENABLE_NCZARR", "OFF") // TODO: requires a bunch of deps
36+
.define("NETCDF_ENABLE_NCZARR", "OFF") // TODO: requires a bunch of deps
7137
//
72-
.define("ENABLE_DAP", "OFF") // TODO: feature flag, requires curl
73-
.define("ENABLE_BYTERANGE", "OFF") // TODO: feature flag, requires curl
74-
.define("ENABLE_DAP_REMOTE_TESTS", "OFF")
38+
.define("NETCDF_ENABLE_DAP", "OFF") // TODO: feature flag, requires curl
39+
.define("NETCDF_ENABLE_BYTERANGE", "OFF") // TODO: feature flag, requires curl
7540
//
7641
.profile("RelWithDebInfo"); // TODO: detect opt-level
7742

7843
let zlib_include_dir = std::env::var("DEP_Z_INCLUDE").unwrap();
7944
netcdf_config.define("ZLIB_ROOT", format!("{zlib_include_dir}/.."));
8045

8146
if feature!("DAP").is_ok() {
82-
netcdf_config.define("ENABLE_DAP", "ON");
83-
netcdf_config.define("ENABLE_BYTERANGE", "ON");
47+
netcdf_config.define("NETCDF_ENABLE_DAP", "ON");
48+
netcdf_config.define("NETCDF_ENABLE_BYTERANGE", "ON");
8449
}
8550

8651
if feature!("MPI").is_ok() {

‎netcdf-src/source

Submodule source updated 1319 files

‎netcdf-src/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Dummy crate for building `netCDF` from source
22
//!
3-
//! The current pinned version is 4.9.2
3+
//! The current pinned version is 4.9.3
44
55
#[cfg(feature = "dap")]
66
extern crate link_cplusplus;

‎netcdf-sys/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ fn main() {
294294
Version::new(4, 9, 0),
295295
Version::new(4, 9, 1),
296296
Version::new(4, 9, 2),
297+
Version::new(4, 9, 3),
297298
// Keep this list up to date with netcdf/build.rs
298299
];
299300

‎netcdf/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ fn main() {
2020
Version::new(4, 9, 0),
2121
Version::new(4, 9, 1),
2222
Version::new(4, 9, 2),
23+
Version::new(4, 9, 3),
2324
// Keep this list up to date with netcdf-sys/build.rs
2425
];
2526

0 commit comments

Comments
 (0)
Please sign in to comment.