This commit is contained in:
TristanDebrunner
2019-07-15 13:17:17 -06:00
committed by GitHub
parent 04649de6a6
commit 6b86f85916
12 changed files with 777 additions and 18 deletions

24
sdk-c/build.rs Normal file
View File

@ -0,0 +1,24 @@
use std::env;
use std::fs;
use std::path::Path;
fn main() {
let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
let out_path = Path::new(&crate_dir);
let out_path = out_path.join(Path::new("include"));
// Ensure `out_path` exists
fs::create_dir_all(&out_path).unwrap_or_else(|err| {
if err.kind() != std::io::ErrorKind::AlreadyExists {
panic!("Unable to create {:#?}: {:?}", out_path, err);
}
});
let out_path = out_path.join(Path::new("solana.h"));
let out_path = out_path.to_str().unwrap();
cbindgen::generate(crate_dir)
.unwrap()
.write_to_file(out_path);
}