From 757ee321b170d38eac27cc78386c563d3ecdf8ec Mon Sep 17 00:00:00 2001 From: cheezwiz7899 Date: Wed, 24 Jun 2026 13:10:12 +1000 Subject: [PATCH] build: fix Xbyak ODR violation and update related dependencies - Fix a layout/ODR violation in Xbyak::CodeGenerator/LabelManager: In src/video_core/macro.cpp, replace the direct inclusion of with "common/x64/xbyak_abi.h". This ensures the custom container macros (XBYAK_STD_UNORDERED_*) are defined before the Xbyak headers are parsed, preventing different translation units from instantiating mismatched template offsets (which led to vmovaps crashes). - Update dynarmic submodule to c08207dd (latest master which updates its own external dependencies). - Update matching dependency pins in dependencies.cmake and their corresponding submodules in externals/ to maintain ABI compatibility: - fmt: update to e8244777ee1c32df8233c215ac9ff626b2dd2c38 - Catch2: update to 675f9eaeb191c51b9d2ffb2bb198009533895051 - oaknut: update to 94c726ce0338b054eb8cb5ea91de8fe6c19f4392 - xbyak: update to c506ecd5134122115a981fdd45c2a756f9ce20ac --- dependencies.cmake | 626 +++++++++++++++++++++++++++++++++++++++ externals/dynarmic | 2 +- externals/oaknut | 2 +- externals/xbyak | 2 +- src/video_core/macro.cpp | 2 +- 5 files changed, 630 insertions(+), 4 deletions(-) create mode 100644 dependencies.cmake diff --git a/dependencies.cmake b/dependencies.cmake new file mode 100644 index 0000000000..8d1ff6a544 --- /dev/null +++ b/dependencies.cmake @@ -0,0 +1,626 @@ +# SPDX-FileCopyrightText: 2026 citron Emulator Project +# SPDX-License-Identifier: GPL-2.0-or-later +# +# CMakeModules/dependencies.cmake +# +# CPM-managed dependencies. Included when CITRON_USE_CPM=ON, for any platform +# (Linux native, Windows native via MSYS2, Linux→Windows cross-compile). +# +# All packages are fetched from source and built statically. No system +# packages are assumed or required. CPM_USE_LOCAL_PACKAGES is intentionally +# left OFF so behaviour is identical regardless of what the host has installed. +# +# Packages NOT managed here: +# - vcpkg (submodule; only used by MSVC/Android paths with CITRON_USE_BUNDLED_VCPKG=ON) +# - Qt (pre-built binaries via aqt — see CMakeModules/qt_download.cmake) +# +# Static linking: BUILD_SHARED_LIBS is forced OFF in externals/CMakeLists.txt; +# all CPM packages inherit this setting. + + +# ── Submodule & vcpkg Policy ────────────────────────────────────────────────── +# Force-disable reliance on git submodules and vcpkg. All external dependencies +# must be fetched and managed via CPM to ensure portability and build-time +# environment isolation. +set(CITRON_CHECK_SUBMODULES OFF CACHE BOOL "Force disable submodule presence checks" FORCE) +set(CITRON_USE_BUNDLED_VCPKG OFF CACHE BOOL "Force disable vcpkg usage" FORCE) + +if (NOT COMMAND CPMAddPackage) + message(FATAL_ERROR "CPM.cmake not loaded — include CMakeModules/CPM.cmake before this file") +endif() + +# ── tzdb host capability check ──────────────────────────────────────────────── +# tzdb_to_nx builds 'zic' from C source using the host compiler. +# On WIN32 hosts, Windows headers lack POSIX APIs (link, symlink, readlink, +# 2-arg mkdir) so the source build always fails. Force the pre-built +# release artifact download path instead. +# On POSIX hosts (Linux, macOS) zic builds correctly; use CPMAddPackage. +if (WIN32) + set(CITRON_DOWNLOAD_TIME_ZONE_DATA ON CACHE BOOL + "Use pre-built timezone data (forced ON: host lacks POSIX build tools)" + FORCE) + set(CITRON_TZDB_USE_CPM FALSE) + message(STATUS "[tzdb] WIN32 host: using pre-built timezone data") +else() + set(CITRON_TZDB_USE_CPM TRUE) +endif() + +# ═══════════════════════════════════════════════════════════════════════════════ +# Core dependencies +# ═══════════════════════════════════════════════════════════════════════════════ + +# ── Boost ───────────────────────────────────────────────────────────────────── +if (NOT TARGET Boost::headers) + set(BOOST_INCLUDE_LIBRARIES "algorithm;asio;container;context;crc;heap;icl;intrusive;process;range;spirit;test;timer;variant" CACHE STRING "Boost components to build") + set(BOOST_ENABLE_CMAKE ON CACHE BOOL "Enable Boost CMake") + set(BUILD_TESTING OFF CACHE BOOL "Disable testing") + set(BUILD_SHARED_LIBS OFF CACHE BOOL "Disable shared libs") + CPMAddPackage( + NAME Boost + URL "https://github.com/boostorg/boost/releases/download/boost-1.87.0/boost-1.87.0-cmake.tar.xz" + ) + if (TARGET Boost::headers) + set(_boost_headers_target "Boost::headers") + get_target_property(_boost_headers_aliased "${_boost_headers_target}" ALIASED_TARGET) + if (_boost_headers_aliased) + set(_boost_headers_target "${_boost_headers_aliased}") + endif() + file(GLOB _boost_header_include_dirs LIST_DIRECTORIES true + "${Boost_SOURCE_DIR}/libs/*/include") + list(REMOVE_DUPLICATES _boost_header_include_dirs) + if (_boost_header_include_dirs) + target_include_directories("${_boost_headers_target}" SYSTEM INTERFACE ${_boost_header_include_dirs}) + endif() + endif() +endif() + +# ── fmt ─────────────────────────────────────────────────────────────────────── +if (NOT TARGET fmt::fmt) + CPMAddPackage( + NAME fmt + GITHUB_REPOSITORY fmtlib/fmt + GIT_TAG e8244777ee1c32df8233c215ac9ff626b2dd2c38 + OPTIONS "FMT_INSTALL OFF" + ) +endif() + +# ── lz4 ─────────────────────────────────────────────────────────────────────── +if (NOT TARGET lz4::lz4) + CPMAddPackage( + NAME lz4 + GITHUB_REPOSITORY lz4/lz4 + GIT_TAG v1.10.0 + SOURCE_SUBDIR build/cmake + OPTIONS + "LZ4_BUILD_CLI OFF" + "LZ4_BUILD_LEGACY_LZ4C OFF" + "BUILD_SHARED_LIBS OFF" + "BUILD_STATIC_LIBS ON" + ) + if (TARGET lz4_static AND NOT TARGET lz4::lz4) + add_library(lz4::lz4 ALIAS lz4_static) + endif() +endif() + +# ── nlohmann-json (header-only) ─────────────────────────────────────────────── +if (NOT TARGET nlohmann_json::nlohmann_json) + CPMAddPackage( + NAME nlohmann_json + GITHUB_REPOSITORY nlohmann/json + GIT_TAG v3.11.3 + OPTIONS "JSON_BuildTests OFF" + ) +endif() + +# ── zlib ────────────────────────────────────────────────────────────────────── +if (NOT TARGET ZLIB::ZLIB) + CPMAddPackage( + NAME ZLIB + GITHUB_REPOSITORY madler/zlib + GIT_TAG v1.3.1 + OPTIONS "ZLIB_BUILD_EXAMPLES OFF" + ) + if (TARGET zlibstatic AND NOT TARGET ZLIB::ZLIB) + add_library(ZLIB::ZLIB ALIAS zlibstatic) + set(ZLIB_FOUND TRUE CACHE BOOL "" FORCE) + set(ZLIB_INCLUDE_DIRS "${ZLIB_SOURCE_DIR};${ZLIB_BINARY_DIR}" CACHE PATH "" FORCE) + endif() +endif() + +# ── zstd ────────────────────────────────────────────────────────────────────── +if (NOT TARGET zstd::libzstd_static) + CPMAddPackage( + NAME zstd + GITHUB_REPOSITORY facebook/zstd + GIT_TAG v1.5.6 + SOURCE_SUBDIR build/cmake + OPTIONS + "ZSTD_BUILD_PROGRAMS OFF" + "ZSTD_BUILD_SHARED OFF" + "ZSTD_BUILD_STATIC ON" + "ZSTD_BUILD_TESTS OFF" + ) + if (TARGET libzstd_static AND NOT TARGET zstd::libzstd_static) + add_library(zstd::libzstd_static ALIAS libzstd_static) + add_library(zstd::zstd ALIAS libzstd_static) + set(zstd_FOUND TRUE CACHE BOOL "" FORCE) + endif() +endif() + +# ── OpenAL Soft ─────────────────────────────────────────────────────────────── +if (NOT TARGET OpenAL::OpenAL) + CPMAddPackage( + NAME OpenAL + GITHUB_REPOSITORY kcat/openal-soft + GIT_TAG 1.24.3 + OPTIONS + "ALSOFT_UTILS OFF" + "ALSOFT_EXAMPLES OFF" + "ALSOFT_TESTS OFF" + "ALSOFT_INSTALL OFF" + "ALSOFT_INSTALL_CONFIG OFF" + "LIBTYPE STATIC" + ) + if (TARGET OpenAL AND NOT TARGET OpenAL::OpenAL) + add_library(OpenAL::OpenAL ALIAS OpenAL) + endif() + # Patch OpenAL's vendored fmt header to fix undeclared 'malloc' on some toolchains + if (OpenAL_ADDED AND EXISTS "${OpenAL_SOURCE_DIR}/fmt-11.1.1/include/fmt/format.h") + file(READ "${OpenAL_SOURCE_DIR}/fmt-11.1.1/include/fmt/format.h" _fmt_content) + if (NOT _fmt_content MATCHES "#include ") + string(REPLACE "#include \"base.h\"" "#include \"base.h\"\n#include " _fmt_content "${_fmt_content}") + file(WRITE "${OpenAL_SOURCE_DIR}/fmt-11.1.1/include/fmt/format.h" "${_fmt_content}") + endif() + endif() +endif() + +# ── OpenSSL ─────────────────────────────────────────────────────────────────── +if (ENABLE_OPENSSL OR ENABLE_WEB_SERVICE) + include(${CMAKE_SOURCE_DIR}/CMakeModules/openssl_build.cmake) +endif() + +# ── Catch2 (test framework) ─────────────────────────────────────────────────── +if (CITRON_TESTS AND NOT TARGET Catch2::Catch2) + CPMAddPackage( + NAME Catch2 + GITHUB_REPOSITORY catchorg/Catch2 + GIT_TAG 675f9eaeb191c51b9d2ffb2bb198009533895051 + OPTIONS "CATCH_INSTALL_DOCS OFF" + ) +endif() + +# ═══════════════════════════════════════════════════════════════════════════════ +# Header-only / trivial packages +# ═══════════════════════════════════════════════════════════════════════════════ + +# ── unordered_dense ─────────────────────────────────────────────────────────── +CPMAddPackage( + NAME unordered_dense + GITHUB_REPOSITORY martinus/unordered_dense + GIT_TAG 7b55cab8418da1603496462ce3ccdb4cb1dc3368 + OPTIONS "BUILD_TESTING OFF" +) + +# ── simpleini ───────────────────────────────────────────────────────────────── +if (NOT TARGET SimpleIni::SimpleIni) + CPMAddPackage( + NAME simpleini + GITHUB_REPOSITORY brofield/simpleini + GIT_TAG v4.22 + ) +endif() + +# cpp-jwt removed: JWT RS256 verification is now done directly with OpenSSL EVP +# in web_service/verify_user_jwt.cpp. No external JWT library needed. + +# ── cpp-httplib ─────────────────────────────────────────────────────────────── +# OpenSSL TLS support via CPPHTTPLIB_OPENSSL_SUPPORT. +# web_backend.cpp instantiates httplib::Client with an https:// host which +# auto-upgrades to TLS through this path. +if (ENABLE_WEB_SERVICE AND NOT TARGET httplib::httplib) + CPMAddPackage( + NAME httplib + GITHUB_REPOSITORY yhirose/cpp-httplib + GIT_TAG v0.18.3 + DOWNLOAD_ONLY TRUE + ) + if (httplib_ADDED) + add_library(httplib::httplib INTERFACE IMPORTED GLOBAL) + target_compile_features(httplib::httplib INTERFACE cxx_std_11) + target_include_directories(httplib::httplib SYSTEM INTERFACE "${httplib_SOURCE_DIR}") + target_compile_definitions(httplib::httplib INTERFACE CPPHTTPLIB_OPENSSL_SUPPORT) + target_link_libraries(httplib::httplib INTERFACE + OpenSSL::SSL + OpenSSL::Crypto + $<$:Threads::Threads> + $<$:ws2_32> + ) + endif() +endif() + +# ── xbyak ───────────────────────────────────────────────────────────────────── +if ((ARCHITECTURE_x86 OR ARCHITECTURE_x86_64) AND NOT TARGET xbyak::xbyak) + CPMAddPackage( + NAME xbyak + GITHUB_REPOSITORY herumi/xbyak + GIT_TAG c506ecd5134122115a981fdd45c2a756f9ce20ac + ) +endif() + +# ── Vulkan-Headers ──────────────────────────────────────────────────────────── +option(CITRON_USE_VULKAN_STUB "Use pre-generated Vulkan stub instead of fetching Vulkan-Headers" ON) + +if (CITRON_USE_EXTERNAL_VULKAN_HEADERS AND NOT TARGET Vulkan::Headers) + if (CITRON_USE_VULKAN_STUB AND + NOT CITRON_USE_EXTERNAL_VULKAN_UTILITY_LIBRARIES AND + EXISTS "${CMAKE_SOURCE_DIR}/externals/vulkan-stub/include") + add_library(Vulkan-Headers INTERFACE) + target_include_directories(Vulkan-Headers SYSTEM INTERFACE + "${CMAKE_SOURCE_DIR}/externals/vulkan-stub/include") + target_compile_definitions(Vulkan-Headers INTERFACE VK_ENABLE_BETA_EXTENSIONS) + add_library(Vulkan::Headers ALIAS Vulkan-Headers) + else() + CPMAddPackage( + NAME Vulkan-Headers + GITHUB_REPOSITORY KhronosGroup/Vulkan-Headers + GIT_TAG v1.4.337 + ) + endif() +endif() + +# ── Vulkan-Utility-Libraries ────────────────────────────────────────────────── +if (CITRON_USE_EXTERNAL_VULKAN_UTILITY_LIBRARIES AND NOT TARGET Vulkan::LayerSettings) + CPMAddPackage( + NAME Vulkan-Utility-Libraries + GITHUB_REPOSITORY KhronosGroup/Vulkan-Utility-Libraries + GIT_TAG v1.4.337 + OPTIONS "BUILD_TESTS OFF" + ) +endif() + +# ── VulkanMemoryAllocator ───────────────────────────────────────────────────── +if (NOT TARGET GPUOpen::VulkanMemoryAllocator) + CPMAddPackage( + NAME VulkanMemoryAllocator + GITHUB_REPOSITORY GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator + GIT_TAG v3.1.0 + SYSTEM YES + OPTIONS "VMA_BUILD_SAMPLES OFF" + ) +endif() + +# ═══════════════════════════════════════════════════════════════════════════════ +# Compiled libraries — upstream repos +# ═══════════════════════════════════════════════════════════════════════════════ + +# ── SPIRV-Headers ───────────────────────────────────────────────────────────── +# Must be declared before sirit. +if (NOT TARGET SPIRV-Headers) + CPMAddPackage( + NAME SPIRV-Headers + GITHUB_REPOSITORY KhronosGroup/SPIRV-Headers + GIT_TAG vulkan-sdk-1.4.304.1 + OPTIONS + "SPIRV_HEADERS_SKIP_EXAMPLES ON" + "SPIRV_HEADERS_SKIP_INSTALL ON" + ) +endif() + +# ── enet ────────────────────────────────────────────────────────────────────── +if (NOT TARGET enet::enet) + CPMAddPackage( + NAME enet + GITHUB_REPOSITORY lsalzman/enet + GIT_TAG 39a72ab1990014eb399cee9d538fd529df99c6a0 + ) + if (TARGET enet AND NOT TARGET enet::enet) + target_include_directories(enet INTERFACE + $) + add_library(enet::enet ALIAS enet) + endif() +endif() + +# ── opus ────────────────────────────────────────────────────────────────────── +if (NOT TARGET Opus::opus) + CPMAddPackage( + NAME opus + GITHUB_REPOSITORY xiph/opus + GIT_TAG v1.5.2 + OPTIONS + "OPUS_BUILD_TESTING OFF" + "OPUS_BUILD_PROGRAMS OFF" + "OPUS_INSTALL_PKG_CONFIG_MODULE OFF" + "OPUS_INSTALL_CMAKE_CONFIG_MODULE OFF" + ) +endif() + +# ── cubeb ───────────────────────────────────────────────────────────────────── +if (ENABLE_CUBEB AND NOT TARGET cubeb::cubeb) + CPMAddPackage( + NAME cubeb + GITHUB_REPOSITORY mozilla/cubeb + GIT_TAG 48689ae7a73caeb747953f9ed664dc71d2f918d8 + OPTIONS + "BUILD_TESTS OFF" + "BUILD_TOOLS OFF" + "BUILD_RUST_LIBS OFF" + ) + if (TARGET cubeb AND NOT TARGET cubeb::cubeb) + add_library(cubeb::cubeb ALIAS cubeb) + endif() + if (NOT MSVC) + if (TARGET speex) + target_compile_options(speex PRIVATE -Wno-sign-compare) + endif() + if (TARGET cubeb) + target_compile_options(cubeb PRIVATE -Wno-implicit-const-int-float-conversion) + endif() + endif() +endif() + +# ── SDL2 ────────────────────────────────────────────────────────────────────── +if (CITRON_USE_EXTERNAL_SDL2 AND NOT TARGET SDL2::SDL2) + CPMAddPackage( + NAME SDL2 + GITHUB_REPOSITORY libsdl-org/SDL + GIT_TAG release-2.32.10 + OPTIONS + "SDL_SHARED OFF" + "SDL_STATIC ON" + "SDL_TEST OFF" + ) +endif() + +# ── tzdb_to_nx ──────────────────────────────────────────────────────────────── +# On POSIX hosts: fetch source via CPM; nx_tzdb/CMakeLists.txt builds zic and +# generates the timezone headers at build time. +# On WIN32 hosts: CITRON_TZDB_USE_CPM=FALSE (set above); nx_tzdb downloads the +# pre-built 221202.zip archive instead. +if (CITRON_TZDB_USE_CPM) + CPMAddPackage( + NAME tzdb_to_nx + GITHUB_REPOSITORY lat9nq/tzdb_to_nx + GIT_TAG 97929690234f2b4add36b33657fe3fe09bd57dfd + DOWNLOAD_ONLY YES + ) +endif() +if (tzdb_to_nx_SOURCE_DIR) + set(TZDB_TO_NX_SOURCE_DIR "${tzdb_to_nx_SOURCE_DIR}") +endif() + +# ═══════════════════════════════════════════════════════════════════════════════ +# Forked repos — pinned to exact SHAs +# ═══════════════════════════════════════════════════════════════════════════════ + +# mbedtls removed: all mbedtls usage replaced with OpenSSL EVP and AES-NI +# intrinsics. OpenSSL is built via openssl_build.cmake (CPM). + +# ── oaknut (yuzu-mirror fork) — AArch64 only ────────────────────────────────── +if (ARCHITECTURE_arm64 AND NOT TARGET merry::oaknut) + CPMAddPackage( + NAME oaknut + GITHUB_REPOSITORY yuzu-mirror/oaknut + GIT_TAG 94c726ce0338b054eb8cb5ea91de8fe6c19f4392 + ) +endif() + +# ── sirit (yuzu-mirror fork) ────────────────────────────────────────────────── +# sirit needs SPIRV-Headers. CPM already populated it above. +if (NOT TARGET sirit) + set(SIRIT_USE_SYSTEM_SPIRV_HEADERS ON) + CPMAddPackage( + NAME sirit + GITHUB_REPOSITORY yuzu-mirror/sirit + GIT_TAG ab75463999f4f3291976b079d42d52ee91eebf3f + ) +endif() + +# ── dynarmic (xinitrcn1 fork) ───────────────────────────────────────────────── +if ((ARCHITECTURE_x86_64 OR ARCHITECTURE_arm64) AND NOT (MSVC AND ARCHITECTURE_arm64)) + if (NOT TARGET dynarmic::dynarmic) + CPMAddPackage( + NAME dynarmic + GITHUB_REPOSITORY xinitrcn1/dynarmic + GIT_TAG c08207ddec63447d625a382b56b04f68c17526c4 + OPTIONS + "DYNARMIC_USE_PRECOMPILED_HEADERS ${CITRON_USE_PRECOMPILED_HEADERS}" + "DYNARMIC_IGNORE_ASSERTS ON" + "DYNARMIC_TESTS OFF" + ) + if (TARGET dynarmic AND NOT TARGET dynarmic::dynarmic) + add_library(dynarmic::dynarmic ALIAS dynarmic) + endif() + + if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND dynarmic_ADDED) + execute_process( + COMMAND git apply --ignore-whitespace + "${CMAKE_SOURCE_DIR}/patches/mcl_clang_template_fix.patch" + WORKING_DIRECTORY "${dynarmic_SOURCE_DIR}/externals/mcl" + RESULT_VARIABLE _mcl_patch + OUTPUT_QUIET ERROR_QUIET + ) + endif() + endif() + + # ── dynarmic abi.cpp: vmovaps → movaps in XMM callee-save loops ──────────── + # + # Root cause (under investigation): Xbyak::CodeGenerator::vmovaps() calls + # opAVX_X_XM_IMM() → opAVX_X_X_XM() → cvtIdx0(), which reads the reference + # member this->xm0 from a compile-time-baked offset. Due to a CodeGenerator + # layout mismatch across TU boundaries (the linker-selected vmovaps comes from + # a TU whose xm0 offset differs from the offset in the BlockOfCode object), xm0 + # resolves to the wrong member. x2->isXMM() returns false → Xbyak throws + # ERR_BAD_COMBINATION at JIT initialisation before a single guest byte runs. + # + # Fix: replace code.vmovaps() with code.movaps() in the XMM push/pop loops. + # movaps() takes the opMR() path, which encodes the XMM index directly and + # never calls cvtIdx0() / reads xm0. Both emit correct 128-bit XMM save/ + # restore code; the only difference is VEX vs legacy SSE prefix, which is + # irrelevant for callee-save correctness. + # + # Implementation: pure CMake string replace — no sed, no shell, fully portable. + # The check for the literal string "vmovaps" makes it idempotent across reconfigures + # (subsequent runs detect the file was already patched and skip the write). + if (DEFINED dynarmic_SOURCE_DIR) + set(_citron_abi_cpp "${dynarmic_SOURCE_DIR}/src/dynarmic/backend/x64/abi.cpp") + if (EXISTS "${_citron_abi_cpp}") + file(READ "${_citron_abi_cpp}" _citron_abi_content) + if ("${_citron_abi_content}" MATCHES "code\\.vmovaps") + message(STATUS "[citron] Patching dynarmic/backend/x64/abi.cpp: vmovaps → movaps in callee-save loops") + string(REPLACE "code.vmovaps(" "code.movaps(" _citron_abi_content "${_citron_abi_content}") + file(WRITE "${_citron_abi_cpp}" "${_citron_abi_content}") + else() + message(STATUS "[citron] dynarmic/backend/x64/abi.cpp already patched (no vmovaps found)") + endif() + else() + message(WARNING "[citron] Expected dynarmic abi.cpp not found at ${_citron_abi_cpp}") + endif() + endif() + unset(_citron_abi_cpp) + unset(_citron_abi_content) +endif() + +# ── discord-rpc (yuzu-mirror fork) ─────────────────────────────────────────── +if (USE_DISCORD_PRESENCE AND NOT TARGET DiscordRPC::discord-rpc) + CPMAddPackage( + NAME discord-rpc + GITHUB_REPOSITORY yuzu-mirror/discord-rpc + GIT_TAG 20cc99aeffa08a4834f156b6ab49ed68618cf94a + OPTIONS "BUILD_EXAMPLES OFF" + ) + if (discord-rpc_ADDED) + execute_process( + COMMAND git apply --ignore-whitespace + "${CMAKE_SOURCE_DIR}/patches/rapidjson-compiler-fix.patch" + WORKING_DIRECTORY "${discord-rpc_SOURCE_DIR}/thirdparty/rapidjson-1.1.0" + RESULT_VARIABLE _rj_patch OUTPUT_QUIET ERROR_QUIET + ) + execute_process( + COMMAND git apply -p0 --ignore-whitespace + "${CMAKE_SOURCE_DIR}/patches/discord-rpc-wclass-memaccess-fix.patch" + WORKING_DIRECTORY "${discord-rpc_SOURCE_DIR}" + RESULT_VARIABLE _dr_patch OUTPUT_QUIET ERROR_QUIET + ) + endif() + if (TARGET discord-rpc AND NOT TARGET DiscordRPC::discord-rpc) + target_include_directories(discord-rpc INTERFACE + $) + add_library(DiscordRPC::discord-rpc ALIAS discord-rpc) + endif() +endif() + +# ── breakpad (yuzu-mirror fork) ─────────────────────────────────────────────── +# Has no usable CMakeLists of its own. Fetched with DOWNLOAD_ONLY so the +# source is available; externals/CMakeLists.txt contains the build rules and +# uses ${breakpad_SOURCE_DIR} when CPM is active. +if (CITRON_CRASH_DUMPS AND NOT TARGET libbreakpad_client) + CPMAddPackage( + NAME breakpad + GITHUB_REPOSITORY yuzu-mirror/breakpad + GIT_TAG c89f9dddc793f19910ef06c13e4fd240da4e7a59 + DOWNLOAD_ONLY YES + ) +endif() + +# ── libadrenotools — Android only ───────────────────────────────────────────── +if (ANDROID AND ARCHITECTURE_arm64) + CPMAddPackage( + NAME libadrenotools + GITHUB_REPOSITORY bylaws/libadrenotools + GIT_TAG 5cd3f5c5ceea6d9e9d435ccdd922d9b99e55d10b + ) +endif() + +# ═══════════════════════════════════════════════════════════════════════════════ +# libusb wrapper +# ═══════════════════════════════════════════════════════════════════════════════ +# libusb lives at externals/libusb/libusb (nested). The wrapper CMakeLists at +# externals/libusb/ builds it manually using LIBUSB_CPM_SOURCE_DIR as the root. +if (ENABLE_LIBUSB AND NOT TARGET libusb::usb) + CPMAddPackage( + NAME libusb_src + GITHUB_REPOSITORY libusb/libusb + GIT_TAG v1.0.27 + DOWNLOAD_ONLY YES + ) + if (libusb_src_ADDED) + set(LIBUSB_CPM_SOURCE_DIR ${libusb_src_SOURCE_DIR} CACHE INTERNAL "") + endif() +endif() + +# ═══════════════════════════════════════════════════════════════════════════════ +# FFmpeg +# ═══════════════════════════════════════════════════════════════════════════════ +# FFmpeg uses autotools, not CMake, so CPM can only download the source. +# The actual build is handled by externals/ffmpeg/CMakeLists.txt at build time +# using autoconf+make. FFMPEG_CPM_SOURCE_DIR tells it where the source landed. +# +# On Windows: the build script pre-builds static FFmpeg before cmake runs and +# passes CITRON_FFMPEG_STATIC_DIR. The CPM download is then informational only. + +if (DEFINED CITRON_FFMPEG_STATIC_DIR) + # Pre-built static libs supplied externally (Windows build script path). + set(FFmpeg_PATH "${CITRON_FFMPEG_STATIC_DIR}") + set(FFmpeg_INCLUDE_DIR "${FFmpeg_PATH}/include") + set(FFmpeg_LIBRARIES + "${FFmpeg_PATH}/lib/libavfilter.a" + "${FFmpeg_PATH}/lib/libswscale.a" + "${FFmpeg_PATH}/lib/libswresample.a" + "${FFmpeg_PATH}/lib/libavcodec.a" + "${FFmpeg_PATH}/lib/libavutil.a" + ) + if (WIN32) + find_library(FFmpeg_ICONV_LIBRARY NAMES iconv libiconv) + if (FFmpeg_ICONV_LIBRARY) + list(APPEND FFmpeg_LIBRARIES "${FFmpeg_ICONV_LIBRARY}") + endif() + list(APPEND FFmpeg_LIBRARIES bcrypt m) + endif() + set(FFmpeg_FOUND TRUE) +elseif (CITRON_USE_BUNDLED_FFMPEG) + # Download source for the autotools build in externals/ffmpeg/CMakeLists.txt. + CPMAddPackage( + NAME ffmpeg_src + GITHUB_REPOSITORY FFmpeg/FFmpeg + GIT_TAG n8.0 + DOWNLOAD_ONLY YES + ) + if (ffmpeg_src_ADDED) + set(FFMPEG_CPM_SOURCE_DIR "${ffmpeg_src_SOURCE_DIR}" CACHE INTERNAL + "FFmpeg source location for the autotools bundled build") + endif() +endif() + +# ── Dependency Versions (Qt, ICU, XCB) ───────────────────────────────────────── +set(CITRON_QT_VERSION "6.9.3" CACHE STRING "Qt version to download via aqt") + +set(CITRON_ICU_REPO "unicode-org/icu" CACHE STRING "ICU GitHub repository") +set(CITRON_ICU_TAG "release-73-2" CACHE STRING "ICU git tag/version") + +set(CITRON_XCB_MACROS_VER "1.20.2" CACHE STRING "XCB util-macros version") +set(CITRON_XCB_PROTO_VER "1.17.0" CACHE STRING "XCB proto version") +set(CITRON_XCB_XAU_VER "1.0.11" CACHE STRING "XCB libXau version") +set(CITRON_XCB_XDMCP_VER "1.1.5" CACHE STRING "XCB libXdmcp version") +set(CITRON_XCB_LIBXCB_VER "1.16" CACHE STRING "XCB libxcb version") +set(CITRON_XCB_UTIL_VER "0.4.1" CACHE STRING "XCB util version") +set(CITRON_XCB_CURSOR_VER "0.1.6" CACHE STRING "XCB cursor version") +set(CITRON_XCB_IMAGE_VER "0.4.1" CACHE STRING "XCB image version") +set(CITRON_XCB_KEYSYMS_VER "0.4.1" CACHE STRING "XCB keysyms version") +set(CITRON_XCB_RENDERUTIL_VER "0.3.10" CACHE STRING "XCB renderutil version") +set(CITRON_XCB_WM_VER "0.4.2" CACHE STRING "XCB wm version") + +# ═══════════════════════════════════════════════════════════════════════════════ +# Qt +# ═══════════════════════════════════════════════════════════════════════════════ +# Qt uses a proprietary distribution model incompatible with CPM source fetches. +# Pre-built binaries are downloaded via aqt (pip install aqtinstall). +# See CMakeModules/qt_download.cmake for details. +if (ENABLE_QT AND NOT USE_SYSTEM_QT) + include(${CMAKE_SOURCE_DIR}/CMakeModules/qt_download.cmake) + if (CMAKE_SYSTEM_NAME STREQUAL "Linux") + include(${CMAKE_SOURCE_DIR}/CMakeModules/icu_build.cmake) + include(${CMAKE_SOURCE_DIR}/CMakeModules/xcb_build.cmake) + endif() +endif() + +message(STATUS "[CPM] All dependency packages configured") diff --git a/externals/dynarmic b/externals/dynarmic index bee46cba43..c08207ddec 160000 --- a/externals/dynarmic +++ b/externals/dynarmic @@ -1 +1 @@ -Subproject commit bee46cba43ce7e7e32701d356ddf1f05e4754842 +Subproject commit c08207ddec63447d625a382b56b04f68c17526c4 diff --git a/externals/oaknut b/externals/oaknut index 9d091109de..94c726ce03 160000 --- a/externals/oaknut +++ b/externals/oaknut @@ -1 +1 @@ -Subproject commit 9d091109deb445bc6e9289c6195a282b7c993d49 +Subproject commit 94c726ce0338b054eb8cb5ea91de8fe6c19f4392 diff --git a/externals/xbyak b/externals/xbyak index 560ca67142..c506ecd513 160000 --- a/externals/xbyak +++ b/externals/xbyak @@ -1 +1 @@ -Subproject commit 560ca671421e47e32d3c8270623aaa74454570f4 +Subproject commit c506ecd5134122115a981fdd45c2a756f9ce20ac diff --git a/src/video_core/macro.cpp b/src/video_core/macro.cpp index a215454b08..5f53153173 100644 --- a/src/video_core/macro.cpp +++ b/src/video_core/macro.cpp @@ -21,7 +21,7 @@ #pragma clang diagnostic ignored "-Wconversion" #pragma clang diagnostic ignored "-Wshadow" #endif -#include +#include "common/x64/xbyak_abi.h" #endif #include "common/assert.h"