Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for outputting dependencies #192

Closed
luser opened this issue Aug 13, 2018 · 3 comments · Fixed by #820
Closed

Add support for outputting dependencies #192

luser opened this issue Aug 13, 2018 · 3 comments · Fixed by #820

Comments

@luser
Copy link

luser commented Aug 13, 2018

It would be nice if cbindgen could provide the full list of input files it used to generate proper dependencies for build systems. @emilio is adding cbindgen to the Firefox build and his glue code is manually providing dependencies which makes me worry that that list could be incorrect, which would result in broken builds.

@emilio
Copy link
Collaborator

emilio commented Aug 13, 2018

This should be easyish to implement, I could even try to give it a shot. @luser do you know what's the standard way to do it?

  • Just with a flag + stdout?
  • Providing a file we can read the dependencies from?

Thanks :)

@dcbaker
Copy link

dcbaker commented Jan 5, 2023

I'm working on Rust support in meson, and native support for cbindgen is on my radar as something I'll need, and internal dependency tracking would be excellent. There is a pretty standard format used by both ninja and make (among others), which is essentially a makefile snippet in the form:

output: depends1 depends 2

or, with linebreaks:

output: depends1\
depends2

This format is supported by both gcc and clang (and, because bindgen is ultimately a wrapper around clang, you can get this information out of bindgen by passing arguments to clang), and can automatically be consumed by ninja and make.

For me (and anyone else wanted to pass this information to make or ninja), having this dependency information writte to a file as a side effect of cbindgen is ideal, something in the form of: cbindgen ... --dep-file=dependencies.d.

I'd be willing to work on this if you're not, but I'd appreciate some pointers on where to get started.

@jschwe
Copy link
Contributor

jschwe commented Mar 9, 2023

@dcbaker I have a PR for this (#820), and initial testing shows that it works as expected with CMake. Maybe you could have a look if it also works for meson and share some feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants