https://raw.githubusercontent.com/archlinux/svntogit-community/packages/libretro-ppsspp/trunk/libretro-ppsspp-system-zstd.patch --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -135,6 +135,7 @@ option(USE_SYSTEM_SNAPPY "Dynamically link against system snappy" ${USE_SYSTEM_SNAPPY}) option(USE_SYSTEM_FFMPEG "Dynamically link against system FFMPEG" ${USE_SYSTEM_FFMPEG}) option(USE_SYSTEM_LIBZIP "Dynamically link against system libzip" ${USE_SYSTEM_LIBZIP}) +option(USE_SYSTEM_ZSTD "Dynamically link against system zstd" ${USE_SYSTEM_ZSTD}) option(USE_ASAN "Use address sanitizer" OFF) option(USE_UBSAN "Use undefined behaviour sanitizer" OFF) @@ -1892,9 +1893,21 @@ endif() endif() -set(CoreExtraLibs ${CoreExtraLibs} armips libzstd_static) -include_directories(ext/zstd/lib) +set(CoreExtraLibs ${CoreExtraLibs} armips) +find_package(PkgConfig) +if(PKG_CONFIG_FOUND) + pkg_check_modules(ZSTD libzstd) +endif() +if(ZSTD_FOUND AND USE_SYSTEM_ZSTD) + include_directories(${ZSTD_INCLUDE_DIRS}) + target_link_libraries(${CoreLibName} ${ZSTD_LIBRARIES}) +else() + add_subdirectory(ext/zstd/build/cmake EXCLUDE_FROM_ALL) + include_directories(ext/zstd/lib) + set(CoreExtraLibs ${CoreExtraLibs} libzstd_static) +endif() + # needed for VK_USE_PLATFORM_XCB_KHR only #if(VULKAN AND NOT WIN32) # target_link_libraries(native X11-xcb X11) @@ -1933,73 +1946,7 @@ # miniUPnPc integration (MiniUPnPc supposed to works on any POSIX system, not sure if some of these are redundant/not needed tho) if(USE_MINIUPNPC) - set (MINIUPNPC_VERSION 2.1) # used by miniupnpcstrings.h.cmake - set (MINIUPNPC_API_VERSION 17) - option(UPNPC_BUILD_STATIC "Build static library" TRUE) - option(NO_GETADDRINFO "Define NO_GETADDRINFO" FALSE) - mark_as_advanced(NO_GETADDRINFO) - if (NO_GETADDRINFO) - add_definitions(-DNO_GETADDRINFO) - endif() - - if (NOT WIN32) - add_definitions (-DMINIUPNPC_SET_SOCKET_TIMEOUT) - add_definitions (-D_BSD_SOURCE -D_DEFAULT_SOURCE -D_POSIX_C_SOURCE=200112L) - endif() - if (MACOSX) - add_definitions (-D_DARWIN_C_SOURCE) - endif() - if(WIN32) - add_definitions(-DWIN32 -DMINIUPNP_EXPORTS ) - else() - add_definitions(-fPIC) - endif() - - add_definitions(-DWITH_UPNP -DMINIUPNP_STATICLIB) - set(MINIUPNP_DIR "ext/miniupnp/miniupnpc") - include_directories(${CMAKE_CURRENT_BINARY_DIR}) - configure_file(${MINIUPNP_DIR}/miniupnpcstrings.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/miniupnpcstrings.h) # by default miniupnp repo doesn't contains miniupnpcstrings.h and need to be generated - set(MINIUPNPC_SOURCES - # the needed bits of miniupnpc (no python module, no tests, no cli) - ${MINIUPNP_DIR}/addr_is_reserved.c - ${MINIUPNP_DIR}/connecthostport.c - ${MINIUPNP_DIR}/igd_desc_parse.c - ${MINIUPNP_DIR}/minisoap.c - ${MINIUPNP_DIR}/minissdpc.c - ${MINIUPNP_DIR}/miniupnpc.c - ${MINIUPNP_DIR}/miniwget.c - ${MINIUPNP_DIR}/minixml.c - ${MINIUPNP_DIR}/minixmlvalid.c - ${MINIUPNP_DIR}/portlistingparse.c - ${MINIUPNP_DIR}/receivedata.c - #${MINIUPNP_DIR}/upnpc.c # causing an error due to already existing _main() - ${MINIUPNP_DIR}/upnpcommands.c - ${MINIUPNP_DIR}/upnpdev.c - ${MINIUPNP_DIR}/upnperrors.c - ${MINIUPNP_DIR}/upnpreplyparse.c - ${CMAKE_CURRENT_BINARY_DIR}/miniupnpcstrings.h - ) - if (NOT WIN32 AND NOT CMAKE_SYSTEM_NAME STREQUAL "AmigaOS") - #set(MINIUPNPC_SOURCES ${MINIUPNPC_SOURCES} minissdpc.c) # causing an error due to duplication in MINIUPNPC_SOURCES? - endif() - if (WIN32) - set_source_files_properties(${MINIUPNPC_SOURCES} PROPERTIES COMPILE_DEFINITIONS "MINIUPNP_STATICLIB;MINIUPNP_EXPORTS") - set(LDLIBS ws2_32 iphlpapi ${LDLIBS}) - #elseif (CMAKE_SYSTEM_NAME STREQUAL "Solaris") - # find_library (SOCKET_LIBRARY NAMES socket) - # find_library (NSL_LIBRARY NAMES nsl) - # find_library (RESOLV_LIBRARY NAMES resolv) - # set (LDLIBS ${SOCKET_LIBRARY} ${NSL_LIBRARY} ${RESOLV_LIBRARY} ${LDLIBS}) - endif() - if (UPNPC_BUILD_STATIC) - add_library(miniupnpc STATIC ${MINIUPNPC_SOURCES}) - target_link_libraries(${CoreLibName} miniupnpc ${LDLIBS}) - set(UPNPC_LIBRARY miniupnpc) - if (MSVC) - # Suppress noise warnings - target_compile_definitions(miniupnpc PRIVATE _CRT_SECURE_NO_WARNINGS _WINSOCK_DEPRECATED_NO_WARNINGS) - endif() - endif() + target_link_libraries(${CoreLibName} miniupnpc) endif() setup_target_project(${CoreLibName} Core) --- a/Core/Util/PortManager.h +++ b/Core/Util/PortManager.h @@ -26,9 +26,9 @@ #define MINIUPNP_STATICLIB #endif -#include "ext/miniupnp/miniupnpc/miniwget.h" -#include "ext/miniupnp/miniupnpc/miniupnpc.h" -#include "ext/miniupnp/miniupnpc/upnpcommands.h" +#include +#include +#include #include #include --- a/ext/CMakeLists.txt +++ b/ext/CMakeLists.txt @@ -15,11 +15,9 @@ set(ENABLE_HLSL OFF CACHE BOOL "let's not build HLSL support we don't need" FORCE) endif() -add_subdirectory(glslang EXCLUDE_FROM_ALL) add_subdirectory(snappy) add_subdirectory(udis86) add_subdirectory(SPIRV-Cross-build) if(USE_DISCORD AND NOT IOS AND NOT LIBRETRO) add_subdirectory(discord-rpc-build) endif() -add_subdirectory(zstd/build/cmake EXCLUDE_FROM_ALL) --- a/Common/GPU/Vulkan/VulkanContext.cpp +++ b/Common/GPU/Vulkan/VulkanContext.cpp @@ -21,7 +21,7 @@ #undef new #endif -#include "ext/glslang/SPIRV/GlslangToSpv.h" +#include #ifdef USE_CRT_DBG #define new DBG_NEW --- a/Common/GPU/ShaderTranslation.cpp +++ b/Common/GPU/ShaderTranslation.cpp @@ -34,12 +34,13 @@ #undef free #endif +#include + #include "Common/Log.h" #include "Common/StringUtils.h" #include "Common/GPU/Shader.h" #include "Common/GPU/ShaderTranslation.h" -#include "ext/glslang/SPIRV/GlslangToSpv.h" #include "Common/GPU/thin3d.h" #include "Common/GPU/OpenGL/GLFeatures.h" --- a/Common/GPU/Shader.cpp +++ b/Common/GPU/Shader.cpp @@ -4,7 +4,7 @@ #undef new #endif -#include "ext/glslang/SPIRV/GlslangToSpv.h" +#include const char *ShaderLanguageAsString(ShaderLanguage lang) { switch (lang) {