135 lines
6.3 KiB
Swift
135 lines
6.3 KiB
Swift
// swift-tools-version: 6.0
|
|
import PackageDescription
|
|
|
|
let package = Package(
|
|
name: "Lyrebird",
|
|
platforms: [.macOS(.v15), .iOS(.v18)],
|
|
products: [
|
|
// Product name stays `Lyrebird` (external API), but it vends the
|
|
// renamed `LyrebirdSynth` target/module. Product name ≠ target name is
|
|
// required: a forced-`.dynamic` product cannot share a name with its
|
|
// target when a downstream project's graph also static-links that
|
|
// target ("linked as a static library … but cannot be built
|
|
// dynamically because there is a package product with the same name").
|
|
// Consumers add the `Lyrebird` product and write `import LyrebirdSynth`.
|
|
.library(name: "Lyrebird", type: .dynamic, targets: ["LyrebirdSynth"]),
|
|
.library(name: "LyrebirdUI", targets: ["LyrebirdUI"]),
|
|
.executable(name: "LyrebirdCLI", targets: ["LyrebirdCLI"]),
|
|
],
|
|
dependencies: [
|
|
// LineNoise 0.0.3 — readline-style line editing, history, and tab completion.
|
|
//
|
|
// Package.resolved note: Nimble (Quick/Nimble) appears as a pinned dependency
|
|
// because LineNoise 0.0.3's own test target depends on it. SPM resolves all
|
|
// transitive test dependencies into Package.resolved regardless of whether they
|
|
// are reachable from this package's targets. Nimble is NOT built, NOT linked,
|
|
// and NOT importable in any Lyrebird target — the `LineNoise` library target
|
|
// itself has zero dependencies. This is a known SPM artifact that cannot be
|
|
// removed without forking linenoise-swift.
|
|
.package(
|
|
url: "https://github.com/andybest/linenoise-swift",
|
|
.upToNextMajor(from: "0.0.3")
|
|
),
|
|
// swift-docc-plugin — command plugin that drives DocC documentation builds.
|
|
// Registers two commands available to all targets in this package:
|
|
// • In Xcode: Product ▸ Build Documentation (or scheme-level build action)
|
|
// • From CLI: swift package generate-documentation --target Lyrebird
|
|
// swift package preview-documentation --target Lyrebird
|
|
// No target-level plugins: entry is needed — command plugins apply package-wide.
|
|
.package(
|
|
url: "https://github.com/apple/swift-docc-plugin",
|
|
from: "1.3.0"
|
|
),
|
|
],
|
|
targets: [
|
|
// Thin C shim that exposes fesetenv(FE_DFL_DISABLE_DENORMS_ENV) to Swift.
|
|
// FE_DFL_DISABLE_DENORMS_ENV is a C-only macro sentinel ((fenv_t *)-2) that cannot
|
|
// be referenced from Swift directly; the C wrapper lets Lyrebird call it safely.
|
|
.target(
|
|
name: "LyrebirdC",
|
|
path: "Sources/LyrebirdC"
|
|
),
|
|
.target(
|
|
// Module/target renamed `Lyrebird` → `LyrebirdSynth` (the `Lyrebird`
|
|
// product above still vends it). Folder path kept as `Sources/Lyrebird`
|
|
// so the source tree and `Lyrebird.docc` catalog don't move.
|
|
name: "LyrebirdSynth",
|
|
dependencies: ["LyrebirdC"],
|
|
path: "Sources/Lyrebird",
|
|
linkerSettings: [
|
|
.linkedFramework("CoreAudio"),
|
|
.linkedFramework("AudioToolbox"),
|
|
.linkedFramework("Accelerate"),
|
|
.linkedFramework("CoreMIDI"),
|
|
.linkedFramework("AVFoundation"),
|
|
]
|
|
),
|
|
.executableTarget(
|
|
name: "LyrebirdCLI",
|
|
dependencies: [
|
|
.product(name: "LineNoise", package: "linenoise-swift"),
|
|
],
|
|
path: "Sources/LyrebirdCLI",
|
|
resources: [
|
|
// Xcode .xctemplate bundles installed by `lyrebird install-templates`.
|
|
// .copy preserves the directory structure exactly (Xcode discovers
|
|
// templates by .xctemplate bundle name + TemplateInfo.plist).
|
|
.copy("Resources/XcodeTemplates"),
|
|
],
|
|
// Swift 5 language mode: the LineNoise package pre-dates Swift 6 concurrency
|
|
// annotations. The CLI is a single-threaded synchronous command dispatcher —
|
|
// strict concurrency checking adds noise without safety benefit here.
|
|
swiftSettings: [.swiftLanguageMode(.v5)]
|
|
),
|
|
.target(
|
|
name: "LyrebirdUI",
|
|
dependencies: [
|
|
"LyrebirdSynth",
|
|
],
|
|
path: "Sources/LyrebirdUI",
|
|
// SwiftUI + AppKit + Observation are system frameworks — no linkerSettings needed.
|
|
// .v5 mode: avoids Swift 6 actor-isolation diagnostics in SwiftUI/AppKit interop
|
|
// until the concurrency model for UI is fully audited (same rationale as LyrebirdCLI).
|
|
swiftSettings: [.swiftLanguageMode(.v5)]
|
|
),
|
|
// Phase 167 — `LyrebirdLiveCompile` (and its SwiftUI host
|
|
// `LyrebirdLiveCompileUI`) moved to the `LiveCompile/` nested SwiftPM
|
|
// package. The cross-package `.product(name: "Lyrebird", package: "Lyrebird")`
|
|
// dependency there forces SwiftPM to dynamic-link the live-compile dylib
|
|
// against `libLyrebird.dylib` instead of statically embedding the core
|
|
// module's classes, which was the root cause of an ObjC class
|
|
// double-registration crash during `swift test` in the single-package
|
|
// layout. See `LiveCompile/Package.swift`.
|
|
.executableTarget(
|
|
name: "LyrebirdBenchmark",
|
|
dependencies: ["LyrebirdSynth"],
|
|
path: "Sources/LyrebirdBenchmark",
|
|
swiftSettings: [.unsafeFlags(["-O"])]
|
|
),
|
|
.testTarget(
|
|
name: "LyrebirdTests",
|
|
dependencies: ["LyrebirdSynth"],
|
|
path: "Tests/LyrebirdTests",
|
|
linkerSettings: [
|
|
.linkedFramework("AudioToolbox"),
|
|
.linkedFramework("Accelerate"),
|
|
]
|
|
),
|
|
.testTarget(
|
|
name: "LyrebirdUITests",
|
|
dependencies: [
|
|
"LyrebirdUI",
|
|
"LyrebirdSynth",
|
|
],
|
|
path: "Tests/LyrebirdUITests",
|
|
swiftSettings: [.swiftLanguageMode(.v5)]
|
|
),
|
|
.testTarget(
|
|
name: "LyrebirdCLITests",
|
|
dependencies: ["LyrebirdCLI"],
|
|
path: "Tests/LyrebirdCLITests",
|
|
swiftSettings: [.swiftLanguageMode(.v5)]
|
|
),
|
|
]
|
|
)
|