mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-19 22:10:29 +00:00
Add Meson build system integration mirroring the existing CMake wrapper. The top-level meson.build delegates to zig build lib-vt using --prefix-lib-dir and --prefix-include-dir to place outputs directly in the Meson build directory, avoiding stamp files and source tree pollution. A sentinel .h output ensures Meson orders the zig build before any downstream compiles. Downstream projects can consume the library either as a Meson subproject via a .wrap file or through pkg-config after install. The dist/meson/README.md documents both approaches. Includes a c-vt-meson example, CI job in test.yml for auto-discovered Meson examples, meson and ninja in the nix devShell, and gitignore updates for Meson build artifacts.
c-vt-meson
Demonstrates consuming libghostty-vt from a Meson project using a subproject. Creates a terminal, writes VT sequences into it, and formats the screen contents as plain text.
Building this example
Since this example lives inside the Ghostty repo, point the subproject at the local checkout instead of fetching from GitHub:
cd example/c-vt-meson
mkdir -p subprojects
ln -s ../../.. subprojects/ghostty
meson setup build
meson compile -C build
./build/c_vt_meson
Real World Usage
Create a subprojects/ghostty.wrap file in your project:
[wrap-git]
url = https://github.com/ghostty-org/ghostty.git
revision = main
depth = 1
Then in your meson.build:
ghostty_proj = subproject('ghostty')
ghostty_vt_dep = ghostty_proj.get_variable('ghostty_vt_dep')
executable('myapp', 'src/main.c', dependencies: ghostty_vt_dep)
Meson will clone the repository into subprojects/ghostty/ on first
build and invoke zig build lib-vt automatically.