From 7fc79c7aa4f1d691ed9996d440f13eb34a151f2d Mon Sep 17 00:00:00 2001 From: Fabian-Lars <30730186+FabianLars@users.noreply.github.com> Date: Mon, 13 Apr 2026 17:03:33 +0200 Subject: [PATCH] skip macos --- sys/build.rs | 49 +++++++++++++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/sys/build.rs b/sys/build.rs index abe67bc..a23d46f 100644 --- a/sys/build.rs +++ b/sys/build.rs @@ -112,17 +112,13 @@ fn main() -> anyhow::Result<()> { .parent() .unwrap(); - // On Windows and Linux the cef files usually have to be next to the main binary. - // TODO: Consider to put this behind a feature flag - copy_cef_runtime_files(&cef_dir, target_dir)?; - - let cef_dir = cef_dir.to_string_lossy().into_owned(); + let cef_dir_str = cef_dir.to_string_lossy().into_owned(); // Re-run when the resolved CEF directory changes/deletes. - println!("cargo::rerun-if-changed={cef_dir}"); + println!("cargo::rerun-if-changed={cef_dir_str}"); - println!("cargo::metadata=CEF_DIR={cef_dir}"); - println!("cargo::rustc-link-search=native={cef_dir}"); + println!("cargo::metadata=CEF_DIR={cef_dir_str}"); + println!("cargo::rustc-link-search=native={cef_dir_str}"); let mut cef_dll_wrapper = cmake::Config::new(&cef_dir); cef_dll_wrapper @@ -143,9 +139,19 @@ fn main() -> anyhow::Result<()> { match os_arch.os { "linux" => { + // On Windows and Linux the cef files usually have to be next to the main binary. + // On macOS it's more complicated so we'll leave it to tools like tauri-cli for now. + // TODO: Consider to put this behind a feature flag + copy_cef_runtime_files(&cef_dir, target_dir)?; + println!("cargo::rustc-link-lib=dylib=cef"); } "windows" => { + // On Windows and Linux the cef files usually have to be next to the main binary. + // On macOS it's more complicated so we'll leave it to tools like tauri-cli for now. + // TODO: Consider to put this behind a feature flag + copy_cef_runtime_files(&cef_dir, target_dir)?; + let sdk_libs = [ "comctl32.lib", "delayimp.lib", @@ -200,24 +206,27 @@ fn main() -> anyhow::Result<()> { #[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)?; - for entry in std::fs::read_dir(src)? { - let entry = entry?; - if entry.path().is_file() { - std::fs::copy(entry.path(), dest.join(entry.file_name()))?; + std::fs::create_dir_all(dest)?; + for entry in std::fs::read_dir(src)? { + let entry = entry?; + if entry.path().is_file() { + std::fs::copy(entry.path(), dest.join(entry.file_name()))?; + } } - } - Ok(()) + Ok(()) } #[cfg(not(feature = "dox"))] -fn copy_cef_runtime_files(cef_dir: &std::path::Path, target_dir: &std::path::Path) -> Result<(), std::io::Error> { - copy_directory(cef_dir, target_dir)?; +fn copy_cef_runtime_files( + cef_dir: &std::path::Path, + target_dir: &std::path::Path, +) -> Result<(), std::io::Error> { + copy_directory(cef_dir, target_dir)?; - const LOCALES_DIR: &str = "locales"; - copy_directory(&cef_dir.join(LOCALES_DIR), &target_dir.join(LOCALES_DIR))?; + const LOCALES_DIR: &str = "locales"; + copy_directory(&cef_dir.join(LOCALES_DIR), &target_dir.join(LOCALES_DIR))?; - Ok(()) + Ok(()) } #[cfg(feature = "dox")]