Skip to content

Commit 3a95885

Browse files
committed
feat: Link Apple frameworks for prebuilt MNN on macOS/iOS
1 parent ddeadd5 commit 3a95885

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

build.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,15 @@ fn link_libraries(
741741
_ => {}
742742
}
743743

744+
// Prebuilt MNN for macOS/iOS includes Metal backend, so always link Apple frameworks
745+
if matches!(link_mode, MnnLinkMode::Prebuilt) && matches!(os, "macos" | "ios") {
746+
println!("cargo:rustc-link-lib=framework=Foundation");
747+
println!("cargo:rustc-link-lib=framework=CoreFoundation");
748+
println!("cargo:rustc-link-lib=framework=Metal");
749+
println!("cargo:rustc-link-lib=framework=MetalPerformanceShaders");
750+
println!("cargo:rustc-link-lib=objc");
751+
}
752+
744753
// CoreML frameworks
745754
if coreml_enabled && matches!(os, "macos" | "ios") {
746755
println!("cargo:rustc-link-lib=framework=CoreML");

0 commit comments

Comments
 (0)