Decoupling this project from Cargo
Hi,
I was trying to use cbindgen in a meson project, and noticed that it is not possible currently.
Mainly, cbindgen expects to be able to call cargo expand, it also expects a Cargo.lock and to be able to call cargo metadata.
I wonder whether it is possible to decouple this project from Cargo, such that non-cargo projects can benefit from cbindgen like they do from bindgen itself.
Thoughts?
Meson developer here, we likely can provide at least most of the data that cargo metadata does and pass that via the --metadata flag if that was what was required, thought the Cargo.lock is more problematic. cargo expand looks like it's just a wrapper around rustc anyway, so that should be fairly trivial to change, if that would be acceptable
@dcbaker turns out that this works: cbindgen --lang c -- lib.rs
Yeah, cargo is only used to compute metadata, if you feed cbindgen the right files / metadata it should work without cargo.
Please reopen if there's anything more concrete to do here. We really don't want to re-implement the cargo crate graph resolution ourselves if we can help it :)
Hi @emilio
I think what is missing is explaining that this project can be used without Cargo in the README file.
Currently, there is only this:
cbindgen --config cbindgen.toml --crate my_rust_library --output my_header.h
So it is not far-fetched to say that people may think that using Cargo is a pre-requisite to use cbindgen, which is not true.