build: add CMake support for libghostty-vt

Add a top-level CMakeLists.txt that wraps `zig build lib-vt` so that
CMake-based downstream projects can consume libghostty-vt without
needing to interact with the Zig build system directly. A custom
command triggers the zig build during `cmake --build`, and the
resulting shared library is exposed as an IMPORTED target.

Downstream projects can pull in the library via FetchContent, which
fetches the source and builds it as part of their own CMake build, or
via find_package after a manual install step. The package config
template in dist/cmake/ sets up the ghostty-vt::ghostty-vt target
with proper include paths and macOS rpath handling.

A c-vt-cmake example demonstrates the FetchContent workflow, creating
a terminal, writing VT sequences, and formatting the output as plain
text. CI is updated to auto-discover and build CMake-based examples
alongside the existing Zig-based ones.
This commit is contained in:
Mitchell Hashimoto
2026-03-20 10:21:31 -07:00
parent e680cf9f35
commit 3dee62f904
10 changed files with 400 additions and 7 deletions

View File

@@ -8,6 +8,7 @@
appstream,
flatpak-builder,
gdb,
cmake,
#, glxinfo # unused
ncurses,
nodejs,
@@ -91,6 +92,7 @@ in
packages =
[
# For builds
cmake
doxygen
jq
llvmPackages_latest.llvm