File tree 1 file changed +34
-0
lines changed
1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -76,6 +76,40 @@ $ LIBCLANG_PATH=path/to/clang-3.9/build/lib \
76
76
cargo build
77
77
```
78
78
79
+ # Library usage with ` build.rs `
80
+
81
+ In ` Cargo.toml ` :
82
+
83
+ ``` toml
84
+ [package ]
85
+ ...
86
+ build = " build.rs"
87
+
88
+ [build-dependencies .libbindgen ]
89
+ git = " https://github.com/servo/rust-bindgen"
90
+ features = [" llvm_stable" ]
91
+ ```
92
+
93
+ In ` build.rs ` :
94
+
95
+ ``` rust
96
+ extern crate libbindgen;
97
+
98
+ fn main () {
99
+ let _ = libbindgen :: builder ()
100
+ . header (" example.h" )
101
+ . use_core ()
102
+ . generate (). unwrap ()
103
+ . write_to_file (concat! (env! (" OUT_DIR" ), " /example.rs" ));
104
+ }
105
+ ```
106
+
107
+ In ` src/main.rs ` :
108
+
109
+ ``` rust
110
+ include! (concat! (env! (" OUT_DIR" ), " /example.rs" ));
111
+ ```
112
+
79
113
# Command Line Usage
80
114
81
115
There are a few options documented when running ` ./bindgen --help ` . Other
You can’t perform that action at this time.
0 commit comments