From e8f85f7804351b4eecfad65b731fc03f0fecbf11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Fri, 24 Jul 2026 20:49:29 +0200 Subject: [PATCH] Fix missing zstd include/link deps in Common and basis_universal Common and basis_universal call zstd functions directly but never declared the dependency after being split into their own CMakeLists.txt files, relying on directory-scope include_directories() that no longer reached them. Worked on Linux via system zstd.h, but broke the Android NDK build which has no such fallback. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01XMv4XdM5dThs9Avr5FPXRv --- Common/CMakeLists.txt | 8 ++++++++ ext/basis_universal/CMakeLists.txt | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/Common/CMakeLists.txt b/Common/CMakeLists.txt index f610b9a5a0..2ac2d9631a 100644 --- a/Common/CMakeLists.txt +++ b/Common/CMakeLists.txt @@ -382,6 +382,14 @@ endif() target_link_libraries(Common ${LIBZIP_LIBRARY} 7zip ${PNG_LIBRARIES} basis_universal ${ZLIB_LIBRARY} pugixml vma gason udis86 ${RT_LIB} ${ATOMIC_LIB}) +# ZIMLoad.cpp/ZIMSave.cpp, Serializer.cpp, and Render/TextureAtlas.cpp call directly into zstd. +if(USE_SYSTEM_ZSTD) + target_include_directories(Common PRIVATE ${ZSTD_INCLUDE_DIR}) + target_link_libraries(Common ${ZSTD_LIBRARY}) +else() + target_link_libraries(Common libzstd_static) +endif() + # Common/GPU/ShaderTranslation.cpp and Common/GPU/Vulkan/VulkanContext.cpp call directly into # glslang/spirv-cross, so Common needs to declare this dependency itself rather than relying on # some downstream consumer happening to also link it (that was the previous, fragile setup: this diff --git a/ext/basis_universal/CMakeLists.txt b/ext/basis_universal/CMakeLists.txt index a4490537b1..9390370746 100644 --- a/ext/basis_universal/CMakeLists.txt +++ b/ext/basis_universal/CMakeLists.txt @@ -18,3 +18,11 @@ add_library(basis_universal STATIC basisu_transcoder_tables_pvrtc2_alpha_33.inc basisu_transcoder_uastc.h ) + +# basisu_transcoder.cpp calls ZSTD_decompress()/ZSTD_isError() directly for KTX2 supercompression. +if(USE_SYSTEM_ZSTD) + target_include_directories(basis_universal PRIVATE ${ZSTD_INCLUDE_DIR}) + target_link_libraries(basis_universal ${ZSTD_LIBRARY}) +else() + target_link_libraries(basis_universal libzstd_static) +endif()