-
Notifications
You must be signed in to change notification settings - Fork 14
Rust bindings (metkit-sys crate) #209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
9c0728b
Initial commit
Choochmeque be2435c
Refactor spacing and formatting in metkit_bridge.cpp and metkit_bridge.h
Choochmeque dbd62c4
Add exception generation for metkit and update bridge to include it
Choochmeque 727f08f
Remove branch specifications for bindman dependencies in Cargo.toml
Choochmeque 1d560b5
Merge branch 'develop' into rust-bindings
Choochmeque a6c30e0
Update eccodes-sys dependency to use new repository for rust wrappers
Choochmeque 9cd6b12
Patch eckit-sys dependency to use ecmwf/eckit-sys
Choochmeque b677b53
Remove unused patch for eckit-sys from Cargo.toml to clean up depende…
Choochmeque afed28e
Add metkit_exceptions.h include to metkit_bridge.cpp and remove from …
Choochmeque bac7844
Add missing metkit_exceptions.h include to metkit_bridge.cpp
Choochmeque 10ffc1a
Move cargo configuration to rust folder
Choochmeque 574b771
Merge branch 'develop' into rust-bindings
Choochmeque 92b6a8f
Remove wind family functions and related includes from metkit_bridge
Choochmeque 24f32ef
Update README.md to clarify cargo build features and environment vari…
Choochmeque bf34895
Refactor CodesHandleWrapper factory functions to static methods
Choochmeque 4bb05a4
Pin bindman revision
Choochmeque 212eead
Add reusable Rust CI workflow to main CI configuration
Choochmeque 57cd51f
Update README
Choochmeque ef9d316
Update C++ bridge for Rust FFI with new wrappers and file structure c…
Choochmeque 1308e45
Merge branch 'develop' into rust-bindings
Choochmeque File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -18,4 +18,8 @@ doc/latex | |
| *.idx | ||
| .mypy_cache | ||
| build/ | ||
| Testing/ | ||
| Testing/ | ||
|
|
||
| # Rust | ||
| rust/target/ | ||
| rust/Cargo.lock | ||
This file contains hidden or 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,15 @@ | ||
| [build] | ||
| jobs = -1 | ||
|
|
||
| [target.'cfg(all())'] | ||
| rustflags = [ | ||
| "-Wclippy::all", | ||
| "-Wclippy::pedantic", | ||
| "-Wclippy::nursery", | ||
| "-Wclippy::unwrap_used", | ||
| "-Aclippy::module_name_repetitions", | ||
| "-Aclippy::missing_errors_doc", | ||
| ] | ||
|
|
||
| [net] | ||
| git-fetch-with-cli = true |
This file contains hidden or 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,30 @@ | ||
| [workspace] | ||
| resolver = "2" | ||
| members = ["crates/metkit-sys"] | ||
|
|
||
| [workspace.package] | ||
| edition = "2024" | ||
| license = "Apache-2.0" | ||
| repository = "https://github.com/ecmwf/metkit" | ||
| rust-version = "1.90" | ||
| readme = "README.md" | ||
| keywords = ["ecmwf", "weather", "meteorology", "grib"] | ||
| categories = ["science"] | ||
|
|
||
| [workspace.dependencies] | ||
| # Internal | ||
| metkit-sys = { path = "crates/metkit-sys" } | ||
|
|
||
| # Foundation crates | ||
| eckit-sys = { git = "ssh://git@github.com/ecmwf/eckit.git", branch = "rust-bindings", default-features = false } | ||
| eccodes-sys = { git = "ssh://git@github.com/ecmwf/rust-wrappers-playground.git", default-features = false } | ||
|
|
||
| # Build tools | ||
| bindman = { git = "ssh://git@github.com/ecmwf/bindman.git", rev = "47edf68" } | ||
| bindman-build = { git = "ssh://git@github.com/ecmwf/bindman.git", rev = "47edf68" } | ||
| bindman-utils = { git = "ssh://git@github.com/ecmwf/bindman.git", rev = "47edf68" } | ||
|
|
||
| # External | ||
| cxx = "1.0" | ||
| cxx-build = "1.0" | ||
| thiserror = "2" |
This file contains hidden or 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,50 @@ | ||
| [package] | ||
| name = "metkit-sys" | ||
| version = "1.18.1" | ||
| edition.workspace = true | ||
| license.workspace = true | ||
| repository.workspace = true | ||
| rust-version.workspace = true | ||
| readme.workspace = true | ||
| keywords.workspace = true | ||
| categories.workspace = true | ||
| description = "C++ bindings to ECMWF metkit library using cxx" | ||
| links = "metkit_sys" | ||
| build = "build.rs" | ||
|
|
||
| [features] | ||
| # Defaults: core features | ||
| default = ["vendored", "grib", "bufr", "mars2grib", "metkit-config"] | ||
|
|
||
| # Build strategy (mutually exclusive) | ||
| vendored = ["eckit-sys/vendored", "eccodes-sys/vendored", "eccodes-sys/eccodes-threads"] | ||
| system = ["eckit-sys/system", "eccodes-sys/system"] | ||
|
|
||
| # Format support (CMake default: ON) | ||
| grib = ["eccodes-sys/product-grib"] # GRIB format support (requires eccodes) | ||
| bufr = ["eccodes-sys/product-bufr"] # BUFR format support (requires eccodes) | ||
| netcdf = [] # NetCDF data support (requires NetCDF library) | ||
| odb = [] # ODB data support (requires odc) | ||
|
|
||
| # Encoding (CMake default: ON) | ||
| mars2grib = ["eckit-sys/geo-codec-grids"] # MARS2GRIB encoder (requires eckit geo codec grids for ORCA/FESOM/ICON) | ||
|
|
||
| # Configuration (CMake default: ON) | ||
| metkit-config = [] # Install metkit configuration files | ||
|
|
||
| # Other (CMake default: OFF) | ||
| experimental = [] # Experimental features | ||
| fail-on-ccsds = [] # Fail on CCSDS | ||
|
|
||
| [dependencies] | ||
| cxx.workspace = true | ||
| eckit-sys = { workspace = true, default-features = false } | ||
| eccodes-sys = { workspace = true, default-features = false } | ||
| bindman.workspace = true | ||
|
|
||
| [build-dependencies] | ||
| cxx-build.workspace = true | ||
| bindman-utils.workspace = true | ||
| bindman-build.workspace = true | ||
|
|
||
| [package.metadata.docs.rs] |
This file contains hidden or 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,54 @@ | ||
| # metkit-sys | ||
|
|
||
| Low-level Rust bindings to ECMWF's [metkit](https://github.com/ecmwf/metkit) C++ | ||
| library. | ||
|
|
||
| This crate provides raw FFI bindings using [cxx](https://cxx.rs/). For a safe, | ||
| ergonomic API, use the higher-level `metkit` crate (forthcoming). | ||
|
|
||
| ## Cargo build features | ||
|
|
||
| These flags control what the underlying C++ metkit library is compiled with. | ||
| Each maps to a `-DENABLE_<NAME>=ON/OFF` flag in upstream | ||
| [`metkit/CMakeLists.txt`](https://github.com/ecmwf/metkit/blob/develop/CMakeLists.txt). | ||
|
|
||
| ### Build strategy (mutually exclusive) | ||
|
|
||
| - `vendored` (default) - Clone and build metkit (and its eckit and ecCodes | ||
| dependencies) from source. | ||
| - `system` - Link against a system-installed metkit, located via CMake | ||
| `find_package(metkit)`. Honours `METKIT_DIR` and `CMAKE_PREFIX_PATH`. | ||
|
|
||
| ### Format support (enabled by default) | ||
|
|
||
| - `grib` - GRIB format support. Pulls in `eccodes-sys/product-grib`. | ||
| - `bufr` - BUFR format support. Pulls in `eccodes-sys/product-bufr`. | ||
|
|
||
| ### Format support (off by default; require external libraries) | ||
|
|
||
| - `netcdf` - NetCDF data support. | ||
| - `odb` - ODB data support (requires `odc`). | ||
|
|
||
| ### Encoding (enabled by default) | ||
|
|
||
| - `mars2grib` - MARS2GRIB encoder. Pulls in `eckit-sys/geo-codec-grids` for | ||
| ORCA / FESOM / ICON grid support. | ||
|
|
||
| ### Configuration (enabled by default) | ||
|
|
||
| - `metkit-config` - Install metkit configuration files (e.g. `language.yaml`). | ||
|
|
||
| ### Other (off by default) | ||
|
|
||
| - `experimental` - Experimental upstream features. | ||
| - `fail-on-ccsds` - Fail when encountering CCSDS-encoded messages. | ||
|
|
||
| ## Environment variables | ||
|
|
||
| - `METKIT_DIR` - Install prefix of a metkit build, used by `system` mode. | ||
| - `CMAKE_PREFIX_PATH` - Additional CMake search paths. | ||
| - `DOCS_RS` - When set, the build script becomes a no-op (for docs.rs). | ||
|
|
||
| ## License | ||
|
|
||
| Apache-2.0 | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check, and ensure we only leave actually supported stuff here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 24f32ef