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 --- build.rs | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) (limited to 'build.rs') diff --git a/build.rs b/build.rs index bdc2a55..513a65b 100644 --- a/build.rs +++ b/build.rs @@ -2,26 +2,17 @@ use std::env; use std::error::Error; use std::path::PathBuf; -use bindgen::{CodegenConfig, MacroTypeVariation}; +use crate::codegen::bindings::generate_bindings; +use crate::codegen::generate_using_registry; + +mod codegen; pub fn main() -> 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()?; - - let out_path = PathBuf::from(env::var("OUT_DIR")?); + let out_dir = PathBuf::from(env::var("OUT_DIR")?); - bindings.write_to_file(out_path.join("bindings.rs"))?; + generate_bindings(&out_dir.join("bindings.rs"))?; + generate_using_registry(&out_dir.join("generated.rs"))?; Ok(()) } -- cgit v1.2.3-18-g5258