Update build.rs (#447)
This commit is contained in:
parent
b31a41ad2f
commit
58ac2fb4f3
1 changed files with 7 additions and 2 deletions
|
|
@ -69,11 +69,14 @@ fn build_apple_intelligence_bridge() {
|
||||||
.expect("Unable to determine Swift toolchain lib directory");
|
.expect("Unable to determine Swift toolchain lib directory");
|
||||||
let sdk_swift_lib = Path::new(&sdk_path).join("usr/lib/swift");
|
let sdk_swift_lib = Path::new(&sdk_path).join("usr/lib/swift");
|
||||||
|
|
||||||
|
// Use macOS 11.0 as deployment target for compatibility
|
||||||
|
// The @available(macOS 26.0, *) checks in Swift handle runtime availability
|
||||||
|
// Weak linking for FoundationModels is handled via cargo:rustc-link-arg below
|
||||||
let status = Command::new("xcrun")
|
let status = Command::new("xcrun")
|
||||||
.args([
|
.args([
|
||||||
"swiftc",
|
"swiftc",
|
||||||
"-target",
|
"-target",
|
||||||
"arm64-apple-macosx26.0",
|
"arm64-apple-macosx11.0",
|
||||||
"-sdk",
|
"-sdk",
|
||||||
&sdk_path,
|
&sdk_path,
|
||||||
"-O",
|
"-O",
|
||||||
|
|
@ -121,7 +124,9 @@ fn build_apple_intelligence_bridge() {
|
||||||
println!("cargo:rustc-link-lib=framework=Foundation");
|
println!("cargo:rustc-link-lib=framework=Foundation");
|
||||||
|
|
||||||
if has_foundation_models {
|
if has_foundation_models {
|
||||||
println!("cargo:rustc-link-lib=framework=FoundationModels");
|
// Use weak linking so the app can launch on systems without FoundationModels
|
||||||
|
println!("cargo:rustc-link-arg=-weak_framework");
|
||||||
|
println!("cargo:rustc-link-arg=FoundationModels");
|
||||||
}
|
}
|
||||||
|
|
||||||
println!("cargo:rustc-link-arg=-Wl,-rpath,/usr/lib/swift");
|
println!("cargo:rustc-link-arg=-Wl,-rpath,/usr/lib/swift");
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue