File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,6 +6,12 @@ set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
66set (ZLIB_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE )
77set (ZLIB_BUILD_TESTING OFF CACHE BOOL "" FORCE )
88set (ZLIB_INSTALL OFF CACHE BOOL "" FORCE )
9+ # Build zlib statically only. The vendored zlib CMakeLists defaults
10+ # ZLIB_BUILD_SHARED to ON, which emits z.dll on Windows and makes the
11+ # emulator a hard runtime dependency on whatever z.dll the loader resolves
12+ # from PATH. A stale/ABI-mismatched z.dll then kills the process at startup.
13+ # Linking the static archive removes the DLL dependency entirely.
14+ set (ZLIB_BUILD_SHARED OFF CACHE BOOL "" FORCE )
915add_subdirectory (zlib EXCLUDE_FROM_ALL )
1016
1117add_subdirectory (cpuinfo )
Original file line number Diff line number Diff line change @@ -356,12 +356,13 @@ endif()
356356
357357set (kyty_emulator_link_libraries common Vulkan::Headers spirv-tools-opt spirv-tools SDL2-static imgui xxhash FFmpeg::ffmpeg fmt::fmt nlohmann_json::nlohmann_json LibAtrac9 kyty_git_version Zydis::Zydis xbyak::xbyak)
358358
359- # zlib is required by rpfArchiveReader on all platforms.
360- find_package (ZLIB )
361- if (ZLIB_FOUND)
362- list (APPEND kyty_emulator_link_libraries ZLIB::ZLIB)
363- list (APPEND kyty_emulator_compile_definitions KYTY_HAS_ZLIB=1)
364- endif ()
359+ # zlib is required by rpfArchiveReader on all platforms. The vendored static
360+ # archive (ZLIB::ZLIBSTATIC) is always built by 3rdparty/CMakeLists.txt, so
361+ # link it unconditionally. The shared target ZLIB::ZLIB is not built anymore
362+ # (no z.dll is emitted or loaded at runtime), and find_package(ZLIB) is not
363+ # used because it could resolve a system zlib instead of the vendored one.
364+ list (APPEND kyty_emulator_link_libraries ZLIB::ZLIBSTATIC)
365+ list (APPEND kyty_emulator_compile_definitions KYTY_HAS_ZLIB=1)
365366
366367# Linux system libraries required by the static FFmpeg archive.
367368if (LINUX )
Original file line number Diff line number Diff line change @@ -19,5 +19,5 @@ target_link_libraries(pkg_parser PRIVATE common)
1919
2020# zlib is required for PFSC (compressed PFS) decompression.
2121# Vendored static build from 3rdparty/zlib (always available, no system dependency).
22- target_link_libraries (pkg_parser PRIVATE ZLIB::ZLIB )
22+ target_link_libraries (pkg_parser PRIVATE ZLIB::ZLIBSTATIC )
2323target_compile_definitions (pkg_parser PRIVATE KYTY_HAS_ZLIB=1 )
You can’t perform that action at this time.
0 commit comments