Generate (e)gl_bindings based on feature set

This commit is contained in:
Victor Brekenfeld 2018-11-21 09:28:15 +01:00
parent ac0dc42e9e
commit 09e589b23c
2 changed files with 42 additions and 36 deletions

View File

@ -34,16 +34,18 @@ error-chain = "0.11.0"
lazy_static = "1.0.0"
[build-dependencies]
gl_generator = "0.9"
gl_generator = { version = "0.9", optional = true }
[features]
default = ["backend_winit", "backend_drm", "backend_libinput", "backend_udev", "renderer_glium", "xwayland"]
backend_winit = ["winit", "wayland-server/dlopen", "wayland-client/dlopen"]
backend_drm = ["drm", "gbm"]
backend_winit = ["winit", "wayland-server/dlopen", "wayland-client/dlopen", "backend_egl"]
backend_drm = ["drm", "backend_egl"]
backend_egl = ["gl_generator"]
backend_libinput = ["input"]
backend_session = []
backend_session_udev = ["udev", "backend_session"]
backend_session_logind = ["dbus", "systemd", "backend_session"]
backend_udev = ["udev", "backend_drm", "backend_session_udev"]
renderer_glium = ["glium"]
renderer_gl = ["gl_generator"]
renderer_glium = ["renderer_gl", "glium"]
xwayland = []

View File

@ -8,37 +8,41 @@ fn main() {
println!("cargo:rerun-if-changed=build.rs");
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();
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();
}
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::GlobalGenerator, &mut file)
.unwrap();
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();
}
}