Skip to content

armgit / jan

Public Imported from GitHub
0

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.

feat: add macOS specific build configurations for Swift integration in build.rs

dev-miro260d543eba92b3
diff --git a/src-tauri/build.rs b/src-tauri/build.rs
index d773e7a94..19f55f071 100644
--- a/src-tauri/build.rs
+++ b/src-tauri/build.rs
@@ -1,4 +1,30 @@
fn main() {
#[cfg(not(feature = "cli"))]
- tauri_build::build()
+ tauri_build::build();
+
+ #[cfg(target_os = "macos")]
+ {
+ println!("cargo:rustc-link-arg=-Wl,-rpath,/usr/lib/swift");
+
+ if let Ok(output) = std::process::Command::new("xcrun")
+ .args(["--toolchain", "default", "--find", "swift"])
+ .output()
+ {
+ let swift_path = String::from_utf8_lossy(&output.stdout)
+ .trim()
+ .to_string();
+ if let Some(toolchain) = std::path::Path::new(&swift_path)
+ .parent()
+ .and_then(|p| p.parent())
+ {
+ let lib_path = toolchain.join("lib/swift/macosx");
+ if lib_path.exists() {
+ println!(
+ "cargo:rustc-link-arg=-Wl,-rpath,{}",
+ lib_path.display()
+ );
+ }
+ }
+ }
+ }
}