mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
egl-configs: link to EGL and generate bindings
This commit is contained in:
parent
eab971cba1
commit
90ba22b8d2
5 changed files with 100 additions and 3 deletions
51
support/android/egl-configs/Cargo.lock
generated
51
support/android/egl-configs/Cargo.lock
generated
|
@ -1,4 +1,55 @@
|
|||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "1.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "egl-configs"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"gl_generator 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gl_generator"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"khronos_api 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"xml-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "khronos_api"
|
||||
version = "2.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "xml-rs"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[metadata]
|
||||
"checksum bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d0c54bb8f454c567f21197eefcdbf5679d0bd99f2ddbe52e84c77061952e6789"
|
||||
"checksum cfg-if 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "405216fd8fe65f718daa7102ea808a946b6ce40c742998fbfd3463645552de18"
|
||||
"checksum gl_generator 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a795170cbd85b5a7baa58d6d7525cae6a03e486859860c220f7ebbbdd379d0a"
|
||||
"checksum khronos_api 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "037ab472c33f67b5fbd3e9163a2645319e5356fcd355efa6d4eb7fff4bbcb554"
|
||||
"checksum log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6fddaa003a65722a7fb9e26b0ce95921fe4ba590542ced664d8ce2fa26f9f3ac"
|
||||
"checksum xml-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3c1cb601d29fe2c2ac60a2b2e5e293994d87a1f6fa9687a31a15270f909be9c2"
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
[package]
|
||||
name = "egl-configs"
|
||||
version = "0.1.0"
|
||||
|
||||
[build-dependencies]
|
||||
gl_generator = "0.9"
|
||||
|
|
16
support/android/egl-configs/build.rs
Normal file
16
support/android/egl-configs/build.rs
Normal file
|
@ -0,0 +1,16 @@
|
|||
extern crate gl_generator;
|
||||
|
||||
use gl_generator::{Registry, Api, Profile, Fallbacks};
|
||||
use std::env;
|
||||
use std::fs::File;
|
||||
use std::path::PathBuf;
|
||||
|
||||
fn main() {
|
||||
let out_dir = PathBuf::from(&env::var("OUT_DIR").unwrap());
|
||||
let mut file = File::create(&out_dir.join("egl_bindings.rs")).unwrap();
|
||||
Registry::new(Api::Egl, (1, 5), Profile::Core, Fallbacks::All, [
|
||||
"EGL_KHR_create_context",
|
||||
"EGL_KHR_platform_android",
|
||||
])
|
||||
.write_bindings(gl_generator::StaticGenerator, &mut file).unwrap();
|
||||
}
|
21
support/android/egl-configs/src/ffi.rs
Normal file
21
support/android/egl-configs/src/ffi.rs
Normal file
|
@ -0,0 +1,21 @@
|
|||
#![allow(non_camel_case_types)]
|
||||
|
||||
use std::os::raw::*;
|
||||
|
||||
pub type NativeDisplayType = *const c_void;
|
||||
pub type NativePixmapType = *const c_void;
|
||||
pub type NativeWindowType = *const c_void;
|
||||
|
||||
pub type EGLNativeDisplayType = NativeDisplayType;
|
||||
pub type EGLNativePixmapType = NativePixmapType;
|
||||
pub type EGLNativeWindowType = NativeWindowType;
|
||||
|
||||
pub type khronos_utime_nanoseconds_t = khronos_uint64_t;
|
||||
pub type khronos_uint64_t = u64;
|
||||
pub type khronos_ssize_t = c_long;
|
||||
pub type EGLint = i32;
|
||||
|
||||
#[link(name = "EGL")]
|
||||
extern "C" {}
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/egl_bindings.rs"));
|
|
@ -1,6 +1,12 @@
|
|||
mod ffi;
|
||||
use ffi::*;
|
||||
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
for arg in std::env::args() {
|
||||
println!("{}", arg);
|
||||
unsafe {
|
||||
run()
|
||||
}
|
||||
}
|
||||
|
||||
unsafe fn run() {
|
||||
let _display = GetDisplay(DEFAULT_DISPLAY as *mut _);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue