summaryrefslogtreecommitdiff
path: root/glfw/build.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2023-10-06 20:55:07 +0200
committerHampusM <hampus@hampusmat.com>2023-10-06 20:55:07 +0200
commitf255db0f9252f4041b120dcaa00470889c4cb9f4 (patch)
tree94a56d2acc3cacdaebdae1dd9b37d533b9e7368f /glfw/build.rs
parente40fd63dd35430f234d65806ca7e0d6bea364bfc (diff)
feat: add GLFW wrapper library
Diffstat (limited to 'glfw/build.rs')
-rw-r--r--glfw/build.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/glfw/build.rs b/glfw/build.rs
new file mode 100644
index 0000000..aaf4446
--- /dev/null
+++ b/glfw/build.rs
@@ -0,0 +1,28 @@
+use std::env;
+use std::error::Error;
+use std::path::PathBuf;
+
+use bindgen::MacroTypeVariation;
+
+fn main() -> Result<(), Box<dyn Error>>
+{
+ println!("cargo:rustc-link-lib=glfw");
+
+ println!("cargo:rerun-if-changed=glfw.h");
+
+ let bindings = bindgen::Builder::default()
+ .header("glfw.h")
+ .clang_arg("-fretain-comments-from-system-headers")
+ .generate_comments(true)
+ .allowlist_function("glfw.*")
+ .allowlist_type("GLFW.*")
+ .allowlist_var("GLFW.*")
+ .default_macro_constant_type(MacroTypeVariation::Signed)
+ .generate()?;
+
+ let out_path = PathBuf::from(env::var("OUT_DIR")?);
+
+ bindings.write_to_file(out_path.join("bindings.rs"))?;
+
+ Ok(())
+}