mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2025-07-20 12:55:45 +00:00
[cmake] Fix QuaZip once and for all (#71)
(and core5compat) Signed-off-by: crueter <crueter@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/71
This commit is contained in:
parent
a538126eb7
commit
108daeeb39
10 changed files with 482 additions and 38 deletions
|
@ -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})
|
26
.patch/quazip/0002-oldstyle.patch
Normal file
26
.patch/quazip/0002-oldstyle.patch
Normal file
|
@ -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 */
|
19
.patch/quazip/0003-predecls.patch
Normal file
19
.patch/quazip/0003-predecls.patch
Normal file
|
@ -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;
|
400
.patch/quazip/0004-qt6-only.patch
Normal file
400
.patch/quazip/0004-qt6-only.patch
Normal file
|
@ -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 <QtCore5Compat/QTextCodec>
|
||||
-#else
|
||||
-# include <QtCore/QTextCodec>
|
||||
-#endif
|
||||
+#include <QtCore5Compat/QTextCodec>
|
||||
|
||||
// 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 <QtCore/QSaveFile>
|
||||
inline bool quazip_close(QIODevice *device) {
|
||||
QSaveFile *file = qobject_cast<QSaveFile*>(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 <QtCore/QString>
|
||||
-const auto SkipEmptyParts = QString::SplitBehavior::SkipEmptyParts;
|
||||
-#endif
|
||||
|
||||
// and yet another... (why didn't they just make qSort delegate to std::sort?)
|
||||
#include <QtCore/QList>
|
||||
-#if (QT_VERSION >= QT_VERSION_CHECK(5, 2, 0))
|
||||
#include <algorithm>
|
||||
template<typename T, typename C>
|
||||
inline void quazip_sort(T begin, T end, C comparator) {
|
||||
std::sort(begin, end, comparator);
|
||||
}
|
||||
-#else
|
||||
-#include <QtCore/QtAlgorithms>
|
||||
-template<typename T, typename C>
|
||||
-inline void quazip_sort(T begin, T end, C comparator) {
|
||||
- qSort(begin, end, comparator);
|
||||
-}
|
||||
-#endif
|
||||
|
||||
// this is a stupid rename...
|
||||
#include <QtCore/QDateTime>
|
||||
#include <QtCore/QFileInfo>
|
||||
-#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 <QtCore/QFileInfo>
|
||||
-#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 <QtCore/QFileInfo>
|
||||
-#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 <QtCore/QDateTime>
|
||||
-#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<qint64>(base.date().daysTo(utc.date()))
|
||||
- * Q_INT64_C(86400000)
|
||||
- + static_cast<qint64>(base.time().msecsTo(utc.time())))
|
||||
- * Q_INT64_C(10000) + fineTicks;
|
||||
-}
|
||||
-#endif
|
||||
|
||||
// yet another improvement...
|
||||
#include <QtCore/QDateTime>
|
||||
-#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<qint64>(time.toTime_t()); // 32 bits only, but better than nothing
|
||||
-}
|
||||
-#endif
|
||||
|
||||
#include <QtCore/QTextStream>
|
||||
-// 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
|
||||
+
|
|
@ -79,6 +79,8 @@ option(YUZU_USE_QT_MULTIMEDIA "Use QtMultimedia for Camera" OFF)
|
|||
|
||||
option(YUZU_USE_QT_WEB_ENGINE "Use QtWebEngine for web applet implementation" OFF)
|
||||
|
||||
set(YUZU_QT_MIRROR "" CACHE STRING "What mirror to use for downloading the bundled Qt libraries")
|
||||
|
||||
option(ENABLE_CUBEB "Enables the cubeb audio backend" ON)
|
||||
|
||||
option(USE_DISCORD_PRESENCE "Enables Discord Rich Presence" OFF)
|
||||
|
@ -465,12 +467,10 @@ if (ENABLE_QT)
|
|||
list(APPEND CMAKE_PREFIX_PATH "${Qt6_DIR}")
|
||||
endif()
|
||||
|
||||
# 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)
|
||||
find_package(Qt6 REQUIRED COMPONENTS Widgets Concurrent Core5Compat)
|
||||
|
||||
if (YUZU_USE_QT_MULTIMEDIA)
|
||||
find_package(Qt6 REQUIRED COMPONENTS Multimedia)
|
||||
endif()
|
||||
|
||||
if (UNIX AND NOT APPLE)
|
||||
|
|
|
@ -20,6 +20,7 @@ function(copy_yuzu_Qt6_deps target_dir)
|
|||
if (MSVC)
|
||||
windows_copy_files(${target_dir} ${Qt6_DLL_DIR} ${DLL_DEST}
|
||||
Qt6Core$<$<CONFIG:Debug>:d>.*
|
||||
Qt6Core5Compat$<$<CONFIG:Debug>:d>.*
|
||||
Qt6Gui$<$<CONFIG:Debug>:d>.*
|
||||
Qt6Widgets$<$<CONFIG:Debug>:d>.*
|
||||
Qt6Network$<$<CONFIG:Debug>:d>.*
|
||||
|
|
|
@ -94,7 +94,7 @@ function(determine_qt_parameters target host_out type_out arch_out arch_path_out
|
|||
else()
|
||||
set(host "linux")
|
||||
set(type "desktop")
|
||||
set(arch "gcc_64")
|
||||
set(arch "linux_gcc_64")
|
||||
set(arch_path "linux")
|
||||
endif()
|
||||
|
||||
|
@ -133,12 +133,26 @@ function(download_qt_configuration prefix_out target host type arch arch_path ba
|
|||
set(install_args ${install_args} install-tool --outputdir ${base_path} ${host} desktop ${target})
|
||||
else()
|
||||
set(prefix "${base_path}/${target}/${arch_path}")
|
||||
set(install_args ${install_args} install-qt --outputdir ${base_path} ${host} ${type} ${target} ${arch} -m qt3d qt5compat qtactiveqt qtcharts qtconnectivity qtdatavis3d qtgraphs qtgrpc qthttpserver qtimageformats qtlanguageserver qtlocation qtlottie qtmultimedia qtnetworkauth qtpdf qtpositioning qtquick3d qtquick3dphysics qtquickeffectmaker qtquicktimeline qtremoteobjects qtscxml qtsensors qtserialbus qtserialport qtshadertools qtspeech qtvirtualkeyboard qtwebchannel qtwebengine qtwebsockets qtwebview)
|
||||
set(install_args ${install_args} install-qt --outputdir ${base_path} ${host} ${type} ${target} ${arch} -m qt5compat)
|
||||
|
||||
if (YUZU_USE_QT_MULTIMEDIA)
|
||||
set(install_args ${install_args} qtmultimedia)
|
||||
endif()
|
||||
|
||||
if (YUZU_USE_QT_WEB_ENGINE)
|
||||
set(install_args ${install_args} qtpositioning qtwebchannel qtwebengine)
|
||||
endif()
|
||||
|
||||
if (NOT ${YUZU_QT_MIRROR} STREQUAL "")
|
||||
message(STATUS "Using Qt mirror ${YUZU_QT_MIRROR}")
|
||||
set(install_args ${install_args} -b ${YUZU_QT_MIRROR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
message(STATUS "Install Args ${install_args}")
|
||||
if (NOT EXISTS "${prefix}")
|
||||
message(STATUS "Downloading Qt binaries for ${target}:${host}:${type}:${arch}:${arch_path}")
|
||||
set(AQT_PREBUILD_BASE_URL "https://github.com/miurahr/aqtinstall/releases/download/v3.2.1")
|
||||
set(AQT_PREBUILD_BASE_URL "https://github.com/miurahr/aqtinstall/releases/download/v3.3.0")
|
||||
if (WIN32)
|
||||
set(aqt_path "${base_path}/aqt.exe")
|
||||
if (NOT EXISTS "${aqt_path}")
|
||||
|
|
|
@ -462,8 +462,8 @@ if (WIN32 AND NOT YUZU_USE_BUNDLED_QT AND QT_VERSION VERSION_GREATER_EQUAL 6)
|
|||
endif()
|
||||
|
||||
if (YUZU_USE_BUNDLED_QT)
|
||||
include(CopyYuzuQt6Deps)
|
||||
copy_yuzu_Qt6_deps(yuzu)
|
||||
include(CopyYuzuQt6Deps)
|
||||
copy_yuzu_Qt6_deps(yuzu)
|
||||
endif()
|
||||
|
||||
if (ENABLE_SDL2)
|
||||
|
@ -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)
|
||||
|
|
23
src/yuzu/externals/CMakeLists.txt
vendored
23
src/yuzu/externals/CMakeLists.txt
vendored
|
@ -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"
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue