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" lazy_static = "1.0.0"
[build-dependencies] [build-dependencies]
gl_generator = "0.9" gl_generator = { version = "0.9", optional = true }
[features] [features]
default = ["backend_winit", "backend_drm", "backend_libinput", "backend_udev", "renderer_glium", "xwayland"] default = ["backend_winit", "backend_drm", "backend_libinput", "backend_udev", "renderer_glium", "xwayland"]
backend_winit = ["winit", "wayland-server/dlopen", "wayland-client/dlopen"] backend_winit = ["winit", "wayland-server/dlopen", "wayland-client/dlopen", "backend_egl"]
backend_drm = ["drm", "gbm"] backend_drm = ["drm", "backend_egl"]
backend_egl = ["gl_generator"]
backend_libinput = ["input"] backend_libinput = ["input"]
backend_session = [] backend_session = []
backend_session_udev = ["udev", "backend_session"] backend_session_udev = ["udev", "backend_session"]
backend_session_logind = ["dbus", "systemd", "backend_session"] backend_session_logind = ["dbus", "systemd", "backend_session"]
backend_udev = ["udev", "backend_drm", "backend_session_udev"] backend_udev = ["udev", "backend_drm", "backend_session_udev"]
renderer_glium = ["glium"] renderer_gl = ["gl_generator"]
renderer_glium = ["renderer_gl", "glium"]
xwayland = [] xwayland = []

View File

@ -8,37 +8,41 @@ fn main() {
println!("cargo:rerun-if-changed=build.rs"); println!("cargo:rerun-if-changed=build.rs");
let mut file = File::create(&dest.join("egl_bindings.rs")).unwrap(); if env::var_os("CARGO_FEATURE_BACKEND_EGL").is_some() {
Registry::new( let mut file = File::create(&dest.join("egl_bindings.rs")).unwrap();
Api::Egl, Registry::new(
(1, 5), Api::Egl,
Profile::Core, (1, 5),
Fallbacks::All, Profile::Core,
[ Fallbacks::All,
"EGL_KHR_create_context", [
"EGL_EXT_create_context_robustness", "EGL_KHR_create_context",
"EGL_KHR_create_context_no_error", "EGL_EXT_create_context_robustness",
"EGL_KHR_platform_x11", "EGL_KHR_create_context_no_error",
"EGL_KHR_platform_android", "EGL_KHR_platform_x11",
"EGL_KHR_platform_wayland", "EGL_KHR_platform_android",
"EGL_KHR_platform_gbm", "EGL_KHR_platform_wayland",
"EGL_EXT_platform_base", "EGL_KHR_platform_gbm",
"EGL_EXT_platform_x11", "EGL_EXT_platform_base",
"EGL_MESA_platform_gbm", "EGL_EXT_platform_x11",
"EGL_EXT_platform_wayland", "EGL_MESA_platform_gbm",
"EGL_EXT_platform_device", "EGL_EXT_platform_wayland",
"EGL_KHR_image_base", "EGL_EXT_platform_device",
], "EGL_KHR_image_base",
).write_bindings(gl_generator::GlobalGenerator, &mut file) ],
.unwrap(); ).write_bindings(gl_generator::GlobalGenerator, &mut file)
.unwrap();
}
let mut file = File::create(&dest.join("gl_bindings.rs")).unwrap(); if env::var_os("CARGO_FEATURE_RENDERER_GL").is_some() {
Registry::new( let mut file = File::create(&dest.join("gl_bindings.rs")).unwrap();
Api::Gles2, Registry::new(
(3, 2), Api::Gles2,
Profile::Compatibility, (3, 2),
Fallbacks::None, Profile::Compatibility,
["GL_OES_EGL_image"], Fallbacks::None,
).write_bindings(gl_generator::GlobalGenerator, &mut file) ["GL_OES_EGL_image"],
.unwrap(); ).write_bindings(gl_generator::StructGenerator, &mut file)
.unwrap();
}
} }