diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d1cba5f87..26a7a73ce 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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: diff --git a/CMakeLists.txt b/CMakeLists.txt index 27864a88d..bf17d955f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,7 +95,13 @@ else() endif() # Static library name. -set(GHOSTTY_VT_STATIC_REALNAME "${CMAKE_STATIC_LIBRARY_PREFIX}ghostty-vt${CMAKE_STATIC_LIBRARY_SUFFIX}") +# On Windows, the static lib is named "ghostty-vt-static.lib" to avoid +# colliding with the DLL import library "ghostty-vt.lib". +if(WIN32) + set(GHOSTTY_VT_STATIC_REALNAME "ghostty-vt-static.lib") +else() + set(GHOSTTY_VT_STATIC_REALNAME "libghostty-vt.a") +endif() set(GHOSTTY_VT_STATIC_LIBRARY "${ZIG_OUT_DIR}/lib/${GHOSTTY_VT_STATIC_REALNAME}") # Ensure the output directories exist so CMake doesn't reject the diff --git a/build.zig b/build.zig index b34719545..1f3d0c196 100644 --- a/build.zig +++ b/build.zig @@ -111,17 +111,21 @@ pub fn build(b: *std.Build) !void { b, &mod, ); - if (config.is_dep) { // If we're a dependency, we need to install everything as-is // so that dep.artifact("ghostty-vt-static") works. libghostty_vt_static.install(b.getInstallStep()); } else { // If we're not a dependency, we rename the static lib to - // be idiomatic. + // be idiomatic. On Windows, we use a distinct name to avoid + // colliding with the DLL import library (ghostty-vt.lib). + const static_lib_name = if (config.target.result.os.tag == .windows) + "ghostty-vt-static.lib" + else + "libghostty-vt.a"; b.getInstallStep().dependOn(&b.addInstallLibFile( libghostty_vt_static.output, - "libghostty-vt.a", + static_lib_name, ).step); }