ctru-rs-old
ctru-rs-old copied to clipboard
Generate ctru-sys as part of the build system
Have a look at rust-bindgen, it can create -sys crates automatically from headers, which will alleviate a good part of your work.
Actually, I didn’t see it was already generated, my request then is to make it automated as part of the build system, or at least documenting how to update it.
IIRC we opted for generating them only when needed to stay in sync with a specific libctru release.
I have a script for citro3d-sys to generate bindings, which I will probably port over for libctru-sys. It might even make sense to use some sort of Rust task runner like cargo-make
or even just cargo-script
instead (to get away from platform dependant scripts).
It was exactly for citro3d that I wanted to use this. :) I’ll wait for your release then, thanks!
citro3d is a bit of a pain to port to safe Rust, but I intended to at least release a sys crate
Here you go: https://github.com/rust3ds/citro3d-sys
I didn't manage to verify that the crate still builds properly because ctru-rs doesn't build for me right now and I have no time to figure out why.
For the record, this is the build script I used to generate ctru-sys locally last time I updated it: https://github.com/FenrirWolf/ctru-rs/blob/bindgen/ctru-sys/build.rs
We definitely could generate the bindings at build-time by default instead of checking them in manually, but the trade-off there is that running bindgen increases compile times and adds a dependency on clang.