This project contains the crates erfa
and erfa-sys
, which allow usage of the
ERFA
library in Rust.
This crate is a pure-Rust equivalent to the
ERFA
C library. The C library is relatively
easy to re-write as it has no dependencies, and it is convenient to have a
Rust-re-written library to avoid complications during C library installation.
However, it is currently incomplete. I've implemented many functions but only the ones I need. Please file a PR or issue if you require more.
This library is tested against erfa-sys
, effectively meaning that the results
are the same as the original C library.
This crate provides direct bindings to the ERFA C library. It is possible to build the library from C sources, such that the user's system does not need the ERFA C library available as a prerequisite - see static linking below.
This crate supports linking to a static build of ERFA. The advantage of doing this is that you don't need the ERFA library available as a system library at runtime.
Static linking can be done in two ways. The first is by using the static
feature when building erfa-sys
; this compiles the bundled ERFA source code
using your own C compiler.
The second way to link ERFA statically is by providing a liberfa.a
library.
Either the ERFA_STATIC
or PKG_CONFIG_ALL_STATIC
environment variable need to
be set to 1. The directory containing this file (or the liberfa.so
file) can
be specified with ERFA_LIB
. If ERFA_LIB
isn't found, then pkg-config
is
used to search for the library.
The ext
directory contains a git submodule of the ERFA
repo. If the source code needs to be changed,
then the git submodule can use a different commit.
If new ERFA functions or constants are introduced, then gen_rust_include.sh
should also be run.
I don't know how to run/bind to ERFA on Windows, so this crate may not work there. Pull requests welcome.
This crate was made with a lot of help and inspiration from the
hdf5-rust
crate family.