137 lines
6.5 KiB
Swift
137 lines
6.5 KiB
Swift
// swift-tools-version: 6.0
|
|
import PackageDescription
|
|
|
|
let package = Package(
|
|
name: "Lyrebird",
|
|
platforms: [.macOS(.v15), .iOS(.v18)],
|
|
products: [
|
|
// Consumer-facing product. Automatic linkage → SwiftPM/Xcode link the
|
|
// `LyrebirdSynth` module statically into the downstream target. No
|
|
// dynamic framework is produced, so the Xcode 26 regression where the
|
|
// `PackageFrameworks/Lyrebird.framework` binary is never built (and the
|
|
// app fails to link / launch) cannot affect external consumers.
|
|
// Product name ≠ target name (`Lyrebird` vends `LyrebirdSynth`) so there
|
|
// is also no static-vs-dynamic same-name collision. Consumers add the
|
|
// `Lyrebird` product and write `import LyrebirdSynth`.
|
|
.library(name: "Lyrebird", targets: ["LyrebirdSynth"]),
|
|
// Internal-only DYNAMIC product — consumed solely by the nested
|
|
// `LiveCompile/` dev sub-package. LiveCompile needs a single shared
|
|
// `libLyrebirdDynamic.dylib` on disk so the host and each live-compiled
|
|
// snippet dylib resolve to ONE copy of every Lyrebird class (the ObjC
|
|
// double-registration crash fixed in Phase 167). External consumers
|
|
// never reference this product — they use `Lyrebird` (static) above.
|
|
.library(name: "LyrebirdDynamic", 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 6 language mode (Phase 202): inherits the swift-tools 6.0 default.
|
|
),
|
|
.target(
|
|
name: "LyrebirdUI",
|
|
dependencies: [
|
|
"LyrebirdSynth",
|
|
],
|
|
path: "Sources/LyrebirdUI"
|
|
// SwiftUI + AppKit + Observation are system frameworks — no linkerSettings needed.
|
|
// Swift 6 language mode (Phase 202): inherits the swift-tools 6.0 default.
|
|
),
|
|
// Phase 167 — `LyrebirdLiveCompile` (and its SwiftUI host
|
|
// `LyrebirdLiveCompileUI`) moved to the `LiveCompile/` nested SwiftPM
|
|
// package. It depends on the internal `.product(name: "LyrebirdDynamic",
|
|
// package: "Lyrebird")` (the dynamic product above) so SwiftPM
|
|
// dynamic-links the live-compile dylib against `libLyrebirdDynamic.dylib`
|
|
// instead of statically embedding the core module's classes — the root
|
|
// cause of an ObjC class double-registration crash during `swift test`
|
|
// in the single-package layout. The consumer-facing `Lyrebird` product
|
|
// stays static (see products list). 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"
|
|
),
|
|
.testTarget(
|
|
name: "LyrebirdCLITests",
|
|
dependencies: ["LyrebirdCLI"],
|
|
path: "Tests/LyrebirdCLITests"
|
|
),
|
|
]
|
|
)
|