Skip to content

Commit 93adc70

Browse files
tmfinkemilio
authored andcommitted
Document environment variables in README
Mention BINDGEN_EXTRA_CLANG_ARGS and clang-sys variables.
1 parent de23676 commit 93adc70

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,28 @@ No MSRV bump policy has been established yet, so MSRV may increase in any releas
4747

4848
[API reference documentation is on docs.rs](https://docs.rs/bindgen)
4949

50+
## Environment Variables
51+
52+
In addition to the [library API](https://docs.rs/bindgen) and [executable command-line API][bindgen-cmdline],
53+
`bindgen` can be controlled through environment variables.
54+
55+
End-users should set these environment variables to modify `bindgen`'s behavior without modifying the source code of direct consumers of `bindgen`.
56+
57+
- `BINDGEN_EXTRA_CLANG_ARGS`: extra arguments to pass to `clang`
58+
- Arguments are whitespace-separated
59+
- Use shell-style quoting to pass through whitespace
60+
- Examples:
61+
- Specify alternate sysroot: `--sysroot=/path/to/sysroot`
62+
- Add include search path with spaces: `-I"/path/with spaces"`
63+
64+
Additionally, `bindgen` uses `libclang` to parse C and C++ header files.
65+
To modify how `bindgen` searches for `libclang`, see the [`clang-sys` documentation][clang-sys-env].
66+
For more details on how `bindgen` uses `libclang`, see the [`bindgen` users guide][bindgen-book-clang].
67+
5068
## Contributing
5169

5270
[See `CONTRIBUTING.md` for hacking on `bindgen`!](./CONTRIBUTING.md)
71+
72+
[bindgen-cmdline]: https://rust-lang.github.io/rust-bindgen/command-line-usage.html
73+
[clang-sys-env]: https://github.com/KyleMayes/clang-sys#environment-variables
74+
[bindgen-book-clang]: https://rust-lang.github.io/rust-bindgen/requirements.html#clang

0 commit comments

Comments
 (0)