Move ten inline vendor libraries out of root CMakeLists.txt into ext/

gason, vma, cityhash, 7zip (ext/lzma-sdk), basis_universal, pugixml,
kirk (ext/libkirk), sfmt19937, xbrz, and xxhash were each defined with
a small add_library() block directly in the root CMakeLists.txt, even
though ext/CMakeLists.txt already exists and handles every other vendor
library (freetype, imgui, naett, discord-rpc, libchdr, zstd, miniupnp,
armips, glew, snappy, ...) via add_subdirectory(). Gave each one its
own ext/<name>/CMakeLists.txt to match that established pattern; xxhash
stays a loose file pair in ext/ (it never had its own directory) so its
add_library() lives directly in ext/CMakeLists.txt instead.

ext/libkirk/CMakeLists.txt already existed but was dead - nothing
add_subdirectory()'d it, and its source list was stale (missing
amctrl.c/.h, which the live inline definition in root had). Replaced
its contents with the current, correct list instead of leaving two
diverging definitions around.

Dropped several target_include_directories()/include_directories()
calls that came along with these (e.g. cityhash, kirk, xbrz, xxhash,
and the lzma-sdk one for 7zip): traced their actual consumers and found
each library's own sources resolve their sibling headers via the
default same-directory quote-include rule, and every external consumer
already uses the full "ext/<name>/..." path resolved through the global
root include - so these were dead weight regardless of position.

Replaced two single-value alias variables (LIB7ZIP_LIBRARY, always
"7zip"; BASISU_LIBRARIES, always "basis_universal") with their target
names directly in Common/CMakeLists.txt, rather than trying to carry
them across the new add_subdirectory boundary - plain set() variables
don't propagate back up out of a child scope without PARENT_SCOPE, so
keeping them as-was would have silently broken Common's link line.

Verified with a fully clean rebuild (removed build/ entirely), a
HEADLESS=ON UNITTEST=ON build, and a LIBRETRO=ON build.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01PSNaZnHCjmryS3ziVN9gZU
This commit is contained in:
Henrik RydgårdandClaude Sonnet 5 committed 2026-07-24 20:16:07 +02:00
1 parent ae9060d501
commit bb6164e799
12 files changed
+92 -115

No files matched your search

