forked from asny/three-d
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.rs
26 lines (23 loc) · 791 Bytes
/
build.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
fn main() {
#[cfg(not(target_arch = "wasm32"))]
setup_opengl();
}
#[cfg(not(target_arch = "wasm32"))]
fn setup_opengl() {
use std::env;
use std::fs::File;
use std::path::Path;
let out_dir = env::var("OUT_DIR").unwrap();
let mut file_gl = File::create(&Path::new(&out_dir).join("bindings.rs")).unwrap();
use gl_generator::{Api, DebugStructGenerator, Fallbacks, Profile, Registry, StructGenerator};
let registry = Registry::new(Api::Gl, (4, 3), Profile::Core, Fallbacks::All, []);
if env::var("CARGO_FEATURE_DEBUG").is_ok() {
registry
.write_bindings(DebugStructGenerator, &mut file_gl)
.unwrap();
} else {
registry
.write_bindings(StructGenerator, &mut file_gl)
.unwrap();
}
}