Add a ghostty_vt_add_target() CMake function that lets downstream projects build libghostty-vt for a specific Zig target triple. The function encapsulates zig discovery, build-type-to-optimize mapping, the zig build invocation, and output path conventions so consumers do not need to duplicate any of that logic. It creates named IMPORTED targets (e.g. ghostty-vt-static-linux-amd64) that work alongside the existing native ghostty-vt and ghostty-vt-static targets. The build-type mapping is factored into a shared _GHOSTTY_ZIG_OPT_FLAG variable used by both the native build and the new function. The static library targets now propagate c++ as a link dependency on non-Windows platforms, fixing link failures when consumers use static linking with the default SIMD-enabled build. A new example/c-vt-cmake-cross/ demonstrates end-to-end cross- compilation using zig cc as the C compiler, auto-detecting a cross target based on the host OS. |
||
|---|---|---|
| .. | ||
| c-vt | ||
| c-vt-build-info | ||
| c-vt-cmake | ||
| c-vt-cmake-cross | ||
| c-vt-cmake-static | ||
| c-vt-colors | ||
| c-vt-effects | ||
| c-vt-encode-focus | ||
| c-vt-encode-key | ||
| c-vt-encode-mouse | ||
| c-vt-formatter | ||
| c-vt-grid-traverse | ||
| c-vt-kitty-graphics | ||
| c-vt-modes | ||
| c-vt-paste | ||
| c-vt-render | ||
| c-vt-sgr | ||
| c-vt-size-report | ||
| c-vt-static | ||
| c-vt-stream | ||
| cpp-vt-stream | ||
| swift-vt-xcframework | ||
| wasm-key-encode | ||
| wasm-sgr | ||
| wasm-vt | ||
| zig-formatter | ||
| zig-vt | ||
| zig-vt-stream | ||
| .gitignore | ||
| AGENTS.md | ||
| README.md | ||
README.md
Examples
Standalone projects demonstrating the Ghostty library APIs.
The directories starting with c- use the C API and the directories
starting with zig- use the Zig API.
Every example can be built and run using zig build and zig build run
from within the respective example directory.
Even the C API examples use the Zig build system (not the language) to
build the project.
Running an Example
cd example/<dir>
zig build run