mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-19 14:00:29 +00:00
build: add GhosttyVt module map to xcframework and Swift example
The xcframework now generates its own headers directory with a GhosttyVt module map instead of reusing include/ directly, which contains the GhosttyKit module map for the macOS app. The generated directory copies the ghostty headers and adds a module.modulemap that exposes ghostty/vt.h as the umbrella header. A new swift-vt-xcframework example demonstrates consuming the xcframework from a Swift Package. It creates a terminal, writes VT sequences, and formats the output as plain text, verifying the full round-trip works with swift build and swift run.
This commit is contained in:
@@ -342,12 +342,30 @@ pub fn xcframework(
|
||||
) *XCFrameworkStep {
|
||||
assert(lib_vt.kind == .static);
|
||||
const b = lib_vt.step.owner;
|
||||
|
||||
// Generate a headers directory with a module map for Swift PM.
|
||||
// We can't use include/ directly because it contains a module map
|
||||
// for GhosttyKit (the macOS app library).
|
||||
const wf = b.addWriteFiles();
|
||||
_ = wf.addCopyDirectory(
|
||||
b.path("include/ghostty"),
|
||||
"ghostty",
|
||||
.{ .include_extensions = &.{".h"} },
|
||||
);
|
||||
_ = wf.add("module.modulemap",
|
||||
\\module GhosttyVt {
|
||||
\\ umbrella header "ghostty/vt.h"
|
||||
\\ export *
|
||||
\\}
|
||||
\\
|
||||
);
|
||||
|
||||
return XCFrameworkStep.create(b, .{
|
||||
.name = "ghostty-vt",
|
||||
.out_path = b.pathJoin(&.{ b.install_prefix, "lib/ghostty-vt.xcframework" }),
|
||||
.libraries = &.{.{
|
||||
.library = lib_vt.output,
|
||||
.headers = b.path("include/ghostty"),
|
||||
.headers = wf.getDirectory(),
|
||||
.dsym = null,
|
||||
}},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user