2020-07-01 00:56:00 -07:00
|
|
|
extern crate cbindgen;
|
|
|
|
|
|
|
|
use std::env;
|
|
|
|
|
|
|
|
fn main() {
|
2020-08-07 17:42:46 -07:00
|
|
|
println!("cargo:rerun-if-env-changed=SPL_CBINDGEN");
|
|
|
|
println!("cargo:rerun-if-changed=inc/token-swap.h");
|
|
|
|
if std::path::Path::new("inc/token-swap.h").exists() && env::var("SPL_CBINDGEN").is_err() {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
println!("cargo:warning=Generating inc/token-swap.h");
|
2020-07-01 00:56:00 -07:00
|
|
|
let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
|
|
|
|
cbindgen::generate(&crate_dir)
|
|
|
|
.unwrap()
|
|
|
|
.write_to_file("inc/token-swap.h");
|
|
|
|
}
|