build: improve Apple Intelligence detection#927
build: improve Apple Intelligence detection#927AlexanderYastrebov wants to merge 1 commit intocjpais:mainfrom
Conversation
Check for existence of the dynamic library. On my machine (26.2 SDK, Xcode CLI tools) I only have library stub: ```console % ls -1 $(xcrun --sdk macosx --show-sdk-path)/System/Library/Frameworks/FoundationModels.framework/ FoundationModels.tbd Modules Versions ``` which does not allow me to build Handy as swiftc fails to compile. Looks like FoundationModels require full Xcode installation.
| Path::new(&sdk_path).join("System/Library/Frameworks/FoundationModels.framework"); | ||
| let has_foundation_models = framework_path.exists(); | ||
| let framework_lib = | ||
| Path::new(&sdk_path).join("System/Library/Frameworks/FoundationModels.framework/FoundationModels.dylib"); |
There was a problem hiding this comment.
I can not test it as I don't have full Xcode installation.
@Schreezer @cjpais Could you please check that you have dylib:
stat $(xcrun --sdk macosx --show-sdk-path)/System/Library/Frameworks/FoundationModels.framework/FoundationModels.dylibThere was a problem hiding this comment.
Your fix breaks the build for the users who have the foundational models installed, can you please try running this code on your machine:
import Foundation
import FoundationModels
if #available(macOS 26.0, *) {
let model = SystemLanguageModel.default
switch model.availability {
case .available:
print("✅ Apple Intelligence is AVAILABLE!")
case .unavailable(let reason):
print("❌ Apple Intelligence is unavailable: (reason)")
@unknown default:
print("❓ Unknown availability state")
}
} else {
print("❌ macOS 26.0+ required")
}
There was a problem hiding this comment.
Hi, I can not build Handy at all (and likely will not be able to build that snippet due to #available(macOS 26.0, *)), intelligence is likely unavailable since I use Sequoia 15.7.3 but have 26.2 SDK installed. Could you please share file list of the $(xcrun --sdk macosx --show-sdk-path)/System/Library/Frameworks/FoundationModels.framework/ - I am wondering if we can use dylib file or something else instead of checking directory presence to detect intelligence support.
Check for existence of the dynamic library.
On my machine (Sequoia 15.7.3, 26.2 SDK, Xcode CLI tools) I only have library stub:
which does not allow me to build Handy as swiftc fails to compile. Looks like FoundationModels require full Xcode installation.
Before Submitting This PR
Please confirm you have done the following:
If this is a feature or change that was previously closed/rejected:
Human Written Description
Related Issues/Discussions
Fixes #
Discussion:
Community Feedback
Testing
Screenshots/Videos (if applicable)
AI Assistance
If AI was used: