build: fix Windows cmake example failures

The cmake examples were failing at runtime on Windows CI for two
reasons.

The static library was installed as "libghostty-vt.a" on all
platforms, but on Windows the DLL import library is also placed in
zig-out/lib/ as "ghostty-vt.lib". The CMakeLists.txt expected the
platform-native name "ghostty-vt.lib" for the static lib, so it
picked up the tiny DLL import lib instead, silently producing a
dynamically-linked executable. That executable then failed at
runtime because the DLL was not on PATH.

Fix this by installing the static library as "ghostty-vt-static.lib"
on Windows to avoid the name collision, and updating CMakeLists.txt
to match. For the shared (DLL) example, add zig-out/bin to PATH in
the CI run step so the DLL can be found at runtime.
This commit is contained in:
Mitchell Hashimoto
2026-03-22 14:18:28 -07:00
parent 6ccc01a852
commit 2afadfc104
3 changed files with 15 additions and 4 deletions

View File

@@ -294,6 +294,7 @@ jobs:
$name = "${{ matrix.dir }}" -replace '-','_'
$exe = "example/${{ matrix.dir }}/build/Debug/${name}.exe"
if (!(Test-Path $exe)) { $exe = "example/${{ matrix.dir }}/build/${name}.exe" }
$env:PATH = "${{ github.workspace }}/zig-out/bin;$env:PATH"
& $exe
build-cmake: