diff options
| author | HampusM <hampus@hampusmat.com> | 2023-02-19 22:15:04 +0100 | 
|---|---|---|
| committer | HampusM <hampus@hampusmat.com> | 2023-02-19 22:20:36 +0100 | 
| commit | 95ef9331e5dac2cd1d8dc2087c4535a87addb216 (patch) | |
| tree | 41319333084a1dbf60025887ef15e17e67751c4d /build.rs | |
| parent | 572b17953054091009ddfacb050cae06c60f0490 (diff) | |
feat: add project & bindings
Diffstat (limited to 'build.rs')
| -rw-r--r-- | build.rs | 27 | 
1 files changed, 27 insertions, 0 deletions
| diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..bdc2a55 --- /dev/null +++ b/build.rs @@ -0,0 +1,27 @@ +use std::env; +use std::error::Error; +use std::path::PathBuf; + +use bindgen::{CodegenConfig, MacroTypeVariation}; + +pub fn main() -> Result<(), Box<dyn Error>> +{ +    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")?); + +    bindings.write_to_file(out_path.join("bindings.rs"))?; + +    Ok(()) +} | 
