Open gfxstrand opened 5 months ago
@dwlsalmeida and I had been talking about this a while back, and I have some work on this. I pushed the work I have, which is not completed. Let me have a look at what's in Mesa and we'll go from there
Probably the biggiest annoyance is that we have to list every Rust file in the meson instead of just invoking it on lib.rs and letting it go. That could probably be wrapped by Meson for us.
I asked them to add support for Make compatible depfiles, and it was added, so with more recent versions of cbindgen this isn't a problem, cbindgen will tell Ninja about any files it consumes, and Ninja will do the right thing.
Okay, I opened a Draft PR with what I have cleaned up a little bit. I've also checked this with Mesa, and it seems to work for the one case there so far.
We currently have a very handy built-in wrapper for bindgen:
We don't have anything similar for cbindgen. Currently in Mesa, we're invoking it directly via
custom_target()
and that works okay but it's a bit clunky:It seems to be very much designed to be run from cargo but it is possible to invoke from Meson with some work. Probably the biggiest annoyance is that we have to list every Rust file in the meson instead of just invoking it on
lib.rs
and letting it go. That could probably be wrapped by Meson for us.I don't have a particular proposal for what I want
rust.cbindgen()
to look like but I think we can do better than us having to list a bunch of rust files.