Skip to content

Commit 6e98135

Browse files
committed
add DAP support, and use patch section in toml
1 parent c7b8246 commit 6e98135

4 files changed

Lines changed: 22 additions & 7 deletions

File tree

netcdf-sys/Cargo.toml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,16 @@ authors = [
88
license = "MIT"
99
description = "FFI bindings to NetCDF"
1010
repository = "https://github.com/georust/netcdf"
11-
documentation = "https://github.com/georust/netcdf"
11+
documentation = "https://docs.rs/netcdf"
1212
keywords = ["netcdf", "hdf", "hdf5", "cdm", "ffi"]
1313
edition = "2018"
1414
links = "netcdf"
1515
build = "build.rs"
1616

1717
[dependencies]
18-
hdf5-sys = { git = "https://github.com/magnusuMET/hdf5-rust.git", branch = "feature/static_build", features = ["hl", "threadsafe", "deprecated"] }
1918
libz-sys = { version = "1.0.25", optional = true }
19+
curl-sys = { version = "0.4.25", optional = true }
20+
hdf5-sys = { version = "0.5.3", features = ["hl", "threadsafe", "deprecated"] }
2021

2122
[dev-dependencies]
2223
lazy_static = "1.4.0"
@@ -28,4 +29,10 @@ cmake = "0.1.42"
2829
default = ["libz"]
2930
memio = []
3031
static = ["libz-sys/static", "hdf5-sys/static"]
32+
# TODO: Link static curl (but only when using "dap") "curl-sys/static-curl", "curl-sys/static-ssl"
3133
libz = ["libz-sys"]
34+
dap = ["curl-sys"]
35+
36+
[patch]
37+
[patch.crates-io]
38+
hdf5-sys = { git = "https://github.com/magnusuMET/hdf5-rust.git", branch = "feature/static_build" }

netcdf-sys/build.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ fn build() {
2121
let hdf5_hl_lib = std::env::var("DEP_HDF5_HL_LIBRARY").unwrap();
2222

2323

24-
let netcdf = cmake::Config::new("source")
24+
let mut netcdf_config = cmake::Config::new("source");
25+
netcdf_config
2526
.define("BUILD_SHARED_LIBS", "OFF")
2627
.define("NC_FIND_SHARED_LIBS", "OFF")
2728
.define("BUILD_UTILITIES", "OFF")
@@ -39,9 +40,13 @@ fn build() {
3940
//
4041
.define("ENABLE_DAP", "OFF") // TODO: feature flag, requires curl
4142
//
42-
.profile("RelWithDebInfo") // TODO: detect opt-level
43-
.very_verbose(true)
44-
.build();
43+
.profile("RelWithDebInfo"); // TODO: detect opt-level
44+
45+
if feature!("DAP").is_ok() {
46+
netcdf_config.define("ENABLE_DAP", "ON");
47+
}
48+
49+
let netcdf = netcdf_config.build();
4550

4651
println!("cargo:rustc-link-lib=static=netcdf");
4752
println!("cargo:rustc-link-search=native={}/lib", netcdf.display());

netcdf-sys/source

netcdf-sys/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33

44
extern crate hdf5_sys;
55

6+
#[cfg(feature = "dap")]
7+
extern crate curl_sys;
8+
69
mod netcdf_bindings;
710
mod netcdf_const;
811
pub use netcdf_bindings::*;

0 commit comments

Comments
 (0)