From 10e49ef42980c13c613e0648c2c94d4de45729ac Mon Sep 17 00:00:00 2001 From: Erin Swenson-Healey Date: Thu, 20 Jun 2019 14:27:43 -0700 Subject: [PATCH] feat(write header file to OUT_DIR as per cargo build docs) (#7) --- sector-builder-ffi/build.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sector-builder-ffi/build.rs b/sector-builder-ffi/build.rs index 76dd820..d33dc5d 100644 --- a/sector-builder-ffi/build.rs +++ b/sector-builder-ffi/build.rs @@ -1,4 +1,5 @@ use std::env; +use std::path::Path; use std::path::PathBuf; fn main() { @@ -6,11 +7,11 @@ fn main() { let out_path = env::var("OUT_DIR").unwrap(); let mfs_path = std::env::var("CARGO_MANIFEST_DIR").unwrap(); - let hdr_path = "include/sector_builder_ffi.h"; + let hdr_path = Path::new(&out_path).join("include/sector_builder_ffi.h"); cbindgen::generate(mfs_path.clone()) .expect("Could not generate header") - .write_to_file(hdr_path); + .write_to_file(hdr_path.clone()); let b = bindgen::builder() .header(PathBuf::from(mfs_path).join(hdr_path).to_string_lossy())