mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Minor fixes in simpleservo: improve embedding C header generation. Don't recursively panic if embedder doesn't throw on panic. Make init_with_gl unavailable when doing non-WGL windows build.
This commit is contained in:
parent
0539043e35
commit
b19438ad07
3 changed files with 18 additions and 8 deletions
|
@ -17,11 +17,7 @@ fn main() {
|
||||||
let profile_dir = env::var("PROFILE").unwrap();
|
let profile_dir = env::var("PROFILE").unwrap();
|
||||||
path.push(profile_dir);
|
path.push(profile_dir);
|
||||||
path.push("simpleservo.h");
|
path.push("simpleservo.h");
|
||||||
cbindgen::Builder::new()
|
cbindgen::generate(crate_dir)
|
||||||
.with_crate(crate_dir)
|
.expect("Unable to generate C bindings")
|
||||||
.with_language(cbindgen::Language::C)
|
|
||||||
.exclude_item("OutputDebugStringA")
|
|
||||||
.generate()
|
|
||||||
.expect("Unable to generate bindings")
|
|
||||||
.write_to_file(path);
|
.write_to_file(path);
|
||||||
}
|
}
|
||||||
|
|
9
ports/libsimpleservo/capi/cbindgen.toml
Normal file
9
ports/libsimpleservo/capi/cbindgen.toml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
language = "C"
|
||||||
|
include_guard = "simpleservo_h"
|
||||||
|
cpp_compat = true
|
||||||
|
tab_width = 4
|
||||||
|
documentation_style = "c99"
|
||||||
|
|
||||||
|
[export]
|
||||||
|
exclude = ["OutputDebugStringA"]
|
||||||
|
|
|
@ -58,7 +58,8 @@ fn report_panic(reason: &str, backtrace: Option<String>) {
|
||||||
};
|
};
|
||||||
let error = CString::new(message).expect("Can't create string");
|
let error = CString::new(message).expect("Can't create string");
|
||||||
(ON_PANIC.read().unwrap())(error.as_ptr());
|
(ON_PANIC.read().unwrap())(error.as_ptr());
|
||||||
panic!("At that point, embedder should have thrown");
|
// At this point, embedder should probably have thrown, so we never reach
|
||||||
|
// this point. But if it didn't, don't recursively panic.
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(target_os = "windows"))]
|
#[cfg(not(target_os = "windows"))]
|
||||||
|
@ -490,7 +491,11 @@ pub extern "C" fn init_with_egl(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(target_os = "linux", target_os = "windows", target_os = "macos"))]
|
#[cfg(any(
|
||||||
|
target_os = "linux",
|
||||||
|
all(target_os = "windows", not(feature = "no-wgl")),
|
||||||
|
target_os = "macos"
|
||||||
|
))]
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn init_with_gl(
|
pub extern "C" fn init_with_gl(
|
||||||
opts: CInitOptions,
|
opts: CInitOptions,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue