diff --git a/ports/libsimpleservo/capi/build.rs b/ports/libsimpleservo/capi/build.rs index ad1bfa9e796..57292d2d258 100644 --- a/ports/libsimpleservo/capi/build.rs +++ b/ports/libsimpleservo/capi/build.rs @@ -17,11 +17,7 @@ fn main() { let profile_dir = env::var("PROFILE").unwrap(); path.push(profile_dir); path.push("simpleservo.h"); - cbindgen::Builder::new() - .with_crate(crate_dir) - .with_language(cbindgen::Language::C) - .exclude_item("OutputDebugStringA") - .generate() - .expect("Unable to generate bindings") + cbindgen::generate(crate_dir) + .expect("Unable to generate C bindings") .write_to_file(path); } diff --git a/ports/libsimpleservo/capi/cbindgen.toml b/ports/libsimpleservo/capi/cbindgen.toml new file mode 100644 index 00000000000..2d6ddc3e531 --- /dev/null +++ b/ports/libsimpleservo/capi/cbindgen.toml @@ -0,0 +1,9 @@ +language = "C" +include_guard = "simpleservo_h" +cpp_compat = true +tab_width = 4 +documentation_style = "c99" + +[export] +exclude = ["OutputDebugStringA"] + diff --git a/ports/libsimpleservo/capi/src/lib.rs b/ports/libsimpleservo/capi/src/lib.rs index 7ff2c328e16..be28626c0ad 100644 --- a/ports/libsimpleservo/capi/src/lib.rs +++ b/ports/libsimpleservo/capi/src/lib.rs @@ -58,7 +58,8 @@ fn report_panic(reason: &str, backtrace: Option) { }; let error = CString::new(message).expect("Can't create string"); (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"))] @@ -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] pub extern "C" fn init_with_gl( opts: CInitOptions,