-99
View File
@@ -571,16 +571,6 @@ if(USING_GLES2 OR (USING_EGL AND NOT USING_FBDEV))
find_package(X11)
endif()
add_library(gason STATIC
ext/gason/gason.cpp
ext/gason/gason.h
)
add_library(vma STATIC
ext/vma/vk_mem_alloc.cpp
ext/vma/vk_mem_alloc.h
)
if(USE_FFMPEG)
if(NOT BUILD_BUNDLED_FFMPEG)
if(NOT FFMPEG_DIR)
@@ -701,13 +691,6 @@ else()
set(ZLIB_LIBRARY zlib)
endif()
add_library(cityhash STATIC
ext/cityhash/city.cpp
ext/cityhash/city.h
ext/cityhash/citycrc.h
)
target_include_directories(cityhash PRIVATE ext/cityhash)
if(NOT MSVC)
# These can be fast even for debug.
target_compile_options(udis86 PRIVATE "-O2")
@@ -859,25 +842,6 @@ else()
set(LIBZIP_LIBRARY libzip)
endif()
add_library(7zip STATIC
ext/lzma-sdk/7zArcIn.c
ext/lzma-sdk/7zBuf.c
ext/lzma-sdk/7zCrc.c
ext/lzma-sdk/7zCrcOpt.c
ext/lzma-sdk/7zDec.c
ext/lzma-sdk/7zFile.c
ext/lzma-sdk/7zStream.c
ext/lzma-sdk/Bcj2.c
ext/lzma-sdk/Bra.c
ext/lzma-sdk/Bra86.c
ext/lzma-sdk/CpuArch.c
ext/lzma-sdk/Delta.c
ext/lzma-sdk/Lzma2Dec.c
ext/lzma-sdk/LzmaDec.c
)
include_directories(ext/lzma-sdk)
set(LIB7ZIP_LIBRARY 7zip)
# Arm platforms require at least libpng17.
if(ANDROID OR ARMV7 OR ARM64 OR ARM OR IOS)
set(PNG_REQUIRED_VERSION 1.7)
@@ -932,32 +896,6 @@ else()
include_directories(ext/libpng17)
endif()
add_library(basis_universal STATIC
ext/basis_universal/basisu.h
ext/basis_universal/basisu_containers.h
ext/basis_universal/basisu_containers_impl.h
ext/basis_universal/basisu_file_headers.h
ext/basis_universal/basisu_transcoder.cpp
ext/basis_universal/basisu_transcoder.h
ext/basis_universal/basisu_transcoder_internal.h
ext/basis_universal/basisu_transcoder_tables_astc.inc
ext/basis_universal/basisu_transcoder_tables_astc_0_255.inc
ext/basis_universal/basisu_transcoder_tables_atc_55.inc
ext/basis_universal/basisu_transcoder_tables_atc_56.inc
ext/basis_universal/basisu_transcoder_tables_bc7_m5_alpha.inc
ext/basis_universal/basisu_transcoder_tables_bc7_m5_color.inc
ext/basis_universal/basisu_transcoder_tables_dxt1_5.inc
ext/basis_universal/basisu_transcoder_tables_dxt1_6.inc
ext/basis_universal/basisu_transcoder_tables_pvrtc2_45.inc
ext/basis_universal/basisu_transcoder_tables_pvrtc2_alpha_33.inc
ext/basis_universal/basisu_transcoder_uastc.h
)
set(BASISU_LIBRARIES basis_universal)
add_library(pugixml STATIC
ext/pugixml/pugixml.cpp
ext/pugixml/pugixml.hpp
)
set(targetExtra)
set(targetExtraLibs)
@@ -1199,43 +1137,6 @@ if(ANDROID OR (LINUX AND ARM_DEVICE) OR (LINUX AND RISCV64) OR (LINUX AND LOONGA
set(ATOMIC_LIB atomic)
endif()
add_library(kirk STATIC
ext/libkirk/AES.c
ext/libkirk/AES.h
ext/libkirk/amctrl.c
ext/libkirk/amctrl.h
ext/libkirk/SHA1.c
ext/libkirk/SHA1.h
ext/libkirk/bn.c
ext/libkirk/ec.c
ext/libkirk/kirk_engine.c
ext/libkirk/kirk_engine.h
ext/libkirk/kirk_common.h
)
target_include_directories(kirk PRIVATE ext/libkirk)
add_library(sfmt19937 STATIC
ext/sfmt19937/SFMT.c
ext/sfmt19937/SFMT.h
ext/sfmt19937/SFMT-common.h
ext/sfmt19937/SFMT-params.h
ext/sfmt19937/SFMT-params19937.h
)
target_compile_definitions(sfmt19937 PRIVATE SFMT_MEXP=19937)
target_include_directories(sfmt19937 PRIVATE ext/sfmt19937)
add_library(xbrz STATIC
ext/xbrz/xbrz.cpp
ext/xbrz/xbrz.h
)
target_include_directories(xbrz PRIVATE ext/xbrz)
add_library(xxhash STATIC
ext/xxhash.c
ext/xxhash.h
)
target_include_directories(xxhash PRIVATE ext/xxhash)
set(GlslangLibs glslang OGLCompiler OSDependent SPIRV spirv-cross-glsl)
if (ENABLE_SPVREMAPPER)
+1 -1
View File
@@ -380,7 +380,7 @@ if(WIN32)
target_link_libraries(Common winmm dsound dxguid d2d1 dwrite d3d11 Version)
endif()
target_link_libraries(Common ${LIBZIP_LIBRARY} ${LIB7ZIP_LIBRARY} ${PNG_LIBRARIES} ${BASISU_LIBRARIES} ${ZLIB_LIBRARY} pugixml vma gason udis86 ${RT_LIB} ${ATOMIC_LIB})
target_link_libraries(Common ${LIBZIP_LIBRARY} 7zip ${PNG_LIBRARIES} basis_universal ${ZLIB_LIBRARY} pugixml vma gason udis86 ${RT_LIB} ${ATOMIC_LIB})
# 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
+14
View File
@@ -36,6 +36,20 @@ add_subdirectory(at3_standalone)
add_subdirectory(udis86)
add_subdirectory(SPIRV-Cross-build)
add_subdirectory(rcheevos-build)
add_subdirectory(gason)
add_subdirectory(vma)
add_subdirectory(cityhash)
add_subdirectory(lzma-sdk)
add_subdirectory(basis_universal)
add_subdirectory(pugixml)
add_subdirectory(libkirk)
add_subdirectory(sfmt19937)
add_subdirectory(xbrz)
add_library(xxhash STATIC
xxhash.c
xxhash.h
)
set(FT_REQUIRE_ZLIB OFF CACHE BOOL "" FORCE)
set(FT_REQUIRE_BZIP2 OFF CACHE BOOL "" FORCE)
+20
View File
@@ -0,0 +1,20 @@
add_library(basis_universal STATIC
basisu.h
basisu_containers.h
basisu_containers_impl.h
basisu_file_headers.h
basisu_transcoder.cpp
basisu_transcoder.h
basisu_transcoder_internal.h
basisu_transcoder_tables_astc.inc
basisu_transcoder_tables_astc_0_255.inc
basisu_transcoder_tables_atc_55.inc
basisu_transcoder_tables_atc_56.inc
basisu_transcoder_tables_bc7_m5_alpha.inc
basisu_transcoder_tables_bc7_m5_color.inc
basisu_transcoder_tables_dxt1_5.inc
basisu_transcoder_tables_dxt1_6.inc
basisu_transcoder_tables_pvrtc2_45.inc
basisu_transcoder_tables_pvrtc2_alpha_33.inc
basisu_transcoder_uastc.h
)
+5
View File
@@ -0,0 +1,5 @@
add_library(cityhash STATIC
city.cpp
city.h
citycrc.h
)
+4
View File
@@ -0,0 +1,4 @@
add_library(gason STATIC
gason.cpp
gason.h
)
+12 -15
View File
@@ -1,16 +1,13 @@
set(SRCS
AES.c
bn.c
ec.c
kirk_engine.c
SHA1.c
add_library(kirk STATIC
AES.c
AES.h
amctrl.c
amctrl.h
SHA1.c
SHA1.h
bn.c
ec.c
kirk_engine.c
kirk_engine.h
kirk_common.h
)
set(SRCS ${SRCS})
add_library(kirk STATIC ${SRCS})
if(UNIX)
add_definitions(-fPIC)
endif(UNIX)
+16
View File
@@ -0,0 +1,16 @@
add_library(7zip STATIC
7zArcIn.c
7zBuf.c
7zCrc.c
7zCrcOpt.c
7zDec.c
7zFile.c
7zStream.c
Bcj2.c
Bra.c
Bra86.c
CpuArch.c
Delta.c
Lzma2Dec.c
LzmaDec.c
)
+4
View File
@@ -0,0 +1,4 @@
add_library(pugixml STATIC
pugixml.cpp
pugixml.hpp
)
+8
View File
@@ -0,0 +1,8 @@
add_library(sfmt19937 STATIC
SFMT.c
SFMT.h
SFMT-common.h
SFMT-params.h
SFMT-params19937.h
)
target_compile_definitions(sfmt19937 PRIVATE SFMT_MEXP=19937)
+4
View File
@@ -0,0 +1,4 @@
add_library(vma STATIC
vk_mem_alloc.cpp
vk_mem_alloc.h
)
+4
View File
@@ -0,0 +1,4 @@
add_library(xbrz STATIC
xbrz.cpp
xbrz.h
)