use std::env;
use std::path::PathBuf;
fn main() {
println!("cargo:rustc-link-lib=sgx_dcap_quoteverify");
println!("cargo:rerun-if-changed=bindings.h");
let mut builder = bindgen::Builder::default();
if let Ok(val) = env::var("SGX_SDK") {
let mut sdk_inc = String::from("-I");
sdk_inc.push_str(&val);
sdk_inc.push_str("/include/");
builder = builder.clang_arg(sdk_inc);
}
let bindings = builder
.header("bindings.h")
.newtype_enum("_quote3_error_t")
.newtype_enum("_sgx_ql_qv_result_t")
.rustified_enum("_sgx_ql_request_policy")
.rustified_enum("sgx_qv_path_type_t")
.no_debug("_quote_t")
.no_debug("_sgx_ql_auth_data_t")
.no_debug("_sgx_ql_certification_data_t")
.no_debug("_sgx_ql_ecdsa_sig_data_t")
.no_debug("_sgx_quote3_t")
.no_debug("_sgx_ql_att_key_id_param_t")
.derive_default(true)
.parse_callbacks(Box::new(bindgen::CargoCallbacks::new()))
.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!");
}