2018-11-22 11:13:11 +00:00
|
|
|
#[cfg(any(feature = "backend_egl", feature = "renderer_gl"))]
|
2017-05-18 20:28:02 +00:00
|
|
|
extern crate gl_generator;
|
|
|
|
|
2018-11-22 11:13:11 +00:00
|
|
|
#[cfg(any(feature = "backend_egl", feature = "renderer_gl"))]
|
2017-05-21 20:40:15 +00:00
|
|
|
use gl_generator::{Api, Fallbacks, Profile, Registry};
|
2018-10-04 22:37:43 +00:00
|
|
|
use std::{env, fs::File, path::PathBuf};
|
2017-05-18 20:28:02 +00:00
|
|
|
|
2018-11-22 17:21:44 +00:00
|
|
|
#[cfg(any(feature = "backend_egl", feature = "renderer_gl"))]
|
2017-05-18 20:28:02 +00:00
|
|
|
fn main() {
|
|
|
|
let dest = PathBuf::from(&env::var("OUT_DIR").unwrap());
|
|
|
|
|
|
|
|
println!("cargo:rerun-if-changed=build.rs");
|
|
|
|
|
2018-11-21 08:28:15 +00:00
|
|
|
if env::var_os("CARGO_FEATURE_BACKEND_EGL").is_some() {
|
|
|
|
let mut file = File::create(&dest.join("egl_bindings.rs")).unwrap();
|
|
|
|
Registry::new(
|
|
|
|
Api::Egl,
|
|
|
|
(1, 5),
|
|
|
|
Profile::Core,
|
|
|
|
Fallbacks::All,
|
|
|
|
[
|
|
|
|
"EGL_KHR_create_context",
|
|
|
|
"EGL_EXT_create_context_robustness",
|
|
|
|
"EGL_KHR_create_context_no_error",
|
|
|
|
"EGL_KHR_platform_x11",
|
|
|
|
"EGL_KHR_platform_android",
|
|
|
|
"EGL_KHR_platform_wayland",
|
|
|
|
"EGL_KHR_platform_gbm",
|
|
|
|
"EGL_EXT_platform_base",
|
|
|
|
"EGL_EXT_platform_x11",
|
|
|
|
"EGL_MESA_platform_gbm",
|
|
|
|
"EGL_EXT_platform_wayland",
|
|
|
|
"EGL_EXT_platform_device",
|
|
|
|
"EGL_KHR_image_base",
|
|
|
|
],
|
|
|
|
).write_bindings(gl_generator::GlobalGenerator, &mut file)
|
|
|
|
.unwrap();
|
|
|
|
}
|
2017-12-10 21:09:17 +00:00
|
|
|
|
2018-11-21 08:28:15 +00:00
|
|
|
if env::var_os("CARGO_FEATURE_RENDERER_GL").is_some() {
|
|
|
|
let mut file = File::create(&dest.join("gl_bindings.rs")).unwrap();
|
|
|
|
Registry::new(
|
|
|
|
Api::Gles2,
|
|
|
|
(3, 2),
|
|
|
|
Profile::Compatibility,
|
|
|
|
Fallbacks::None,
|
|
|
|
["GL_OES_EGL_image"],
|
|
|
|
).write_bindings(gl_generator::StructGenerator, &mut file)
|
|
|
|
.unwrap();
|
|
|
|
}
|
2017-05-18 20:28:02 +00:00
|
|
|
}
|
2018-11-22 09:14:23 +00:00
|
|
|
|
2018-11-22 11:13:11 +00:00
|
|
|
#[cfg(not(any(feature = "backend_egl", feature = "renderer_gl")))]
|
2018-11-23 14:11:27 +00:00
|
|
|
fn main() {}
|