diff --git a/Cargo.toml b/Cargo.toml index 5ed0059..35d2dc8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,7 @@ members = [ ] [workspace.package] -version = "151.8.0+151.3.24" +version = "151.8.1+151.3.24" edition = "2021" license = "Apache-2.0 OR MIT" authors = [ @@ -24,7 +24,7 @@ repository = "https://github.com/tauri-apps/cef-rs" [workspace.dependencies] cef = { path = "cef", default-features = false } -cef-dll-sys = { version = "151.8.0", path = "sys" } +cef-dll-sys = { version = "151.8.1", path = "sys" } download-cef = { version = "2.3", path = "download-cef" } anyhow = "1" diff --git a/sys/CHANGELOG.md b/sys/CHANGELOG.md index 877bfad..49ceb5e 100644 --- a/sys/CHANGELOG.md +++ b/sys/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [151.8.1+151.3.24](https://github.com/tauri-apps/cef-rs/compare/cef-dll-sys-v151.8.0+151.3.24...cef-dll-sys-v151.8.1+151.3.24) - 2026-09-03 + +### Fixed + +- explicit API version for wrapper + ## [151.5.0+151.3.17](https://github.com/tauri-apps/cef-rs/compare/cef-dll-sys-v151.4.0+151.3.17...cef-dll-sys-v151.5.0+151.3.17) - 2026-08-15 ### Added diff --git a/sys/build.rs b/sys/build.rs index bf8b024..4eae587 100644 --- a/sys/build.rs +++ b/sys/build.rs @@ -120,11 +120,29 @@ fn main() -> anyhow::Result<()> { println!("cargo::metadata=CEF_DIR={cef_dir_str}"); println!("cargo::rustc-link-search=native={cef_dir_str}"); + // Compile the wrapper against an explicit API version instead of the + // experimental (unversioned) API that CEF selects by default, which its + // own headers call "not back/forward compatible with different CEF + // versions". It is the version the crate declares at run time through + // `cef_api_hash(CEF_API_VERSION_LAST)`, so the two now agree; without it + // the macOS loader in `libcef_dll_dylib.cc` also resolves experimental + // entry points, and loading any libcef but this exact build fails on the + // first one missing. + let api_version = cef_api_version_last(&cef_dir)?; + println!("cargo::metadata=CEF_API_VERSION={api_version}"); + let mut cef_dll_wrapper = cmake::Config::new(&cef_dir); cef_dll_wrapper .generator("Ninja") .profile("RelWithDebInfo") - .build_target("libcef_dll_wrapper"); + .build_target("libcef_dll_wrapper") + // Seeds the list CEF's cmake appends its own defines to and applies + // to the target; CMAKE_CXX_FLAGS would not survive, cef_variables + // clears it for the Ninja generator on Windows. + .define( + "CEF_COMPILER_DEFINES", + format!("CEF_API_VERSION={api_version}"), + ); let project_arch = match os_arch.arch { "aarch64" => "arm64", @@ -354,6 +372,27 @@ fn find_case_insensitive(dir: &std::path::Path, name: &str) -> Option anyhow::Result { + let header = cef_dir.join("include").join("cef_api_versions.h"); + let contents = std::fs::read_to_string(&header)?; + + contents + .lines() + .find_map(|line| { + line.strip_prefix("#define CEF_API_VERSION_LAST ")? + .trim() + .strip_prefix("CEF_API_VERSION_")? + .parse() + .ok() + }) + .ok_or_else(|| anyhow::anyhow!("no CEF_API_VERSION_LAST in {}", header.display())) +} + #[cfg(not(feature = "dox"))] fn copy_directory(src: &std::path::Path, dest: &std::path::Path) -> Result<(), std::io::Error> { std::fs::create_dir_all(dest)?;