-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.rs
37 lines (30 loc) · 1.28 KB
/
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
27
28
29
30
31
32
33
34
35
36
37
use std::env;
use std::fs::File;
use std::path::PathBuf;
use cfg_aliases::cfg_aliases;
use gl_generator::{Api, Fallbacks, Profile, Registry, StructGenerator};
fn main() {
cfg_aliases! {
// Systems.
android: { target_os = "android" },
wasm: { target_arch = "wasm32" },
macos: { target_os = "macos" },
ios: { target_os = "ios" },
apple: { any(target_os = "ios", target_os = "macos") },
free_unix: { all(unix, not(apple), not(android)) },
// Native displays.
x11_platform: { all(feature = "x11", free_unix, not(wasm)) },
wayland_platform: { all(feature = "wayland", free_unix, not(wasm)) },
// Backends.
egl_backend: { all(feature = "egl", any(windows, unix), not(apple), not(wasm)) },
glx_backend: { all(feature = "glx", x11_platform, not(wasm)) },
wgl_backend: { all(feature = "wgl", windows, not(wasm)) },
cgl_backend: { all(macos, not(wasm)) },
}
let dest = PathBuf::from(&env::var("OUT_DIR").unwrap());
println!("cargo:rerun-if-changed=build.rs");
let mut file = File::create(dest.join("gl_bindings.rs")).unwrap();
Registry::new(Api::Gl, (3, 3), Profile::Core, Fallbacks::All, [])
.write_bindings(StructGenerator, &mut file)
.unwrap();
}