mirror of https://github.com/status-im/evmc.git
30 lines
876 B
Rust
30 lines
876 B
Rust
extern crate bindgen;
|
|
|
|
use std::env;
|
|
use std::path::PathBuf;
|
|
|
|
fn gen_bindings() {
|
|
let bindings = bindgen::Builder::default()
|
|
.header("evmc.h")
|
|
// See https://github.com/rust-lang-nursery/rust-bindgen/issues/947
|
|
.trust_clang_mangling(false)
|
|
.generate_comments(true)
|
|
// https://github.com/rust-lang-nursery/rust-bindgen/issues/947#issuecomment-327100002
|
|
.layout_tests(false)
|
|
// do not generate an empty enum for EVMC_ABI_VERSION
|
|
.constified_enum("")
|
|
// generate Rust enums for each evmc enum
|
|
.rustified_enum("*")
|
|
.generate()
|
|
.expect("Unable to generate bindings");
|
|
|
|
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
|
|
bindings
|
|
.write_to_file(out_path.join("bindings.rs"))
|
|
.expect("Couldn't write bindings!");
|
|
}
|
|
|
|
fn main() {
|
|
gen_bindings();
|
|
}
|