-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #56 from magnusuMET/vendor
Option for building netCDF from source
- Loading branch information
Showing
18 changed files
with
256 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: codecov | ||
on: [push] | ||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
tarpaulin: | ||
name: tarpaulin | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
- name: Install netcdf | ||
run: sudo apt-get install libnetcdf-dev | ||
- name: Install rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
profile: minimal | ||
override: true | ||
- name: Install tarpaulin | ||
uses: actions-rs/install@v0.1 | ||
with: | ||
crate: cargo-tarpaulin | ||
version: latest | ||
use-tool-cache: true | ||
|
||
- name: Tarpaulin | ||
run: cargo tarpaulin --verbose --out Xml --ignore-tests | ||
|
||
- name: Upload to codecov | ||
uses: codecov/codecov-action@v1.0.2 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "netcdf-sys/source"] | ||
path = netcdf-src/source | ||
url = https://github.com/Unidata/netcdf-c.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
[package] | ||
name = "netcdf-src" | ||
version = "0.1.0" | ||
authors = ["Magnus Ulimoen <magnusu@met.no>"] | ||
edition = "2018" | ||
description = "Build scripts for building `netCDF` from source" | ||
build = "build.rs" | ||
repository = "https://github.com/georust/netcdf" | ||
license-file = "source/COPYRIGHT" | ||
links = "netcdfsrc" | ||
exclude = [ | ||
"source/unit_test/**", | ||
"source/NUG/**", | ||
"source/dap4_test/**", | ||
"source/examples/**", | ||
"source/nc_test/**", | ||
"source/h5_test/**", | ||
"source/nc_perf/**", | ||
"source/ncdump/**", | ||
"source/hdf4_test/**", | ||
"source/ncgen/**", | ||
"source/ncgen3/**", | ||
"source/nctest/**", | ||
] | ||
|
||
[features] | ||
dap = [] | ||
|
||
[dependencies] | ||
hdf5-sys = { version = "0.7.0", features = ["hl", "deprecated", "zlib"] } | ||
|
||
[build-dependencies] | ||
cmake = "0.1.44" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
macro_rules! feature { | ||
($feature:expr) => { | ||
std::env::var(concat!("CARGO_FEATURE_", $feature)) | ||
}; | ||
} | ||
|
||
fn main() { | ||
println!("cargo:rerun-if-changed=build.rs"); | ||
|
||
let hdf5_incdir = std::env::var("DEP_HDF5_INCLUDE").unwrap(); | ||
let hdf5_lib = std::env::var("DEP_HDF5_LIBRARY").unwrap(); | ||
let hdf5_hl_lib = std::env::var("DEP_HDF5_HL_LIBRARY").unwrap(); | ||
|
||
let mut netcdf_config = cmake::Config::new("source"); | ||
netcdf_config | ||
.define("BUILD_SHARED_LIBS", "OFF") | ||
.define("NC_FIND_SHARED_LIBS", "OFF") | ||
.define("BUILD_UTILITIES", "OFF") | ||
.define("ENABLE_EXAMPLES", "OFF") | ||
.define("ENABLE_DAP_REMOTE_TESTS", "OFF") | ||
.define("ENABLE_TESTS", "OFF") | ||
.define("ENABLE_EXTREME_NUMBERS", "OFF") | ||
.define("ENABLE_PARALLEL_TESTS", "OFF") | ||
.define("ENABLE_FILTER_TESTING", "OFF") | ||
.define("ENABLE_BASH_SCRIPT_TESTING", "OFF") | ||
// | ||
.define("HDF5_C_LIBRARY", &hdf5_lib) | ||
.define("HDF5_HL_LIBRARY", &hdf5_hl_lib) | ||
.define("HDF5_INCLUDE_DIR", hdf5_incdir) | ||
// | ||
.define("ENABLE_DAP", "OFF") // TODO: feature flag, requires curl | ||
// | ||
.profile("RelWithDebInfo"); // TODO: detect opt-level | ||
|
||
if feature!("DAP").is_ok() { | ||
netcdf_config.define("ENABLE_DAP", "ON"); | ||
} | ||
|
||
let netcdf = netcdf_config.build(); | ||
|
||
println!("cargo:lib={}", "netcdf"); | ||
let search_path = format!("{}/lib", netcdf.display()); | ||
if std::path::Path::new(&search_path).exists() { | ||
println!("cargo:search={}", search_path); | ||
} else { | ||
let search_path = format!("{}/lib64", netcdf.display()); | ||
println!("cargo:search={}", search_path); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
//! Dummy crate for building `netCDF` from source | ||
//! | ||
//! The current pinned version is 4.7.4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# netcdf-sys | ||
|
||
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. |
Oops, something went wrong.