Skip to content

FFI bindings for the zarrs rust crate

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENCE-APACHE
MIT
LICENCE-MIT
Notifications You must be signed in to change notification settings

LDeakin/zarrs_ffi

Repository files navigation

zarrs_ffi

Latest Version zarrs documentation msrv build

FFI bindings for the zarrs crate, a Rust library for the Zarr storage format for multidimensional arrays and metadata.

Currently zarrs_ffi only supports a small subset of the zarrs API.

A changelog can be found here. Example usage can be found in the examples.

CMake Quickstart

  1. Install the Rust compiler (and cargo).
  2. Put Findzarrs.cmake in your CMAKE_MODULE_PATH
  3. find_package(zarrs 0.8 REQUIRED COMPONENTS zarrs/bz2)
  4. the zarrs_ffi library is available as the zarrs::zarrs or zarrs::zarrs-static target

A complete CMake example can be found in examples/cmake_project.

Manual Build

Basic Build

Building generates a header, and a platform-dependent static and dynamic library.

cargo build --release --features cbindgen # -> zarrs.h and target/release/[lib]zarrs_ffi{.a,.so,.dll,.dylib}

zarrs.h is only re-generated if the cbindgen feature is enabled.

Enabling SIMD intrinsics

Encoding and decoding performance may be improved with avx2/sse2 enabled (if supported). Compile with either of:

  • RUSTFLAGS="-C target-cpu=native"
  • RUSTFLAGS="-C target-feature=+avx2,+sse2"

Enabling non-default zarrs codecs

Non-default zarrs codecs (see zarrs crate features) can be enabled with the all_codecs feature. Alternatively, individual codecs can be enabled by passing them as feature flags. For example:

cargo build --release --features cbindgen --features zarrs/zstd,zarrs/bitround,zarrs/zfp,zarrs/bz2,zarrs/pcodec,zarrs/gdeflate

Licence

zarrs_ffi is licensed under either of

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.