Skip to content

Commit

Permalink
Merge pull request #19106 from hrydgard/simplify-zstd-build
Browse files Browse the repository at this point in the history
Make a simpler CMakeLists.txt for zstd
  • Loading branch information
hrydgard committed May 4, 2024
2 parents 8ee0ec8 + e631be3 commit 7e6df07
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 4 deletions.
4 changes: 1 addition & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2361,9 +2361,7 @@ if(USE_SYSTEM_ZSTD)
target_include_directories(${CoreLibName} PRIVATE ${ZSTD_INCLUDE_DIR})
target_link_libraries(${CoreLibName} ${ZSTD_LIBRARY})
else()
set(ZSTD_BUILD_PROGRAMS OFF CACHE BOOL "we don't need zstd programs" FORCE)
set(ZSTD_LEGACY_SUPPORT OFF CACHE BOOL "we don't use any old zstd files" FORCE)
add_subdirectory(ext/zstd/build/cmake EXCLUDE_FROM_ALL)
add_subdirectory(ext/zstd-build)
set(CoreExtraLibs ${CoreExtraLibs} libzstd_static)
include_directories(ext/zstd/lib)
endif()
Expand Down
2 changes: 1 addition & 1 deletion Core/HLE/sceKernelInterrupt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,7 @@ static int sysclib_sprintf(u32 dst, u32 fmt) {
}
}

DEBUG_LOG(SCEKERNEL, "sysclib_sprintf result string has length %u, content:", result.length());
DEBUG_LOG(SCEKERNEL, "sysclib_sprintf result string has length %d, content:", (int)result.length());
DEBUG_LOG(SCEKERNEL, "%s", result.c_str());
if (!Memory::IsValidRange(dst, result.length() + 1)) {
ERROR_LOG(SCEKERNEL, "sysclib_sprintf result string is too long or dst is invalid");
Expand Down
51 changes: 51 additions & 0 deletions ext/zstd-build/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
cmake_minimum_required (VERSION 3.2.0)
project (libzstd_static)

set(SRC_DIR ../zstd/lib)
message(${SRC_DIR})

set(ALL_SOURCE_FILES
${SRC_DIR}/common/debug.c
${SRC_DIR}/common/entropy_common.c
${SRC_DIR}/common/error_private.c
${SRC_DIR}/common/fse_decompress.c
${SRC_DIR}/common/pool.c
${SRC_DIR}/common/threading.c
${SRC_DIR}/common/xxhash.c
${SRC_DIR}/common/zstd_common.c
${SRC_DIR}/compress/fse_compress.c
${SRC_DIR}/compress/hist.c
${SRC_DIR}/compress/huf_compress.c
${SRC_DIR}/compress/zstd_compress.c
${SRC_DIR}/compress/zstd_compress_literals.c
${SRC_DIR}/compress/zstd_compress_sequences.c
${SRC_DIR}/compress/zstd_compress_superblock.c
${SRC_DIR}/compress/zstd_double_fast.c
${SRC_DIR}/compress/zstd_fast.c
${SRC_DIR}/compress/zstd_lazy.c
${SRC_DIR}/compress/zstd_ldm.c
${SRC_DIR}/compress/zstd_opt.c
${SRC_DIR}/compress/zstdmt_compress.c
${SRC_DIR}/decompress/huf_decompress.c
${SRC_DIR}/decompress/zstd_ddict.c
${SRC_DIR}/decompress/zstd_decompress.c
${SRC_DIR}/decompress/zstd_decompress_block.c
${SRC_DIR}/dictBuilder/cover.c
${SRC_DIR}/dictBuilder/divsufsort.c
${SRC_DIR}/dictBuilder/fastcover.c
${SRC_DIR}/dictBuilder/zdict.c
)

if (MSVC)
add_compile_options(-DZSTD_DISABLE_ASM)
else ()
if(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64.*|AMD64.*|x86_64.*|X86_64.*")
set(ALL_SOURCE_FILES ${ALL_SOURCE_FILES} ${SRC_DIR}/decompress/huf_decompress_amd64.S)
else()
add_compile_options(-DZSTD_DISABLE_ASM)
endif()
endif ()

add_library(libzstd_static STATIC ${ALL_SOURCE_FILES})

target_include_directories(libzstd_static PUBLIC ../zstd/lib)

0 comments on commit 7e6df07

Please sign in to comment.