refactor: add in-tree QuaZip

This commit is contained in:
Sefa Eyeoglu 2022-01-24 22:55:57 +01:00
parent efa414c442
commit 3aa809b8c0
No known key found for this signature in database
GPG Key ID: C10411294912A422
18 changed files with 106 additions and 16 deletions

4
.gitmodules vendored
View File

@ -2,3 +2,7 @@
path = libraries/libnbtplusplus path = libraries/libnbtplusplus
url = https://github.com/MultiMC/libnbtplusplus.git url = https://github.com/MultiMC/libnbtplusplus.git
pushurl = git@github.com:MultiMC/libnbtplusplus.git pushurl = git@github.com:MultiMC/libnbtplusplus.git
[submodule "libraries/quazip"]
path = libraries/quazip
url = https://github.com/stachenov/quazip.git

View File

@ -80,6 +80,11 @@ set(Launcher_DISCORD_URL "https://discord.gg/Z52pwxWCHP" CACHE STRING "URL for t
# Subreddit URL # Subreddit URL
set(Launcher_SUBREDDIT_URL "" CACHE STRING "URL for the subreddit.") set(Launcher_SUBREDDIT_URL "" CACHE STRING "URL for the subreddit.")
# Builds
set(Launcher_FORCE_BUNDLED_LIBS OFF CACHE BOOL "Prevent using system libraries, if they are available as submodules")
set(Launcher_QT_VERSION_MAJOR "5" CACHE STRING "Major Qt version to build against")
#### Check the current Git commit and branch #### Check the current Git commit and branch
include(GetGitRevisionDescription) include(GetGitRevisionDescription)
get_git_head_revision(Launcher_GIT_REFSPEC Launcher_GIT_COMMIT) get_git_head_revision(Launcher_GIT_REFSPEC Launcher_GIT_COMMIT)
@ -96,14 +101,19 @@ add_custom_target(tcversion echo "\\#\\#teamcity[setParameter name=\\'env.LAUNCH
################################ 3rd Party Libs ################################ ################################ 3rd Party Libs ################################
# Find the required Qt parts # Find the required Qt parts
find_package(Qt5Core REQUIRED) set(QT_VERSION_MAJOR ${Launcher_QT_VERSION_MAJOR})
find_package(Qt5Widgets REQUIRED) find_package(Qt${QT_VERSION_MAJOR}Core REQUIRED)
find_package(Qt5Concurrent REQUIRED) find_package(Qt${QT_VERSION_MAJOR}Widgets REQUIRED)
find_package(Qt5Network REQUIRED) find_package(Qt${QT_VERSION_MAJOR}Concurrent REQUIRED)
find_package(Qt5Test REQUIRED) find_package(Qt${QT_VERSION_MAJOR}Network REQUIRED)
find_package(Qt5Xml REQUIRED) find_package(Qt${QT_VERSION_MAJOR}Test REQUIRED)
find_package(Qt${QT_VERSION_MAJOR}Xml REQUIRED)
find_package(QuaZip-Qt5 REQUIRED) if (NOT Launcher_FORCE_BUNDLED_LIBS)
find_package(QuaZip-Qt${QT_VERSION_MAJOR} REQUIRED)
else()
MESSAGE(STATUS "Not looking for QuaZip via find_package")
endif()
# The Qt5 cmake files don't provide its install paths, so ask qmake. # The Qt5 cmake files don't provide its install paths, so ask qmake.
include(QMakeQuery) include(QMakeQuery)
@ -251,6 +261,12 @@ add_subdirectory(libraries/hoedown) # markdown parser
add_subdirectory(libraries/launcher) # java based launcher part for Minecraft add_subdirectory(libraries/launcher) # java based launcher part for Minecraft
add_subdirectory(libraries/javacheck) # java compatibility checker add_subdirectory(libraries/javacheck) # java compatibility checker
add_subdirectory(libraries/xz-embedded) # xz compression add_subdirectory(libraries/xz-embedded) # xz compression
if (NOT QuaZip-Qt${QT_VERSION_MAJOR}_FOUND)
set(QUAZIP_QT_MAJOR_VERSION ${QT_VERSION_MAJOR})
add_compile_definitions(QUAZIP_USE_SUBMODULE)
MESSAGE(STATUS "Adding QuaZip submodule, with QT_VERSION_MAJOR ${QUAZIP_QT_MAJOR_VERSION}")
add_subdirectory(libraries/quazip) # zip manipulation library
endif()
add_subdirectory(libraries/rainbow) # Qt extension for colors add_subdirectory(libraries/rainbow) # Qt extension for colors
add_subdirectory(libraries/iconfix) # fork of Qt's QIcon loader add_subdirectory(libraries/iconfix) # fork of Qt's QIcon loader
add_subdirectory(libraries/LocalPeer) # fork of a library from Qt solutions add_subdirectory(libraries/LocalPeer) # fork of a library from Qt solutions

View File

@ -899,7 +899,6 @@ endif()
add_library(Launcher_logic STATIC ${LOGIC_SOURCES} ${LAUNCHER_SOURCES} ${LAUNCHER_UI} ${LAUNCHER_RESOURCES}) add_library(Launcher_logic STATIC ${LOGIC_SOURCES} ${LAUNCHER_SOURCES} ${LAUNCHER_UI} ${LAUNCHER_RESOURCES})
target_link_libraries(Launcher_logic target_link_libraries(Launcher_logic
systeminfo systeminfo
Launcher_quazip
Launcher_classparser Launcher_classparser
${NBT_NAME} ${NBT_NAME}
${ZLIB_LIBRARIES} ${ZLIB_LIBRARIES}
@ -917,7 +916,7 @@ target_link_libraries(Launcher_logic
) )
target_link_libraries(Launcher_logic target_link_libraries(Launcher_logic
Launcher_iconfix Launcher_iconfix
${QUAZIP_LIBRARIES} QuaZip::QuaZip
hoedown hoedown
Launcher_rainbow Launcher_rainbow
LocalPeer LocalPeer

View File

@ -29,7 +29,12 @@
#include "modplatform/flame/FileResolvingTask.h" #include "modplatform/flame/FileResolvingTask.h"
#include "modplatform/flame/PackManifest.h" #include "modplatform/flame/PackManifest.h"
#include "Json.h" #include "Json.h"
#ifdef QUAZIP_USE_SUBMODULE
#include <quazip/quazipdir.h>
#else
#include <QuaZip-Qt5-1.2/quazip/quazipdir.h> #include <QuaZip-Qt5-1.2/quazip/quazipdir.h>
#endif
#include "modplatform/technic/TechnicPackProcessor.h" #include "modplatform/technic/TechnicPackProcessor.h"
#include "icons/IconList.h" #include "icons/IconList.h"

View File

@ -12,10 +12,15 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#ifdef QUAZIP_USE_SUBMODULE
#include <quazip/quazip.h>
#include <quazip/quazipdir.h>
#include <quazip/quazipfile.h>
#else
#include <QuaZip-Qt5-1.2/quazip/quazip.h> #include <QuaZip-Qt5-1.2/quazip/quazip.h>
#include <QuaZip-Qt5-1.2/quazip/quazipdir.h> #include <QuaZip-Qt5-1.2/quazip/quazipdir.h>
#include <QuaZip-Qt5-1.2/quazip/quazipfile.h> #include <QuaZip-Qt5-1.2/quazip/quazipfile.h>
#endif
#include "MMCZip.h" #include "MMCZip.h"
#include "FileSystem.h" #include "FileSystem.h"

View File

@ -19,13 +19,14 @@
#include <QFileInfo> #include <QFileInfo>
#include <QSet> #include <QSet>
#include "minecraft/mod/Mod.h" #include "minecraft/mod/Mod.h"
#include "nonstd/optional"
#include <functional> #include <functional>
//#include <QuaZip-Qt5-1.2/quazip/JlCompress.h> #ifdef QUAZIP_USE_SUBMODULE
// TODO: Blocked by https://github.com/stachenov/quazip/pull/141 #include <quazip/JlCompress.h>
// For now, checkout https://github.com/Scrumplex/quazip/tree/expose-jlcompress-fns at ../../quazip #else
#include <../../quazip/quazip/JlCompress.h> #include <QuaZip-Qt5-1.2/quazip/JlCompress.h>
#include <nonstd/optional> #endif
namespace MMCZip namespace MMCZip
{ {

View File

@ -20,7 +20,12 @@
#include <QUrl> #include <QUrl>
#include "tasks/Task.h" #include "tasks/Task.h"
#ifdef QUAZIP_USE_SUBMODULE
#include <quazip/quazip.h>
#else
#include <QuaZip-Qt5-1.2/quazip/quazip.h> #include <QuaZip-Qt5-1.2/quazip/quazip.h>
#endif
#include "QObjectPtr.h" #include "QObjectPtr.h"

View File

@ -22,7 +22,12 @@
#include "net/NetJob.h" #include "net/NetJob.h"
#include "tasks/Task.h" #include "tasks/Task.h"
#include "minecraft/VersionFilterData.h" #include "minecraft/VersionFilterData.h"
#ifdef QUAZIP_USE_SUBMODULE
#include <quazip/quazip.h>
#else
#include <QuaZip-Qt5-1.2/quazip/quazip.h> #include <QuaZip-Qt5-1.2/quazip/quazip.h>
#endif
class MinecraftVersion; class MinecraftVersion;
class MinecraftInstance; class MinecraftInstance;

View File

@ -26,9 +26,16 @@
#include <io/stream_reader.h> #include <io/stream_reader.h>
#include <tag_string.h> #include <tag_string.h>
#include <tag_primitive.h> #include <tag_primitive.h>
#ifdef QUAZIP_USE_SUBMODULE
#include <quazip/quazip.h>
#include <quazip/quazipfile.h>
#include <quazip/quazipdir.h>
#else
#include <QuaZip-Qt5-1.2/quazip/quazip.h> #include <QuaZip-Qt5-1.2/quazip/quazip.h>
#include <QuaZip-Qt5-1.2/quazip/quazipfile.h> #include <QuaZip-Qt5-1.2/quazip/quazipfile.h>
#include <QuaZip-Qt5-1.2/quazip/quazipdir.h> #include <QuaZip-Qt5-1.2/quazip/quazipdir.h>
#endif
#include <QCoreApplication> #include <QCoreApplication>

View File

@ -17,8 +17,14 @@
#include <minecraft/MinecraftInstance.h> #include <minecraft/MinecraftInstance.h>
#include <launch/LaunchTask.h> #include <launch/LaunchTask.h>
#ifdef QUAZIP_USE_SUBMODULE
#include <quazip/quazip.h>
#include <quazip/quazipdir.h>
#else
#include <QuaZip-Qt5-1.2/quazip/quazip.h> #include <QuaZip-Qt5-1.2/quazip/quazip.h>
#include <QuaZip-Qt5-1.2/quazip/quazipdir.h> #include <QuaZip-Qt5-1.2/quazip/quazipdir.h>
#endif
#include "MMCZip.h" #include "MMCZip.h"
#include "FileSystem.h" #include "FileSystem.h"
#include <QDir> #include <QDir>

View File

@ -4,8 +4,15 @@
#include <QJsonObject> #include <QJsonObject>
#include <QJsonArray> #include <QJsonArray>
#include <QJsonValue> #include <QJsonValue>
#ifdef QUAZIP_USE_SUBMODULE
#include <quazip/quazip.h>
#include <quazip/quazipfile.h>
#else
#include <QuaZip-Qt5-1.2/quazip/quazip.h> #include <QuaZip-Qt5-1.2/quazip/quazip.h>
#include <QuaZip-Qt5-1.2/quazip/quazipfile.h> #include <QuaZip-Qt5-1.2/quazip/quazipfile.h>
#endif
#include <toml.h> #include <toml.h>
#include "settings/INIFile.h" #include "settings/INIFile.h"

View File

@ -19,7 +19,11 @@
#include <QtConcurrent/QtConcurrent> #include <QtConcurrent/QtConcurrent>
#ifdef QUAZIP_USE_SUBMODULE
#include <quazip/quazip.h>
#else
#include <QuaZip-Qt5-1.2/quazip/quazip.h> #include <QuaZip-Qt5-1.2/quazip/quazip.h>
#endif
#include "MMCZip.h" #include "MMCZip.h"
#include "minecraft/OneSixVersionFormat.h" #include "minecraft/OneSixVersionFormat.h"

View File

@ -1,8 +1,15 @@
#pragma once #pragma once
#include "InstanceTask.h" #include "InstanceTask.h"
#include "net/NetJob.h" #include "net/NetJob.h"
#ifdef QUAZIP_USE_SUBMODULE
#include <quazip/quazip.h>
#include <quazip/quazipdir.h>
#else
#include "QuaZip-Qt5-1.2/quazip/quazip.h" #include "QuaZip-Qt5-1.2/quazip/quazip.h"
#include "QuaZip-Qt5-1.2/quazip/quazipdir.h" #include "QuaZip-Qt5-1.2/quazip/quazipdir.h"
#endif
#include "meta/Index.h" #include "meta/Index.h"
#include "meta/Version.h" #include "meta/Version.h"
#include "meta/VersionList.h" #include "meta/VersionList.h"

View File

@ -18,7 +18,11 @@
#include "InstanceTask.h" #include "InstanceTask.h"
#include "net/NetJob.h" #include "net/NetJob.h"
#ifdef QUAZIP_USE_SUBMODULE
#include <quazip/quazip.h>
#else
#include "QuaZip-Qt5-1.2/quazip/quazip.h" #include "QuaZip-Qt5-1.2/quazip/quazip.h"
#endif
#include <QFutureWatcher> #include <QFutureWatcher>
#include <QStringList> #include <QStringList>

View File

@ -19,9 +19,17 @@
#include <Json.h> #include <Json.h>
#include <minecraft/MinecraftInstance.h> #include <minecraft/MinecraftInstance.h>
#include <minecraft/PackProfile.h> #include <minecraft/PackProfile.h>
#ifdef QUAZIP_USE_SUBMODULE
#include <quazip/quazip.h>
#include <quazip/quazipdir.h>
#include <quazip/quazipfile.h>
#else
#include <QuaZip-Qt5-1.2/quazip/quazip.h> #include <QuaZip-Qt5-1.2/quazip/quazip.h>
#include <QuaZip-Qt5-1.2/quazip/quazipdir.h> #include <QuaZip-Qt5-1.2/quazip/quazipdir.h>
#include <QuaZip-Qt5-1.2/quazip/quazipfile.h> #include <QuaZip-Qt5-1.2/quazip/quazipfile.h>
#endif
#include <settings/INISettingsObject.h> #include <settings/INISettingsObject.h>
#include <memory> #include <memory>

View File

@ -38,4 +38,4 @@ add_definitions(-DCLASSPARSER_LIBRARY)
add_library(Launcher_classparser STATIC ${CLASSPARSER_SOURCES} ${CLASSPARSER_HEADERS}) add_library(Launcher_classparser STATIC ${CLASSPARSER_SOURCES} ${CLASSPARSER_HEADERS})
target_include_directories(Launcher_classparser PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") target_include_directories(Launcher_classparser PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
target_link_libraries(Launcher_classparser Launcher_quazip Qt5::Core) target_link_libraries(Launcher_classparser QuaZip::QuaZip Qt5::Core)

View File

@ -18,7 +18,13 @@
#include "classparser.h" #include "classparser.h"
#include <QFile> #include <QFile>
#ifdef QUAZIP_USE_SUBMODULE
#include <quazip/quazipfile.h>
#else
#include <QuaZip-Qt5-1.2/quazip/quazipfile.h> #include <QuaZip-Qt5-1.2/quazip/quazipfile.h>
#endif
#include <QDebug> #include <QDebug>
namespace classparser namespace classparser

1
libraries/quazip Submodule

@ -0,0 +1 @@
Subproject commit 09ec1d10c6d627f895109b21728dda000cbfa7d1