Skip to content
This repository has been archived by the owner on Jun 8, 2022. It is now read-only.

Commit

Permalink
feat(write header file to OUT_DIR as per cargo build docs) (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
laser authored Jun 20, 2019
1 parent cc6bae3 commit 10e49ef
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sector-builder-ffi/build.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
use std::env;
use std::path::Path;
use std::path::PathBuf;

fn main() {
println!("cargo:rerun-if-changed=src/");

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())
Expand Down

0 comments on commit 10e49ef

Please sign in to comment.