fix: skip macOS framework lookup in dev mode via build.rs
Use CARGO_MANIFEST_DIR to detect whether CI-copied dylibs exist. When absent (local dev), override frameworks to empty array so tauri dev doesn't require libodbc/libltdl installed locally. Also gitignore *.dylib in src-tauri/ to prevent accidental commits.
This commit is contained in:
1 parent
9a7c12c65a
commit
65d184fd03
2 files changed
+8
-4
No files matched your search
@@ -1,3 +1,5 @@
|
||||
# Generated by Cargo
|
||||
/target/
|
||||
/gen/schemas
|
||||
# CI-only: copied by release workflow for macOS bundling
|
||||
*.dylib
|
||||
+6
-4
@@ -1,9 +1,11 @@
|
||||
fn main() {
|
||||
// In dev mode, skip framework bundling to avoid requiring libodbc/libltdl locally.
|
||||
// CI copies the dylibs into src-tauri/ before release builds.
|
||||
#[cfg(target_os = "macos")]
|
||||
if std::env::var("TAURI_CONFIG").is_err() && !std::path::Path::new("libodbc.2.dylib").exists() {
|
||||
std::env::set_var("TAURI_CONFIG", r#"{"bundle":{"macOS":{"frameworks":[]}}}"#);
|
||||
{
|
||||
let manifest_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap_or_else(|_| ".".to_string());
|
||||
let has_dylibs = std::path::Path::new(&manifest_dir).join("libodbc.2.dylib").exists();
|
||||
if !has_dylibs && std::env::var("TAURI_CONFIG").is_err() {
|
||||
std::env::set_var("TAURI_CONFIG", r#"{"bundle":{"macOS":{"frameworks":[]}}}"#);
|
||||
}
|
||||
}
|
||||
tauri_build::build()
|
||||
}
|
||||
Reference in new issue
Block a user