This is hopefully a simple question/enhancement request. I'm new to Rust bindgen and clang -- apologies if this has been asked before.
I am trying to generate bindings for an open source project where some header files are generated as part of their build. So they have some header files in src tree and some in build, but they don't specify the full path in the source headers.
For example:
src/h1.h
#include "h2.h"
...
build/generated-source/h2.h
...
Bindgen fails to find h2.h when parsing h1.h. Is there any way to have bindgen work with this kind of structure directly, or do I need to copy the required header files to a common location?
Thanks
You can pass whatever args you would give to clang to find the include to bindgen as well (after a --), eg:
$ bindgen <bindgen-things> -- -Ibuild/generated-source
or, if you're using a Builder:
bindgen::Builder::default()
// ...
.clang_arg("-Ibuild/generated-source")
// ...
If this doesn't resolve your problems, please reopen :)
Most helpful comment
You can pass whatever args you would give to clang to find the include to bindgen as well (after a
--), eg:or, if you're using a
Builder:If this doesn't resolve your problems, please reopen :)