Skip to content

Commit

Permalink
set bindings output to correct path
Browse files Browse the repository at this point in the history
  • Loading branch information
joshprk committed Jul 7, 2024
1 parent 6eb54cf commit 80635f8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
15 changes: 9 additions & 6 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::collections::HashSet;
use std::{collections::HashSet, env, path::PathBuf};

#[derive(Debug)]
struct IgnoreMacros(HashSet<String>);
Expand Down Expand Up @@ -35,9 +35,9 @@ fn get_ignored_macros() -> IgnoreMacros {
fn main() {
println!("cargo:rustc-link-search=native={}", env!("CARGO_MANIFEST_DIR"));
println!("cargo:rustc-link-lib=obs");
println!("cargo:rustc-env=LIBOBS_BINDINGS_FILE=bindings.rs");
// println!("cargo:rustc-env=LIBOBS_BINDINGS_FILE=bindings.rs");

bindgen::builder()
let bindings = bindgen::builder()
.header("headers/obs.h")
.blocklist_function("_bindgen_ty_2")
.parse_callbacks(Box::new(get_ignored_macros()))
Expand All @@ -52,7 +52,10 @@ fn main() {
.layout_tests(false)
.merge_extern_blocks(true)
.generate()
.expect("Error generating bindings")
.write_to_file(&format!("{}/src/bindings.rs", env!("CARGO_MANIFEST_DIR")))
.expect("Error outputting bindings");
.expect("Error generating 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!");
}
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@

pub mod wrapper;

include!(env!("LIBOBS_BINDINGS_FILE"));
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));

0 comments on commit 80635f8

Please sign in to comment.