use std::env;
use std::path::PathBuf;
extern crate bindgen;
fn generate_bindings() {
let header_path =
PathBuf::from(env::var("CARGO_SCRIPT_BASE_PATH").unwrap()).join("../quickjs+extern.h");
let out_path = PathBuf::from(env::var("CARGO_SCRIPT_BASE_PATH").unwrap()).join("../src");
let bindings = bindgen::Builder::default()
.header(
header_path
.to_str()
.expect("Could not create QuickJS path")
.to_string(),
)
.opaque_type("JSValue")
.whitelist_function("(JS|js).*")
.whitelist_type("(JS|js).*")
.whitelist_var("(JS|js).*")
.size_t_is_usize(true)
.derive_debug(true)
.generate()
.expect("Unable to generate bindings");
bindings
.write_to_file(out_path.join("bindings.rs"))
.expect("Couldn't write bindings!");
}
fn main() {
generate_bindings();
}