// Package.swift // Lyrebird // // Copyright (c) 2026 Joshua Parmenter / realizedsound // SPDX-License-Identifier: MIT // swift-tools-version: 6.0 import PackageDescription // The live-coding scratchpad as a SwiftPM package, so the umbrella // `Lyrebird.xcworkspace` shows it the same way as `LyrebirdGUIDemo` — a package, // not a nested `.xcodeproj`. A sibling `LyrebirdScratch.xcodeproj` is kept on // disk for distribution builds (custom app icon, entitlements, the module- // staging run-script that makes an *exported* `.app` self-contained); the // package form is the dev-run / in-workspace view. // // macOS only. The Linux scratchpad host is `LyrebirdScratchLinuxDemo` in the // `LiveCompile/` sub-package (GTK4 / SwiftOpenUI); this executable is the AppKit // (NSTextView + menu) counterpart. // // Dynamic products on purpose: the live-compile stack dlopens freshly compiled // snippet dylibs that `import LyrebirdSynth` / `LyrebirdLiveCompile`. Linking the // single shared `libLyrebirdDynamic` + `libLyrebirdLiveCompileUIDynamic` (rather // than static-folding a second copy of LyrebirdSynth's ObjC classes into this // executable) is what avoids duplicate class registration at dlopen time — the // same reason the `LiveCompile` sub-package exists. // // Run: `swift build` first (so the …Dynamic dylibs exist in the build dir for // the snippet link), then `swift run LyrebirdScratch`. As a bare SwiftPM // executable there is no Hardened Runtime or App Sandbox, so the swiftc // shell-out and the unsigned-snippet dlopen both work without entitlements (the // `.xcodeproj` needs `disable-library-validation` only because an Xcode app // target enables Hardened Runtime by default). let package = Package( name: "LyrebirdScratch", platforms: [.macOS(.v15)], dependencies: [ .package(name: "Lyrebird", path: "../.."), .package(name: "LyrebirdLiveCompile", path: "../../LiveCompile"), ], targets: [ .executableTarget( name: "LyrebirdScratch", dependencies: [ .product(name: "LyrebirdDynamic", package: "Lyrebird"), .product(name: "LyrebirdLiveCompileUIDynamic", package: "LyrebirdLiveCompile"), ], path: "LyrebirdScratch", exclude: [ "Info.plist", "LyrebirdScratch.entitlements", "Assets.xcassets", ] ), ] )