mirror of
https://github.com/georust/netcdf.git
synced 2026-01-25 15:02:13 +00:00
allow NETCDF_DIR to control linked lib
This commit is contained in:
parent
c1bae434ab
commit
fec7949272
@ -2,3 +2,7 @@
|
||||
|
||||
Rust bindings to `netcdf-c` to locate and link the system libraries neccessary to use `netcdf`.
|
||||
This library can also build `hdf5` and `netcdf` from source, to allow a fully static linking experience. This is enabled with the `static` feature.
|
||||
|
||||
## Detection of netCDF
|
||||
|
||||
By default the crate uses the system installed `netCDF`. The environment variable `NETCDF_DIR` can be used to use a particular version of `netCDF`. This variable is ignored if compiling from sources.
|
||||
|
||||
@ -14,7 +14,13 @@ fn main() {
|
||||
println!("cargo:rustc-link-lib=static={}", netcdf_lib);
|
||||
println!("cargo:rustc-link-search=native={}", netcdf_path);
|
||||
} else {
|
||||
// Link to the system netcdf
|
||||
println!("cargo:rustc-link-lib=netcdf");
|
||||
println!("cargo:rerun-if-env-changed=NETCDF_DIR");
|
||||
if let Ok(dir) = std::env::var("NETCDF_DIR") {
|
||||
println!("cargo:rustc-link-search={}/lib", dir);
|
||||
println!("cargo:rustc-link-lib=netcdf");
|
||||
} else {
|
||||
// Link to the system netcdf
|
||||
println!("cargo:rustc-link-lib=netcdf");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user