@kornel wrote up a really good article on how to create a *-sys
crate, a crate which exposes raw bindings to a native library and sorts out all of the building + linking steps.
It's more targeted towards a project that is meant to be published and used by lots of people (e.g. bindings to popular libraries like libgit2
or libssh
) so some of the steps and tips will be unnecessary for your use case, but you may find it enlightening.
Some other links:
- Linking and Building from the unofficial Rust FFI guide
- official docs for build scripts
- *How to make a *-sys crate thread on this forum