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
url = https://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
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
include(GetGitRevisionDescription)
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 ################################
# Find the required Qt parts
find_package(Qt5Core REQUIRED)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Concurrent REQUIRED)
find_package(Qt5Network REQUIRED)
find_package(Qt5Test REQUIRED)
find_package(Qt5Xml REQUIRED)
set(QT_VERSION_MAJOR ${Launcher_QT_VERSION_MAJOR})
find_package(Qt${QT_VERSION_MAJOR}Core REQUIRED)
find_package(Qt${QT_VERSION_MAJOR}Widgets REQUIRED)
find_package(Qt${QT_VERSION_MAJOR}Concurrent REQUIRED)
find_package(Qt${QT_VERSION_MAJOR}Network 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.
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/javacheck) # java compatibility checker
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/iconfix) # fork of Qt's QIcon loader
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})
target_link_libraries(Launcher_logic
systeminfo
Launcher_quazip
Launcher_classparser
${NBT_NAME}
${ZLIB_LIBRARIES}
@ -917,7 +916,7 @@ target_link_libraries(Launcher_logic
)
target_link_libraries(Launcher_logic
Launcher_iconfix
${QUAZIP_LIBRARIES}
QuaZip::QuaZip
hoedown
Launcher_rainbow
LocalPeer

View File

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

View File

@ -12,10 +12,15 @@
* See the License for the specific language governing permissions and
* 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/quazipdir.h>
#include <QuaZip-Qt5-1.2/quazip/quazipfile.h>
#endif
#include "MMCZip.h"
#include "FileSystem.h"

View File

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

View File

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

View File

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

View File

@ -26,9 +26,16 @@
#include <io/stream_reader.h>
#include <tag_string.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/quazipfile.h>
#include <QuaZip-Qt5-1.2/quazip/quazipdir.h>
#endif
#include <QCoreApplication>

View File

@ -17,8 +17,14 @@
#include <minecraft/MinecraftInstance.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/quazipdir.h>
#endif
#include "MMCZip.h"
#include "FileSystem.h"
#include <QDir>

View File

@ -4,8 +4,15 @@
#include <QJsonObject>
#include <QJsonArray>
#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/quazipfile.h>
#endif
#include <toml.h>
#include "settings/INIFile.h"

View File

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

View File

@ -1,8 +1,15 @@
#pragma once
#include "InstanceTask.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/quazipdir.h"
#endif
#include "meta/Index.h"
#include "meta/Version.h"
#include "meta/VersionList.h"

View File

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

View File

@ -19,9 +19,17 @@
#include <Json.h>
#include <minecraft/MinecraftInstance.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/quazipdir.h>
#include <QuaZip-Qt5-1.2/quazip/quazipfile.h>
#endif
#include <settings/INISettingsObject.h>
#include <memory>

View File

@ -38,4 +38,4 @@ add_definitions(-DCLASSPARSER_LIBRARY)
add_library(Launcher_classparser STATIC ${CLASSPARSER_SOURCES} ${CLASSPARSER_HEADERS})
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 <QFile>
#ifdef QUAZIP_USE_SUBMODULE
#include <quazip/quazipfile.h>
#else
#include <QuaZip-Qt5-1.2/quazip/quazipfile.h>
#endif
#include <QDebug>
namespace classparser

1
libraries/quazip Submodule

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