mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-06-16 16:41:23 +00:00
build: gate lib-vt xcframework on emit-xcframework with xcodebuild detection
This commit is contained in:
committed by
Mitchell Hashimoto
parent
caad13e232
commit
44a2d8740a
@@ -1,35 +1,6 @@
|
||||
// swift-tools-version: 5.9
|
||||
import Foundation
|
||||
import PackageDescription
|
||||
|
||||
func existingXCFrameworkPath() -> String {
|
||||
let fm = FileManager.default
|
||||
let candidates = [
|
||||
"../../zig-out/lib/ghostty-vt.xcframework",
|
||||
"../../zig-out/xcframeworks/ghostty-vt.xcframework",
|
||||
"../../zig-out/ghostty-vt.xcframework",
|
||||
]
|
||||
|
||||
for rel in candidates {
|
||||
let plist = "\(rel)/Info.plist"
|
||||
var isDir: ObjCBool = false
|
||||
if fm.fileExists(atPath: rel, isDirectory: &isDir),
|
||||
isDir.boolValue,
|
||||
fm.fileExists(atPath: plist)
|
||||
{
|
||||
return rel // important to return relative path
|
||||
}
|
||||
}
|
||||
|
||||
fatalError(
|
||||
"""
|
||||
GhosttyVt XCFramework not found.
|
||||
Build it first (must produce a valid *.xcframework with Info.plist).
|
||||
Tried:
|
||||
\(candidates.joined(separator: "\n"))
|
||||
""")
|
||||
}
|
||||
|
||||
let package = Package(
|
||||
name: "swift-vt-xcframework",
|
||||
platforms: [.macOS(.v13)],
|
||||
@@ -38,11 +9,13 @@ let package = Package(
|
||||
name: "swift-vt-xcframework",
|
||||
dependencies: ["GhosttyVt"],
|
||||
path: "Sources",
|
||||
linkerSettings: [.linkedLibrary("c++")]
|
||||
linkerSettings: [
|
||||
.linkedLibrary("c++"),
|
||||
]
|
||||
),
|
||||
.binaryTarget(
|
||||
name: "GhosttyVt",
|
||||
path: existingXCFrameworkPath()
|
||||
path: "../../zig-out/lib/ghostty-vt.xcframework"
|
||||
),
|
||||
]
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user