From 966ebb03abd8ae5ed4f47f4b53c00222269a56b4 Mon Sep 17 00:00:00 2001 From: HampusM Date: Fri, 7 Apr 2023 20:20:43 +0200 Subject: refactor: replace usage of opengl-registry-macros --- codegen/bindings.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 codegen/bindings.rs (limited to 'codegen/bindings.rs') diff --git a/codegen/bindings.rs b/codegen/bindings.rs new file mode 100644 index 0000000..d6b7e0d --- /dev/null +++ b/codegen/bindings.rs @@ -0,0 +1,24 @@ +use std::error::Error; +use std::path::Path; + +use bindgen::{CodegenConfig, MacroTypeVariation}; + +pub fn generate_bindings(dest_file: &Path) -> Result<(), Box> +{ + println!("cargo:rerun-if-changed=gl.h"); + + let bindings = bindgen::Builder::default() + .header("gl.h") + .default_macro_constant_type(MacroTypeVariation::Signed) + .with_codegen_config(CodegenConfig::all() & !CodegenConfig::FUNCTIONS) + .allowlist_type("GL.*") + .allowlist_type("_cl_.*") + .allowlist_var("GL_.*") + .blocklist_item("GL_Z4.*") + .blocklist_item("GL_Z6.*") + .generate()?; + + bindings.write_to_file(dest_file)?; + + Ok(()) +} -- cgit v1.2.3-18-g5258