From 720ad4e6cf0ed2e3ef933f21bf52c209331dc106 Mon Sep 17 00:00:00 2001 From: crueter Date: Wed, 16 Jul 2025 01:15:30 -0400 Subject: [PATCH] [cmake] Fix QuaZip once and for all (and core5compat) Signed-off-by: crueter --- .ci/patch/0002-quazip-fetchcontent.patch | 13 - .../quazip/0001-strict.patch | 0 .patch/quazip/0002-oldstyle.patch | 26 ++ .patch/quazip/0003-predecls.patch | 19 + .patch/quazip/0004-qt6-only.patch | 400 ++++++++++++++++++ CMakeLists.txt | 8 +- src/yuzu/CMakeLists.txt | 2 +- src/yuzu/externals/CMakeLists.txt | 23 +- 8 files changed, 460 insertions(+), 31 deletions(-) delete mode 100644 .ci/patch/0002-quazip-fetchcontent.patch rename .ci/patch/0001-quazip-strict.patch => .patch/quazip/0001-strict.patch (100%) create mode 100644 .patch/quazip/0002-oldstyle.patch create mode 100644 .patch/quazip/0003-predecls.patch create mode 100644 .patch/quazip/0004-qt6-only.patch diff --git a/.ci/patch/0002-quazip-fetchcontent.patch b/.ci/patch/0002-quazip-fetchcontent.patch deleted file mode 100644 index 3554b7dbb6..0000000000 --- a/.ci/patch/0002-quazip-fetchcontent.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/cmake/clone-repo.cmake b/cmake/clone-repo.cmake -index 2ffb4b2..77974dc 100644 ---- a/cmake/clone-repo.cmake -+++ b/cmake/clone-repo.cmake -@@ -26,7 +26,7 @@ macro(clone_repo name url) - FetchContent_GetProperties(${name} POPULATED ${name_lower}_POPULATED) - - if(NOT ${name_lower}_POPULATED) -- FetchContent_Populate(${name}) -+ FetchContent_MakeAvailable(${name}) - endif() - - set(${name_upper}_SOURCE_DIR ${${name_lower}_SOURCE_DIR}) diff --git a/.ci/patch/0001-quazip-strict.patch b/.patch/quazip/0001-strict.patch similarity index 100% rename from .ci/patch/0001-quazip-strict.patch rename to .patch/quazip/0001-strict.patch diff --git a/.patch/quazip/0002-oldstyle.patch b/.patch/quazip/0002-oldstyle.patch new file mode 100644 index 0000000000..2694128f04 --- /dev/null +++ b/.patch/quazip/0002-oldstyle.patch @@ -0,0 +1,26 @@ +diff --git a/quazip/minizip_crypt.h b/quazip/minizip_crypt.h +index 2e833f7..ea9d277 100644 +--- a/quazip/minizip_crypt.h ++++ b/quazip/minizip_crypt.h +@@ -90,13 +90,14 @@ static void init_keys(const char* passwd,unsigned long* pkeys,const z_crc_t FAR + # define ZCR_SEED2 3141592654UL /* use PI as default pattern */ + # endif + +-static int crypthead(passwd, buf, bufSize, pkeys, pcrc_32_tab, crcForCrypting) +- const char *passwd; /* password string */ +- unsigned char *buf; /* where to write header */ +- int bufSize; +- unsigned long* pkeys; +- const z_crc_t FAR * pcrc_32_tab; +- unsigned long crcForCrypting; ++static int crypthead( ++ const char *passwd, /* password string */ ++ unsigned char *buf, /* where to write header */ ++ int bufSize, ++ unsigned long* pkeys, ++ const z_crc_t FAR * pcrc_32_tab, ++ unsigned long crcForCrypting ++) + { + int n; /* index in random header */ + int t; /* temporary */ diff --git a/.patch/quazip/0003-predecls.patch b/.patch/quazip/0003-predecls.patch new file mode 100644 index 0000000000..ec3414c82a --- /dev/null +++ b/.patch/quazip/0003-predecls.patch @@ -0,0 +1,19 @@ +diff --git a/quazip/zip.c b/quazip/zip.c +index 7788b88..f4e21aa 100644 +--- a/quazip/zip.c ++++ b/quazip/zip.c +@@ -645,6 +645,14 @@ local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib + return relativeOffset; + } + ++// compilers hate this ONE SIMPLE TRICK! ++static int LoadCentralDirectoryRecord(zip64_internal* pziinit); ++static int Write_LocalFileHeader(zip64_internal* zi, const char* filename, uInt size_extrafield_local, const void* extrafield_local, uLong version_to_extract); ++static int Write_Zip64EndOfCentralDirectoryLocator(zip64_internal* zi, ZPOS64_T zip64eocd_pos_inzip); ++static int Write_Zip64EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip); ++static int Write_EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip); ++static int Write_GlobalComment(zip64_internal* zi, const char* global_comment); ++ + int LoadCentralDirectoryRecord(zip64_internal* pziinit) + { + int err=ZIP_OK; diff --git a/.patch/quazip/0004-qt6-only.patch b/.patch/quazip/0004-qt6-only.patch new file mode 100644 index 0000000000..8906df2472 --- /dev/null +++ b/.patch/quazip/0004-qt6-only.patch @@ -0,0 +1,400 @@ +"Debloats" QuaZip by removing some unneeded stuff (Qt <6, bzip2, emscripten...) + +This is completely optional. + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index b376fb2..4aac4ec 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -3,64 +3,16 @@ cmake_minimum_required(VERSION 3.15...3.18) + + project(QuaZip VERSION 1.5) + +-include(cmake/clone-repo.cmake) +- + set(QUAZIP_LIB_VERSION ${QuaZip_VERSION}) + set(QUAZIP_LIB_SOVERSION 1.5.0) + +-if(EMSCRIPTEN) +- #option(ZLIB_INCLUDE "Path to include dir" "") +- #option(ZLIB_LIBRARY "Path to library dir" "") +- option(BUILD_SHARED_LIBS "" OFF) +- option(QUAZIP_INSTALL "" OFF) +- option(QUAZIP_USE_QT_ZLIB "" OFF) +- option(QUAZIP_ENABLE_TESTS "Build QuaZip tests" OFF) +-else() +- option(BUILD_SHARED_LIBS "" ON) +- option(QUAZIP_INSTALL "" ON) +- option(QUAZIP_USE_QT_ZLIB "" OFF) +- option(QUAZIP_ENABLE_TESTS "Build QuaZip tests" OFF) +-endif() ++option(BUILD_SHARED_LIBS "" ON) ++option(QUAZIP_INSTALL "" ON) ++option(QUAZIP_ENABLE_TESTS "Build QuaZip tests" OFF) + + OPTION(ZLIB_CONST "Sets ZLIB_CONST preprocessor definition" OFF) + +-# Make BZIP2 optional +-option(QUAZIP_BZIP2 "Enables BZIP2 compression" ON) +-option(QUAZIP_BZIP2_STDIO "Output BZIP2 errors to stdio" ON) +- +-option(QUAZIP_FETCH_LIBS "Enables fetching third-party libraries if not found" ${WIN32}) +-option(QUAZIP_FORCE_FETCH_LIBS "Enables fetching third-party libraries always" OFF) +- +-if (QUAZIP_USE_QT_ZLIB AND BUILD_SHARED_LIBS) +- message(FATAL_ERROR "Using BUILD_SHARED_LIBS=ON together with QUAZIP_USE_QT_ZLIB=ON is not supported." ) +-endif() +- +-# Set the default value of `${QUAZIP_QT_MAJOR_VERSION}`. +-# We search quietly for Qt6, Qt5 and Qt4 in that order. +-# Qt6 and Qt5 provide config files for CMake. +-# Qt4 relies on `FindQt4.cmake`. +-find_package( +- QT NAMES Qt6 Qt5 +- QUIET COMPONENTS Core +-) +-if (NOT QT_FOUND) +- find_package(Qt4 QUIET COMPONENTS QtCore) +- if (Qt4_FOUND) +- set(QT_VERSION_MAJOR 4) +- else() +- # If neither 6, 5 nor 4 are found, we default to 5. +- # The setup will fail further down. +- set(QT_VERSION_MAJOR 5) +- endif() +-endif() +- +-set(QUAZIP_QT_MAJOR_VERSION ${QT_VERSION_MAJOR} CACHE STRING "Qt version to use (4, 5 or 6), defaults to ${QT_VERSION_MAJOR}") +- +-if (QUAZIP_QT_MAJOR_VERSION EQUAL 6) +- set(CMAKE_CXX_STANDARD 17) +-else() +- set(CMAKE_CXX_STANDARD 14) +-endif() ++set(CMAKE_CXX_STANDARD 17) + + if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE RELEASE) +@@ -77,92 +29,17 @@ set(QUAZIP_LIB_TARGET_NAME QuaZip) + set(QUAZIP_DIR_NAME QuaZip-Qt${QUAZIP_QT_MAJOR_VERSION}-${QUAZIP_LIB_VERSION}) + set(QUAZIP_PACKAGE_NAME QuaZip-Qt${QUAZIP_QT_MAJOR_VERSION}) + +-message(STATUS "QUAZIP_QT_MAJOR_VERSION set to ${QUAZIP_QT_MAJOR_VERSION}") +-message(STATUS "CMAKE_CXX_STANDARD set to ${CMAKE_CXX_STANDARD}") +- +-if(QUAZIP_QT_MAJOR_VERSION EQUAL 6) +- find_package(Qt6 REQUIRED COMPONENTS Core Core5Compat +- OPTIONAL_COMPONENTS Network Test) +- message(STATUS "Found Qt version ${Qt6_VERSION} at ${Qt6_DIR}") +- set(QUAZIP_QT_ZLIB_COMPONENT BundledZLIB) +- set(QUAZIP_QT_ZLIB_HEADER_COMPONENT ZlibPrivate) +- set(QUAZIP_LIB_LIBRARIES Qt6::Core Qt6::Core5Compat) +- set(QUAZIP_TEST_QT_LIBRARIES Qt6::Core Qt6::Core5Compat Qt6::Network Qt6::Test) +- set(QUAZIP_PKGCONFIG_REQUIRES "zlib, Qt6Core") +-elseif(QUAZIP_QT_MAJOR_VERSION EQUAL 5) +- find_package(Qt5 REQUIRED COMPONENTS Core +- OPTIONAL_COMPONENTS Network Test) +- message(STATUS "Found Qt version ${Qt5_VERSION} at ${Qt5_DIR}") +- set(QUAZIP_QT_ZLIB_COMPONENT Zlib) +- set(QUAZIP_LIB_LIBRARIES Qt5::Core) +- set(QUAZIP_TEST_QT_LIBRARIES Qt5::Core Qt5::Network Qt5::Test) +- set(QUAZIP_PKGCONFIG_REQUIRES "zlib, Qt5Core") +-elseif(QUAZIP_QT_MAJOR_VERSION EQUAL 4) +- find_package(Qt4 4.5.0 REQUIRED COMPONENTS QtCore +- OPTIONAL_COMPONENTS QtNetwork QtTest) +- set(QUAZIP_QT_ZLIB_COMPONENT Zlib) +- set(QUAZIP_LIB_LIBRARIES Qt4::QtCore) +- set(QUAZIP_TEST_QT_LIBRARIES Qt4::QtCore Qt4::QtNetwork Qt4::QtTest) +- set(QUAZIP_PKGCONFIG_REQUIRES "zlib, QtCore") +-else() +- message(FATAL_ERROR "Qt version ${QUAZIP_QT_MAJOR_VERSION} is not supported") +-endif() +- +-message(STATUS "Using Qt version ${QUAZIP_QT_MAJOR_VERSION}") +- +-set(QUAZIP_QT_ZLIB_USED OFF) +-if(QUAZIP_USE_QT_ZLIB) +- find_package(Qt${QUAZIP_QT_MAJOR_VERSION} OPTIONAL_COMPONENTS ${QUAZIP_QT_ZLIB_COMPONENT}) +- set(QUAZIP_QT_ZLIB_COMPONENT_FOUND Qt${QUAZIP_QT_MAJOR_VERSION}${QUAZIP_QT_ZLIB_COMPONENT}_FOUND) +- if (DEFINED QUAZIP_QT_ZLIB_HEADER_COMPONENT) +- find_package(Qt${QUAZIP_QT_MAJOR_VERSION} OPTIONAL_COMPONENTS ${QUAZIP_QT_ZLIB_HEADER_COMPONENT}) +- set(QUAZIP_QT_ZLIB_HEADER_COMPONENT_FOUND Qt${QUAZIP_QT_MAJOR_VERSION}${QUAZIP_QT_ZLIB_HEADER_COMPONENT}_FOUND) +- else() +- set(QUAZIP_QT_ZLIB_HEADER_COMPONENT_FOUND ON) +- endif() +- if(QUAZIP_QT_ZLIB_COMPONENT_FOUND AND QUAZIP_QT_ZLIB_HEADER_COMPONENT_FOUND) +- message(STATUS "Qt component ${QUAZIP_QT_ZLIB_COMPONENT} found") +- set(QUAZIP_LIB_LIBRARIES ${QUAZIP_LIB_LIBRARIES} Qt${QUAZIP_QT_MAJOR_VERSION}::${QUAZIP_QT_ZLIB_COMPONENT}) +- if(DEFINED QUAZIP_QT_ZLIB_HEADER_COMPONENT) +- message(STATUS "Qt component ${QUAZIP_QT_ZLIB_HEADER_COMPONENT} found") +- set(QUAZIP_LIB_LIBRARIES ${QUAZIP_LIB_LIBRARIES} Qt${QUAZIP_QT_MAJOR_VERSION}::${QUAZIP_QT_ZLIB_HEADER_COMPONENT}) +- endif() +- set(QUAZIP_QT_ZLIB_USED ON) +- else() +- message(FATAL_ERROR "QUAZIP_USE_QT_ZLIB was set but bundled zlib was not found. Terminating to prevent accidental linking to system libraries.") +- endif() +-endif() +- +-if(QUAZIP_QT_ZLIB_USED AND QUAZIP_QT_ZLIB_COMPONENT STREQUAL BundledZLIB) +- # Qt's new BundledZLIB uses z-prefix in zlib +- add_compile_definitions(Z_PREFIX) +-endif() +- +-if(NOT QUAZIP_QT_ZLIB_USED) +- +- if(EMSCRIPTEN) +- if(NOT DEFINED ZLIB_LIBRARY) +- message(WARNING "ZLIB_LIBRARY is not set") +- endif() ++find_package(Qt6 REQUIRED COMPONENTS Core Core5Compat ++ OPTIONAL_COMPONENTS Network Test) ++message(STATUS "Found Qt version ${Qt6_VERSION} at ${Qt6_DIR}") ++set(QUAZIP_QT_ZLIB_COMPONENT BundledZLIB) ++set(QUAZIP_QT_ZLIB_HEADER_COMPONENT ZlibPrivate) ++set(QUAZIP_LIB_LIBRARIES Qt6::Core Qt6::Core5Compat) ++set(QUAZIP_TEST_QT_LIBRARIES Qt6::Core Qt6::Core5Compat Qt6::Network Qt6::Test) ++set(QUAZIP_PKGCONFIG_REQUIRES "zlib, Qt6Core") + +- if(NOT DEFINED ZLIB_INCLUDE) +- message(WARNING "ZLIB_INCLUDE is not set") +- else() +- include_directories(${ZLIB_INCLUDE}) +- endif() +- +- if(NOT DEFINED ZCONF_INCLUDE) +- message(WARNING "ZCONF_INCLUDE is not set") +- else() +- include_directories(${ZCONF_INCLUDE}) +- endif() +- +- set(QUAZIP_LIB_LIBRARIES ${QUAZIP_LIB_LIBRARIES} ${ZLIB_LIBRARY}) +- else() +- find_package(ZLIB REQUIRED) +- set(QUAZIP_LIB_LIBRARIES ${QUAZIP_LIB_LIBRARIES} ZLIB::ZLIB) +- endif() +-endif() ++find_package(ZLIB REQUIRED) ++set(QUAZIP_LIB_LIBRARIES ${QUAZIP_LIB_LIBRARIES} ZLIB::ZLIB) + + if (ZLIB_CONST) + add_compile_definitions(ZLIB_CONST) +@@ -173,65 +50,4 @@ set(QUAZIP_INC) + set(QUAZIP_LIB) + set(QUAZIP_LBD) + +-if(QUAZIP_BZIP2) +- # Check if bzip2 is present +- set(QUAZIP_BZIP2 ON) +- +- if(NOT QUAZIP_FORCE_FETCH_LIBS) +- find_package(BZip2 QUIET) +- endif() +- +- if(BZIP2_FOUND AND NOT QUAZIP_FORCE_FETCH_LIBS) +- message(STATUS "Using BZIP2 ${BZIP2_VERSION_STRING}") +- +- list(APPEND QUAZIP_INC ${BZIP2_INCLUDE_DIRS}) +- list(APPEND QUAZIP_LIB ${BZIP2_LIBRARIES}) +- list(APPEND QUAZIP_LBD ${BZIP2_LIBRARY_DIRS}) +- +- set(PC_PRIVATE_LIBS "${PC_PRIVATE_LIBS} -lbzip2") +- elseif(QUAZIP_FETCH_LIBS) +- clone_repo(bzip2 https://sourceware.org/git/bzip2.git) +- +- # BZip2 repository does not support cmake so we have to create +- # the bzip2 library ourselves +- set(BZIP2_SRC +- ${BZIP2_SOURCE_DIR}/blocksort.c +- ${BZIP2_SOURCE_DIR}/bzlib.c +- ${BZIP2_SOURCE_DIR}/compress.c +- ${BZIP2_SOURCE_DIR}/crctable.c +- ${BZIP2_SOURCE_DIR}/decompress.c +- ${BZIP2_SOURCE_DIR}/huffman.c +- ${BZIP2_SOURCE_DIR}/randtable.c) +- +- set(BZIP2_HDR +- ${BZIP2_SOURCE_DIR}/bzlib.h +- ${BZIP2_SOURCE_DIR}/bzlib_private.h) +- +- add_library(bzip2 STATIC ${BZIP2_SRC} ${BZIP2_HDR}) +- +- if(NOT QUAZIP_BZIP2_STDIO) +- target_compile_definitions(bzip2 PRIVATE -DBZ_NO_STDIO) +- endif() +- +- list(APPEND QUAZIP_DEP bzip2) +- list(APPEND QUAZIP_LIB bzip2) +- list(APPEND QUAZIP_INC ${BZIP2_SOURCE_DIR}) +- else() +- message(STATUS "BZip2 library not found") +- +- set(QUAZIP_BZIP2 OFF) +- endif() +- +- if(QUAZIP_BZIP2) +- find_package(BZip2) +- add_compile_definitions(HAVE_BZIP2) +- endif() +-endif() +- + add_subdirectory(quazip) +- +-if(QUAZIP_ENABLE_TESTS) +- message(STATUS "Building QuaZip tests") +- enable_testing() +- add_subdirectory(qztest) +-endif() +diff --git a/quazip/CMakeLists.txt b/quazip/CMakeLists.txt +index 6cfdf4e..66bc4cb 100644 +--- a/quazip/CMakeLists.txt ++++ b/quazip/CMakeLists.txt +@@ -46,10 +46,6 @@ set(QUAZIP_INCLUDE_PATH ${QUAZIP_DIR_NAME}/quazip) + set(QUAZIP_INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake) + set(QUAZIP_PKGCONFIG_NAME quazip${QuaZip_VERSION_MAJOR}-qt${QUAZIP_QT_MAJOR_VERSION}) + +-if(EMSCRIPTEN) +- set(BUILD_SHARED_LIBS OFF) +-endif() +- + add_library(${QUAZIP_LIB_TARGET_NAME} ${QUAZIP_SOURCES}) + add_library(QuaZip::QuaZip ALIAS ${QUAZIP_LIB_TARGET_NAME}) + +diff --git a/quazip/quazip_qt_compat.h b/quazip/quazip_qt_compat.h +index 0dde011..41f9dd1 100644 +--- a/quazip/quazip_qt_compat.h ++++ b/quazip/quazip_qt_compat.h +@@ -14,16 +14,11 @@ + + // Legacy encodings are still everywhere, but the Qt team decided we + // don't need them anymore and moved them out of Core in Qt 6. +-#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +-# include +-#else +-# include +-#endif ++#include + + // QSaveFile terribly breaks the is-a idiom (Liskov substitution principle): + // QSaveFile is-a QIODevice, but it makes close() private and aborts + // if you call it through the base class. Hence this ugly hack: +-#if (QT_VERSION >= 0x050100) + #include + inline bool quazip_close(QIODevice *device) { + QSaveFile *file = qobject_cast(device); +@@ -34,74 +29,35 @@ inline bool quazip_close(QIODevice *device) { + device->close(); + return true; + } +-#else +-inline bool quazip_close(QIODevice *device) { +- device->close(); +- return true; +-} +-#endif + +-// this is yet another stupid move and deprecation +-#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + using Qt::SkipEmptyParts; +-#else +-#include +-const auto SkipEmptyParts = QString::SplitBehavior::SkipEmptyParts; +-#endif + + // and yet another... (why didn't they just make qSort delegate to std::sort?) + #include +-#if (QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)) + #include + template + inline void quazip_sort(T begin, T end, C comparator) { + std::sort(begin, end, comparator); + } +-#else +-#include +-template +-inline void quazip_sort(T begin, T end, C comparator) { +- qSort(begin, end, comparator); +-} +-#endif + + // this is a stupid rename... + #include + #include +-#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)) + inline QDateTime quazip_ctime(const QFileInfo &fi) { + return fi.birthTime(); + } +-#else +-inline QDateTime quazip_ctime(const QFileInfo &fi) { +- return fi.created(); +-} +-#endif + + // this is just a slightly better alternative + #include +-#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) + inline bool quazip_is_symlink(const QFileInfo &fi) { + return fi.isSymbolicLink(); + } +-#else +-inline bool quazip_is_symlink(const QFileInfo &fi) { +- // also detects *.lnk on Windows, but better than nothing +- return fi.isSymLink(); +-} +-#endif + + // I'm not even sure what this one is, but nevertheless + #include +-#if (QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)) + inline QString quazip_symlink_target(const QFileInfo &fi) { + return fi.symLinkTarget(); + } +-#else +-inline QString quazip_symlink_target(const QFileInfo &fi) { +- return fi.readLink(); // What's the difference? I've no idea. +-} +-#endif + + // deprecation + #if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0) +@@ -125,40 +81,19 @@ inline QDateTime quazip_since_epoch_ntfs() { + + // this is not a deprecation but an improvement, for a change + #include +-#if (QT_VERSION >= 0x040700) + inline quint64 quazip_ntfs_ticks(const QDateTime &time, int fineTicks) { + QDateTime base = quazip_since_epoch_ntfs(); + return base.msecsTo(time) * 10000 + fineTicks; + } +-#else +-inline quint64 quazip_ntfs_ticks(const QDateTime &time, int fineTicks) { +- QDateTime base = quazip_since_epoch_ntfs(); +- QDateTime utc = time.toUTC(); +- return (static_cast(base.date().daysTo(utc.date())) +- * Q_INT64_C(86400000) +- + static_cast(base.time().msecsTo(utc.time()))) +- * Q_INT64_C(10000) + fineTicks; +-} +-#endif + + // yet another improvement... + #include +-#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0) // Yay! Finally a way to get time as qint64! + inline qint64 quazip_to_time64_t(const QDateTime &time) { + return time.toSecsSinceEpoch(); + } +-#else +-inline qint64 quazip_to_time64_t(const QDateTime &time) { +- return static_cast(time.toTime_t()); // 32 bits only, but better than nothing +-} +-#endif + + #include +-// and another stupid move +-#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + const auto quazip_endl = Qt::endl; +-#else +-const auto quazip_endl = endl; +-#endif + + #endif // QUAZIP_QT_COMPAT_H ++ diff --git a/CMakeLists.txt b/CMakeLists.txt index f8e8516dbc..8bbd0ab4cc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -465,12 +465,12 @@ if (ENABLE_QT) list(APPEND CMAKE_PREFIX_PATH "${Qt6_DIR}") endif() + find_package(Qt6 REQUIRED COMPONENTS Widgets Concurrent Core5Compat) + # QT6 Multimedia pulls in unneeded audio systems (ALSA, Pulseaudio) for FreeBSD # ALSA is the default sound system on Linux, but FreeBSD uses OSS which works well enough - if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") - find_package(Qt6 REQUIRED COMPONENTS Widgets Concurrent) - else() - find_package(Qt6 REQUIRED COMPONENTS Widgets Multimedia Concurrent) + if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") + find_package(Qt6 REQUIRED COMPONENTS Multimedia) endif() if (UNIX AND NOT APPLE) diff --git a/src/yuzu/CMakeLists.txt b/src/yuzu/CMakeLists.txt index bab6a6c4f5..1390e1b4d5 100644 --- a/src/yuzu/CMakeLists.txt +++ b/src/yuzu/CMakeLists.txt @@ -496,6 +496,6 @@ endif() # Extra deps add_subdirectory(externals) -target_link_libraries(yuzu PRIVATE QuaZip::QuaZip) +target_link_libraries(yuzu PRIVATE QuaZip::QuaZip Qt6::Core5Compat) create_target_directory_groups(yuzu) diff --git a/src/yuzu/externals/CMakeLists.txt b/src/yuzu/externals/CMakeLists.txt index ac17308e09..bd63f4e23b 100644 --- a/src/yuzu/externals/CMakeLists.txt +++ b/src/yuzu/externals/CMakeLists.txt @@ -5,9 +5,6 @@ set(BUILD_TESTING OFF) set(BUILD_SHARED_LIBS OFF) # QuaZip -set(QUAZIP_QT_MAJOR_VERSION 6) -set(QUAZIP_BZIP2 OFF) - include(CPM) set(CPM_SOURCE_CACHE ${CMAKE_SOURCE_DIR}/.cache/cpm) set(CPM_USE_LOCAL_PACKAGES ON) @@ -18,14 +15,14 @@ CPMAddPackage( GIT_REPOSITORY "https://github.com/stachenov/quazip.git" GIT_TAG v1.5 PATCHES - ${CMAKE_SOURCE_DIR}/.ci/patch/0001-quazip-strict.patch - ${CMAKE_SOURCE_DIR}/.ci/patch/0002-quazip-fetchcontent.patch -) + ${CMAKE_SOURCE_DIR}/.patch/quazip/0001-strict.patch + ${CMAKE_SOURCE_DIR}/.patch/quazip/0002-oldstyle.patch + ${CMAKE_SOURCE_DIR}/.patch/quazip/0003-predecls.patch + ${CMAKE_SOURCE_DIR}/.patch/quazip/0004-qt6-only.patch -if (NOT MSVC AND NOT "QuaZip-Qt6" IN_LIST CPM_PACKAGES) - message(STATUS "QUAZIP DIR: ${CPM_PACKAGES}") - target_compile_options(QuaZip PRIVATE - -Wno-error=shadow - -Wno-error=missing-declarations - ) -endif() + # thanks to 0004-qt6-only.patch, this isn't needed, + # but we keep it since the patch is "technically" optional + OPTIONS + "QUAZIP_QT_MAJOR_VERSION 6" + "QUAZIP_BZIP2 OFF" +)