Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
9c0728b
Initial commit
Choochmeque May 6, 2026
be2435c
Refactor spacing and formatting in metkit_bridge.cpp and metkit_bridge.h
Choochmeque May 7, 2026
dbd62c4
Add exception generation for metkit and update bridge to include it
Choochmeque May 12, 2026
727f08f
Remove branch specifications for bindman dependencies in Cargo.toml
Choochmeque Jun 10, 2026
1d560b5
Merge branch 'develop' into rust-bindings
Choochmeque Jun 10, 2026
a6c30e0
Update eccodes-sys dependency to use new repository for rust wrappers
Choochmeque Jun 10, 2026
9cd6b12
Patch eckit-sys dependency to use ecmwf/eckit-sys
Choochmeque Jun 10, 2026
b677b53
Remove unused patch for eckit-sys from Cargo.toml to clean up depende…
Choochmeque Jun 10, 2026
afed28e
Add metkit_exceptions.h include to metkit_bridge.cpp and remove from …
Choochmeque Jun 11, 2026
bac7844
Add missing metkit_exceptions.h include to metkit_bridge.cpp
Choochmeque Jun 11, 2026
10ffc1a
Move cargo configuration to rust folder
Choochmeque Jun 11, 2026
574b771
Merge branch 'develop' into rust-bindings
Choochmeque Jun 11, 2026
92b6a8f
Remove wind family functions and related includes from metkit_bridge
Choochmeque Jun 12, 2026
24f32ef
Update README.md to clarify cargo build features and environment vari…
Choochmeque Jun 12, 2026
bf34895
Refactor CodesHandleWrapper factory functions to static methods
Choochmeque Jun 12, 2026
4bb05a4
Pin bindman revision
Choochmeque Jun 12, 2026
212eead
Add reusable Rust CI workflow to main CI configuration
Choochmeque Jun 18, 2026
57cd51f
Update README
Choochmeque Jun 18, 2026
ef9d316
Update C++ bridge for Rust FFI with new wrappers and file structure c…
Choochmeque Jun 22, 2026
1308e45
Merge branch 'develop' into rust-bindings
Choochmeque Jun 22, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,18 @@ jobs:
clang_format: true
secrets: inherit

# Run Rust CI (fmt + clippy + test) on the rust/ workspace
ci-rust:
name: ci-rust
if: ${{ !github.event.pull_request.head.repo.fork && github.event.action != 'labeled' || github.event.label.name == 'approved-for-ci' }}
uses: ecmwf/reusable-workflows/.github/workflows/ci-rust.yml@main
with:
manifest-path: rust/Cargo.toml
features: --features vendored
run-doc: false
secrets:
private_repos_token: ${{ secrets.GH_REPO_READ_TOKEN }}

# Run CI of private downstream packages on self-hosted runners
private-downstream-ci:
name: private-downstream-ci
Expand Down Expand Up @@ -80,6 +92,7 @@ jobs:
runs-on: ubuntu-latest
needs:
- downstream-ci
- ci-rust
- private-downstream-ci
- downstream-ci-hpc
- private-downstream-ci-hpc
Expand Down
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,8 @@ doc/latex
*.idx
.mypy_cache
build/
Testing/
Testing/

# Rust
rust/target/
rust/Cargo.lock
15 changes: 15 additions & 0 deletions rust/.cargo/config.toml
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
30 changes: 30 additions & 0 deletions rust/Cargo.toml
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"
50 changes: 50 additions & 0 deletions rust/crates/metkit-sys/Cargo.toml
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]
54 changes: 54 additions & 0 deletions rust/crates/metkit-sys/README.md
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

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 24f32ef

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
Loading
Loading