mozilla / cbindgen

A project for generating C bindings from Rust code
Mozilla Public License 2.0
2.37k stars 306 forks source link

Add optional depfile output #815

Closed jschwe closed 1 year ago

jschwe commented 1 year ago

Hi,

I'm working on integrating cbindgen into a foreign build system (CMake), and it would be great if cbindgen could output a depfile listing the input source files, so my build system knows when to rerun cbindgen for a given crate. I would also be willing to work on a PR for this feature, if the chances are good for this feature request to be accepted.

Edit: the required information seems to already be saved in bindgen::builder, so outputting this to a depfile should be a small change.

Edit 2: bindgen::Parser.cache_src seems to contain the remaining filepaths.

emilio commented 1 year ago

Sounds reasonable. bindgen has a similar feature fwiw.