Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
aprilasr-sys
Low-level FFI bindings for the april-asr C api (libaprilasr).
Overview
Compiles libaprilasr from source to OUT_DIR using CMake and generates bindings for April API, made available via vendored upstream source pointing at a specific commit sha as defined by the git submodule.
Requirements
Building requires the following system libraries:
- libonnxruntime
- libclang
Use locate to search for installed libraries. For example, on Linux run command locate libonnxruntime.so to determine if the ONNX Runtime is available.
Installation
To get the latest unyanked release published to crates.io:
Or get the tip of the development branch via cargo using git:
It's also possible to vendor this crate:
&& \
(; )
And once cloned updating dependent's Cargo.toml manifest like:
[]
= { = "crates/aprilasr-sys" }
Examples
For a basic usage example see examples/init.rs and run command:
cargo run --example init
You should see output like:
April ASR api v1 initialized and ready for model.
Development
First clone vendored source:
To generate bindings run command:
To specify include directory set env APRIL_INCLUDE_DIR before running build.
To inspect bindings generated:
Command requires bat and exa rust binaries and displays output with syntax highlighting.
Versioning
Consider using chrono to parse the date format unless april-asr adopts semantic versioning:
let date_str = "2023.05.12";
let native_date = parse_from_str;
p!;
Here p! is a debug helper in build.rs and date_str represents the VERSION in vendor/april-asr/CMakeLists.txt file. With some additional work cmake-parser looks well-suited for parsing the file to get the version.
Date-based versioning is not currently implemented in the build.rs build script. Once versioning is implemented it would also ideal to use it as an input to pkg-config to scan the system for the library.
See Making a *-sys crate for other possible enhancements.
Vendoring
Because we are vendoring April ASR source using a git submodule we have the ability to update the submodule to generate new bindings when the upstream source code changes.
To view the current commit of the april-asr submodule:
|
To update the submodule to the latest commit in the main branch of the submodule:
This command fetches the latest commits from the submodule's remote repository, checks out the commit referenced by the main branch, and updates the submodule in the main repository.
Releasing
Steps to package a release of this crate for crates.io:
- Update git submodule as described in Vendoring.
- Run
cargo cleanto remove existing build artifacts. - Run
cargo build --releaseto update generated bindings. - Inspect bindings as described in Development.
- Run
cargo testto execute unit tests including bindgen. - Run
cargo run --example initto check example. - Run
cargo docto generate crate docs and review them. - Bump the package version in
Cargo.tomlmanifest. - Run
cargo publish --dry-runto review your work. - Then
cargo loginandcargo publishto publish crate.
Once published visit docs.rs to review crate documentation.