// swift-tools-version: 5.9 // // VoiceCatCore — the shared Swift core for the VoiceCat macOS (AppKit) and iOS (SwiftUI) // clients. It wraps libvoicecat's C ABI (core/include/voicecat.h) as imported through the // VoiceCatCore.xcframework binary target's module map (`import VoiceCatC`), and exposes a // Swift-idiomatic, @MainActor-safe surface. // // Architecture: docs/architecture.md §4 ("one core, many faces"). The Windows C# client // (clients/windows/VoiceCat.Interop) is the proven mirror of this same layering — the Swift // wrapper follows the same patterns (callback-lifetime, string-lifetime, event-delivery // thread handoff, immediate vc_free_* on list reads) adapted to Swift's interop model. // // The XCFramework is a LOCAL BUILD ARTIFACT — run `scripts/build-xcframework.sh` before // `swift build` / `swift test`. See clients/apple/README.md. import PackageDescription let package = Package( name: "VoiceCatCore", // macOS 14 (Sonoma) is the AppKit client's deployment target. iOS is deferred; when the // iOS app lands, add `.iOS(.v17)` here and the apple-ios / apple-ios-sim slices to the // XCFramework (scripts/build-xcframework.sh --all). platforms: [ .macOS(.v14), ], products: [ .library(name: "VoiceCatCore", targets: ["VoiceCatCore"]), ], targets: [ // Binary target — the prebuilt static lib + headers + module map. Produced by // scripts/build-xcframework.sh from the `apple-dev` CMake preset. .binaryTarget( name: "VoiceCatCoreXCF", path: "VoiceCatCore.xcframework" ), // The Swift wrapper library — what the macOS/iOS apps import as `import VoiceCatCore`. .target( name: "VoiceCatCore", dependencies: ["VoiceCatCoreXCF"], path: "Sources/VoiceCatCore" ), // Smoke tests against a real voicecat-server — mirrors clients/windows/ // VoiceCat.Interop.Tests/VoiceCatClientSmokeTests.cs. Requires the `dev` CMake preset // to be built (build/dev/bin/voicecat-server + voicecat-admin). // // linkerSettings: libvoicecat.a is a static C++20 library (built by the apple-dev // preset with vcpkg's clang), so the final executable must link libc++ (the LLVM C++ // standard library on macOS). vcpkg's static deps (mbedtls/sodium/opus/protobuf/ // sqlite3/spdlog/asio) are already compiled into the .a; macOS system frameworks // (CoreAudio/CoreFoundation) are auto-discovered by the linker (PROGRESS.md). .testTarget( name: "VoiceCatCoreTests", dependencies: ["VoiceCatCore"], path: "Tests/VoiceCatCoreTests", linkerSettings: [ .linkedLibrary("c++"), ] ), ] )