aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/build.yml125
-rw-r--r--.github/workflows/trigger_release.yml20
-rw-r--r--.gitmodules6
-rw-r--r--CMakeLists.txt96
-rw-r--r--launcher/CMakeLists.txt140
-rw-r--r--launcher/modplatform/ModAPI.h2
-rw-r--r--launcher/modplatform/modrinth/ModrinthPackManifest.cpp2
-rw-r--r--launcher/net/HttpMetaCache.cpp2
m---------libraries/extra-cmake-modules0
-rw-r--r--libraries/hoedown/src/autolink.c6
m---------libraries/zlib0
-rw-r--r--tests/GZip_test.cpp2
12 files changed, 280 insertions, 121 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index ba8f9d38..3cf99760 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -25,8 +25,10 @@ jobs:
- os: ubuntu-20.04
qt_ver: 6
qt_host: linux
+ qt_arch: ''
qt_version: '6.2.4'
qt_modules: 'qt5compat qtimageformats'
+ qt_tools: ''
- os: windows-2022
name: "Windows-Legacy"
@@ -38,13 +40,39 @@ jobs:
msystem: clang64
qt_ver: 6
+ - os: windows-2022
+ name: "Windows-Legacy-MSVC"
+ msystem: ''
+ architecture: 'win32'
+ vcvars_arch: 'amd64_x86'
+ qt_ver: 5
+ qt_host: windows
+ qt_arch: 'win32_msvc2019'
+ qt_version: '5.15.2'
+ qt_modules: ''
+ qt_tools: 'tools_openssl_x86'
+
+ - os: windows-2022
+ name: "Windows-MSVC"
+ msystem: ''
+ architecture: 'x64'
+ vcvars_arch: 'amd64'
+ qt_ver: 6
+ qt_host: windows
+ qt_arch: ''
+ qt_version: '6.4.0'
+ qt_modules: 'qt5compat qtimageformats'
+ qt_tools: ''
+
- os: macos-12
name: macOS
macosx_deployment_target: 10.15
qt_ver: 6
qt_host: mac
+ qt_arch: ''
qt_version: '6.3.0'
qt_modules: 'qt5compat qtimageformats'
+ qt_tools: ''
- os: macos-12
name: macOS-Legacy
@@ -53,6 +81,7 @@ jobs:
qt_host: mac
qt_version: '5.15.2'
qt_modules: ''
+ qt_tools: ''
runs-on: ${{ matrix.os }}
@@ -82,7 +111,7 @@ jobs:
languages: cpp, java
- name: 'Setup MSYS2'
- if: runner.os == 'Windows'
+ if: runner.os == 'Windows' && matrix.msystem != ''
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.msystem }}
@@ -102,14 +131,19 @@ jobs:
ccache:p
${{ matrix.qt_ver == 6 && 'qt6-5compat:p' || '' }}
+ - name: Force newer ccache
+ if: runner.os == 'Windows' && matrix.msystem == '' && inputs.build_type == 'Debug'
+ run: |
+ choco install ccache --version 4.7.1
+
- name: Setup ccache
- if: runner.os != 'Windows' && inputs.build_type == 'Debug'
+ if: (runner.os != 'Windows' || matrix.msystem == '') && inputs.build_type == 'Debug'
uses: hendrikmuhs/ccache-action@v1.2.5
with:
key: ${{ matrix.os }}-qt${{ matrix.qt_ver }}
- - name: Setup ccache (Windows)
- if: runner.os == 'Windows' && inputs.build_type == 'Debug'
+ - name: Setup ccache (Windows MinGW-w64)
+ if: runner.os == 'Windows' && matrix.msystem != '' && inputs.build_type == 'Debug'
shell: msys2 {0}
run: |
ccache --set-config=cache_dir='${{ github.workspace }}\.ccache'
@@ -124,8 +158,8 @@ jobs:
run: |
echo "CCACHE_VAR=ccache" >> $GITHUB_ENV
- - name: Retrieve ccache cache (Windows)
- if: runner.os == 'Windows' && inputs.build_type == 'Debug'
+ - name: Retrieve ccache cache (Windows MinGW-w64)
+ if: runner.os == 'Windows' && matrix.msystem != '' && inputs.build_type == 'Debug'
uses: actions/cache@v3.0.11
with:
path: '${{ github.workspace }}\.ccache'
@@ -156,14 +190,16 @@ jobs:
run: |
sudo apt-get -y install qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools libqt5core5a libqt5network5 libqt5gui5
- - name: Install Qt (macOS and AppImage)
- if: runner.os == 'Linux' && matrix.qt_ver == 6 || runner.os == 'macOS'
+ - name: Install Qt (macOS, AppImage & Windows MSVC)
+ if: runner.os == 'Linux' && matrix.qt_ver == 6 || runner.os == 'macOS' || (runner.os == 'Windows' && matrix.msystem == '')
uses: jurplel/install-qt-action@v3
with:
version: ${{ matrix.qt_version }}
host: ${{ matrix.qt_host }}
target: 'desktop'
+ arch: ${{ matrix.qt_arch }}
modules: ${{ matrix.qt_modules }}
+ tools: ${{ matrix.qt_tools }}
cache: true
cache-key-prefix: ${{ matrix.qt_host }}-${{ matrix.qt_version }}-"${{ matrix.qt_modules }}"-qt_cache
@@ -190,12 +226,27 @@ jobs:
run: |
cmake -S . -B ${{ env.BUILD_DIR }} -DCMAKE_INSTALL_PREFIX=${{ env.INSTALL_DIR }} -DCMAKE_BUILD_TYPE=${{ inputs.build_type }} -DENABLE_LTO=ON -DLauncher_BUILD_PLATFORM=${{ matrix.name }} -DCMAKE_C_COMPILER_LAUNCHER=${{ env.CCACHE_VAR }} -DCMAKE_CXX_COMPILER_LAUNCHER=${{ env.CCACHE_VAR }} -DLauncher_QT_VERSION_MAJOR=${{ matrix.qt_ver }} -DMACOSX_SPARKLE_UPDATE_PUBLIC_KEY="" -DMACOSX_SPARKLE_UPDATE_FEED_URL="" -G Ninja
- - name: Configure CMake (Windows)
- if: runner.os == 'Windows'
+ - name: Configure CMake (Windows MinGW-w64)
+ if: runner.os == 'Windows' && matrix.msystem != ''
shell: msys2 {0}
run: |
cmake -S . -B ${{ env.BUILD_DIR }} -DCMAKE_INSTALL_PREFIX=${{ env.INSTALL_DIR }} -DCMAKE_BUILD_TYPE=${{ inputs.build_type }} -DENABLE_LTO=ON -DLauncher_BUILD_PLATFORM=${{ matrix.name }} -DCMAKE_C_COMPILER_LAUNCHER=${{ env.CCACHE_VAR }} -DCMAKE_CXX_COMPILER_LAUNCHER=${{ env.CCACHE_VAR }} -DLauncher_QT_VERSION_MAJOR=${{ matrix.qt_ver }} -DCMAKE_OBJDUMP=/mingw64/bin/objdump.exe -G Ninja
+ - name: Configure CMake (Windows MSVC)
+ if: runner.os == 'Windows' && matrix.msystem == ''
+ run: |
+ cmake -S . -B ${{ env.BUILD_DIR }} -DCMAKE_INSTALL_PREFIX=${{ env.INSTALL_DIR }} -DCMAKE_BUILD_TYPE=${{ inputs.build_type }} -DENABLE_LTO=ON -DLauncher_BUILD_PLATFORM=${{ matrix.name }} -DLauncher_QT_VERSION_MAJOR=${{ matrix.qt_ver }} -DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreadedDLL" -A${{ matrix.architecture}}
+ # https://github.com/ccache/ccache/wiki/MS-Visual-Studio (I coudn't figure out the compiler prefix)
+ if ("${{ env.CCACHE_VAR }}")
+ {
+ Copy-Item C:/ProgramData/chocolatey/lib/ccache/tools/ccache-4.7.1-windows-x86_64/ccache.exe -Destination C:/ProgramData/chocolatey/lib/ccache/tools/ccache-4.7.1-windows-x86_64/cl.exe
+ echo "CLToolExe=cl.exe" >> $env:GITHUB_ENV
+ echo "CLToolPath=C:/ProgramData/chocolatey/lib/ccache/tools/ccache-4.7.1-windows-x86_64/" >> $env:GITHUB_ENV
+ echo "TrackFileAccess=false" >> $env:GITHUB_ENV
+ }
+ # Needed for ccache, but also speeds up compile
+ echo "UseMultiToolTask=true" >> $env:GITHUB_ENV
+
- name: Configure CMake (Linux)
if: runner.os == 'Linux'
run: |
@@ -210,12 +261,17 @@ jobs:
run: |
cmake --build ${{ env.BUILD_DIR }}
- - name: Build (Windows)
- if: runner.os == 'Windows'
+ - name: Build (Windows MinGW-w64)
+ if: runner.os == 'Windows' && matrix.msystem != ''
shell: msys2 {0}
run: |
cmake --build ${{ env.BUILD_DIR }}
+ - name: Build (Windows MSVC)
+ if: runner.os == 'Windows' && matrix.msystem == ''
+ run: |
+ cmake --build ${{ env.BUILD_DIR }} --config ${{ inputs.build_type }}
+
##
# TEST
##
@@ -223,13 +279,18 @@ jobs:
- name: Test
if: runner.os != 'Windows'
run: |
- ctest --test-dir build --output-on-failure
+ ctest -E "^example64|example$" --test-dir build --output-on-failure
- - name: Test (Windows)
- if: runner.os == 'Windows'
+ - name: Test (Windows MinGW-w64)
+ if: runner.os == 'Windows' && matrix.msystem != ''
shell: msys2 {0}
run: |
- ctest --test-dir build --output-on-failure
+ ctest -E "^example64|example$" --test-dir build --output-on-failure
+
+ - name: Test (Windows MSVC)
+ if: runner.os == 'Windows' && matrix.msystem == ''
+ run: |
+ ctest -E "^example64|example$" --test-dir build --output-on-failure -C ${{ inputs.build_type }}
##
# CODE SCAN
@@ -273,8 +334,14 @@ jobs:
EOF
fi
- - name: Package (Windows)
- if: runner.os == 'Windows'
+ - name: Add VC Enviroment Variables
+ if: runner.os == 'Windows' && matrix.msystem == ''
+ uses: ilammy/msvc-dev-cmd@v1
+ with:
+ arch: ${{ matrix.vcvars_arch }}
+
+ - name: Package (Windows MinGW-w64)
+ if: runner.os == 'Windows' && matrix.msystem != ''
shell: msys2 {0}
run: |
cmake --install ${{ env.BUILD_DIR }}
@@ -284,13 +351,31 @@ jobs:
cp /clang32/bin/libcrypto-1_1.dll /clang32/bin/libssl-1_1.dll ./
fi
- - name: Package (Windows, portable)
- if: runner.os == 'Windows'
+ - name: Package (Windows MSVC)
+ if: runner.os == 'Windows' && matrix.msystem == ''
+ run: |
+ cmake --install ${{ env.BUILD_DIR }} --config ${{ inputs.build_type }}
+
+ cd ${{ env.INSTALL_DIR }}
+ if ("${{ matrix.qt_ver }}" -eq "5")
+ {
+ Copy-Item D:/a/PrismLauncher/Qt/Tools/OpenSSL/Win_x86/bin/libcrypto-1_1.dll -Destination libcrypto-1_1.dll
+ Copy-Item D:/a/PrismLauncher/Qt/Tools/OpenSSL/Win_x86/bin/libssl-1_1.dll -Destination libssl-1_1.dll
+ }
+
+ - name: Package (Windows MinGW-w64, portable)
+ if: runner.os == 'Windows' && matrix.msystem != ''
shell: msys2 {0}
run: |
cp -r ${{ env.INSTALL_DIR }} ${{ env.INSTALL_PORTABLE_DIR }} # cmake install on Windows is slow, let's just copy instead
cmake --install ${{ env.BUILD_DIR }} --prefix ${{ env.INSTALL_PORTABLE_DIR }} --component portable
+ - name: Package (Windows MSVC, portable)
+ if: runner.os == 'Windows' && matrix.msystem == ''
+ run: |
+ cp -r ${{ env.INSTALL_DIR }} ${{ env.INSTALL_PORTABLE_DIR }} # cmake install on Windows is slow, let's just copy instead
+ cmake --install ${{ env.BUILD_DIR }} --prefix ${{ env.INSTALL_PORTABLE_DIR }} --component portable
+
- name: Package (Windows, installer)
if: runner.os == 'Windows'
run: |
diff --git a/.github/workflows/trigger_release.yml b/.github/workflows/trigger_release.yml
index e74e870a..d415b2b1 100644
--- a/.github/workflows/trigger_release.yml
+++ b/.github/workflows/trigger_release.yml
@@ -47,10 +47,12 @@ jobs:
for d in PrismLauncher-Windows-*; do
cd "${d}" || continue
+ MSVC="$(echo -n ${d} | grep -o MSVC || true)"
LEGACY="$(echo -n ${d} | grep -o Legacy || true)"
INST="$(echo -n ${d} | grep -o Setup || true)"
PORT="$(echo -n ${d} | grep -o Portable || true)"
NAME="PrismLauncher-Windows"
+ test -z "${MSVC}" && NAME="${NAME}-MinGW" || NAME="${NAME}-MSVC"
test -z "${LEGACY}" || NAME="${NAME}-Legacy"
test -z "${PORT}" || NAME="${NAME}-Portable"
test -z "${INST}" || mv PrismLauncher-*.exe ../${NAME}-Setup-${{ env.VERSION }}.exe
@@ -72,14 +74,20 @@ jobs:
PrismLauncher-Linux-${{ env.VERSION }}.tar.gz
PrismLauncher-Linux-Portable-${{ env.VERSION }}.tar.gz
PrismLauncher-Linux-${{ env.VERSION }}-x86_64.AppImage
- PrismLauncher-Windows-Legacy-${{ env.VERSION }}.zip
PrismLauncher-Linux-Qt6-${{ env.VERSION }}.tar.gz
PrismLauncher-Linux-Qt6-Portable-${{ env.VERSION }}.tar.gz
- PrismLauncher-Windows-Legacy-Portable-${{ env.VERSION }}.zip
- PrismLauncher-Windows-Legacy-Setup-${{ env.VERSION }}.exe
- PrismLauncher-Windows-${{ env.VERSION }}.zip
- PrismLauncher-Windows-Portable-${{ env.VERSION }}.zip
- PrismLauncher-Windows-Setup-${{ env.VERSION }}.exe
+ PrismLauncher-Windows-MinGW-Legacy-${{ env.VERSION }}.zip
+ PrismLauncher-Windows-MinGW-Legacy-Portable-${{ env.VERSION }}.zip
+ PrismLauncher-Windows-MinGW-Legacy-Setup-${{ env.VERSION }}.exe
+ PrismLauncher-Windows-MinGW-${{ env.VERSION }}.zip
+ PrismLauncher-Windows-MinGW-Portable-${{ env.VERSION }}.zip
+ PrismLauncher-Windows-MinGW-Setup-${{ env.VERSION }}.exe
+ PrismLauncher-Windows-MSVC-Legacy-${{ env.VERSION }}.zip
+ PrismLauncher-Windows-MSVC-Legacy-Portable-${{ env.VERSION }}.zip
+ PrismLauncher-Windows-MSVC-Legacy-Setup-${{ env.VERSION }}.exe
+ PrismLauncher-Windows-MSVC-${{ env.VERSION }}.zip
+ PrismLauncher-Windows-MSVC-Portable-${{ env.VERSION }}.zip
+ PrismLauncher-Windows-MSVC-Setup-${{ env.VERSION }}.exe
PrismLauncher-macOS-${{ env.VERSION }}.tar.gz
PrismLauncher-macOS-Legacy-${{ env.VERSION }}.tar.gz
PrismLauncher-${{ env.VERSION }}.tar.gz
diff --git a/.gitmodules b/.gitmodules
index 8d034354..95274f15 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -10,3 +10,9 @@
[submodule "libraries/libnbtplusplus"]
path = libraries/libnbtplusplus
url = https://github.com/PrismLauncher/libnbtplusplus.git
+[submodule "libraries/zlib"]
+ path = libraries/zlib
+ url = https://github.com/madler/zlib.git
+[submodule "libraries/extra-cmake-modules"]
+ path = libraries/extra-cmake-modules
+ url = https://github.com/KDE/extra-cmake-modules
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ed83c205..00eb1925 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,10 +1,5 @@
cmake_minimum_required(VERSION 3.15) # minimum version required by QuaZip
-if(WIN32)
- # In Qt 5.1+ we have our own main() function, don't autolink to qtmain on Windows
- cmake_policy(SET CMP0020 OLD)
-endif()
-
project(Launcher)
string(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BUILD_DIR}" IS_IN_SOURCE_BUILD)
@@ -32,11 +27,42 @@ set(CMAKE_C_STANDARD_REQUIRED true)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_C_STANDARD 11)
include(GenerateExportHeader)
-set(CMAKE_CXX_FLAGS "-Wall -pedantic -fstack-protector-strong --param=ssp-buffer-size=4 ${CMAKE_CXX_FLAGS}")
+if(MSVC)
+ # Use /W4 as /Wall includes unnesserey warnings such as added padding to structs
+ # /permissive- specify standards-conforming compiler behavior, also enabled by Qt6, default on with std:c++20
+ # /GS Adds buffer security checks, default on but incuded anyway to mirror gcc's fstack-protector flag
+ set(CMAKE_CXX_FLAGS "/W4 /permissive- /GS ${CMAKE_CXX_FLAGS}")
+
+ # LINK accepts /SUBSYSTEM whics sets if we are a WINDOWS (gui) or a CONSOLE programs
+ # This implicitly selects an entrypoint specific to the subsystem selected
+ # qtmain/QtEntryPointLib provides the correct entrypoint (wWinMain) for gui programs
+ # Additinaly LINK autodetects we use a GUI so we can omit /SUBSYSTEM
+ # This allows tests to still use have console without using seperate linker flags
+ # /MANIFEST:NO disables generating a manifest file, we instead provide our own
+ # /STACK sets the stack reserve size, ATL's pack list needs 3-4 MiB as of November 2022, provide 8 MiB
+ set(CMAKE_EXE_LINKER_FLAGS "/MANIFEST:NO /STACK:8388608 ${CMAKE_EXE_LINKER_FLAGS}")
+
+ # See https://github.com/ccache/ccache/issues/1040
+ # Note, CMake 3.25 replaces this with CMAKE_MSVC_DEBUG_INFORMATION_FORMAT
+ # See https://cmake.org/cmake/help/v3.25/variable/CMAKE_MSVC_DEBUG_INFORMATION_FORMAT.html
+ foreach(config DEBUG RELWITHDEBINFO)
+ foreach(lang C CXX)
+ set(flags_var "CMAKE_${lang}_FLAGS_${config}")
+ string(REGEX REPLACE "/Z[Ii]" "/Z7" ${flags_var} "${${flags_var}}")
+ endforeach()
+ endforeach()
+
+ if(CMAKE_MSVC_RUNTIME_LIBRARY STREQUAL "MultiThreadedDLL")
+ set(CMAKE_MAP_IMPORTED_CONFIG_DEBUG Release "")
+ set(CMAKE_MAP_IMPORTED_CONFIG_RELWITHDEBINFO Release "")
+ endif()
+else()
+ set(CMAKE_CXX_FLAGS "-Wall -pedantic -fstack-protector-strong --param=ssp-buffer-size=4 ${CMAKE_CXX_FLAGS}")
-# ATL's packlist needs more than the default 1 Mib stack on windows
-if(WIN32)
- set(CMAKE_EXE_LINKER_FLAGS "-Wl,--stack,8388608 ${CMAKE_EXE_LINKER_FLAGS}")
+ # ATL's pack list needs more than the default 1 Mib stack on windows
+ if(WIN32)
+ set(CMAKE_EXE_LINKER_FLAGS "-Wl,--stack,8388608 ${CMAKE_EXE_LINKER_FLAGS}")
+ endif()
endif()
# Fix build with Qt 5.13
@@ -53,11 +79,18 @@ if(ENABLE_LTO)
include(CheckIPOSupported)
check_ipo_supported(RESULT ipo_supported OUTPUT ipo_error)
- if(ipo_supported AND (CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "MinSizeRel"))
- message(STATUS "IPO / LTO enabled")
- set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
- elseif(ipo_supported)
- message(STATUS "Not enabling IPO / LTO on debug builds")
+ if(ipo_supported)
+ set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE)
+ set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_MINSIZEREL TRUE)
+ if(CMAKE_BUILD_TYPE)
+ if(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
+ message(STATUS "IPO / LTO enabled")
+ else()
+ message(STATUS "Not enabling IPO / LTO on debug builds")
+ endif()
+ else()
+ message(STATUS "IPO / LTO will only be enabled for release builds")
+ endif()
else()
message(STATUS "IPO / LTO not supported: <${ipo_error}>")
endif()
@@ -65,8 +98,20 @@ endif()
option(BUILD_TESTING "Build the testing tree." ON)
-find_package(ECM REQUIRED NO_MODULE)
-set(CMAKE_MODULE_PATH "${ECM_MODULE_PATH};${CMAKE_MODULE_PATH}")
+find_package(ECM QUIET NO_MODULE)
+if(NOT ECM_FOUND)
+ if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/libraries/extra-cmake-modules/CMakeLists.txt")
+ message(STATUS "Using bundled ECM")
+ set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/libraries/extra-cmake-modules/modules;${CMAKE_MODULE_PATH}")
+ else()
+ message(FATAL_ERROR
+ " Could not find ECM\n \n"
+ " Either install ECM using the system package manager or clone submodules\n"
+ " Submodules can be cloned with 'git submodule update --init --recursive'")
+ endif()
+else()
+ set(CMAKE_MODULE_PATH "${ECM_MODULE_PATH};${CMAKE_MODULE_PATH}")
+endif()
include(CTest)
include(ECMAddTests)
if(BUILD_TESTING)
@@ -151,6 +196,10 @@ set(Launcher_BUILD_TIMESTAMP "${TODAY}")
################################ 3rd Party Libs ################################
+if(NOT Launcher_FORCE_BUNDLED_LIBS)
+ find_package(ZLIB QUIET)
+endif()
+
# Find the required Qt parts
include(QtVersionlessBackport)
if(Launcher_QT_VERSION_MAJOR EQUAL 5)
@@ -311,6 +360,21 @@ add_subdirectory(libraries/systeminfo) # system information library
add_subdirectory(libraries/hoedown) # markdown parser
add_subdirectory(libraries/launcher) # java based launcher part for Minecraft
add_subdirectory(libraries/javacheck) # java compatibility checker
+if(NOT ZLIB_FOUND)
+ message(STATUS "Using bundled zlib")
+ set(CMAKE_POLICY_DEFAULT_CMP0069 NEW) # Suppress cmake warnings and allow INTERPROCEDURAL_OPTIMIZATION for zlib
+ set(SKIP_INSTALL_ALL ON)
+ add_subdirectory(libraries/zlib EXCLUDE_FROM_ALL)
+
+ set(ZLIB_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/libraries/zlib" "${CMAKE_CURRENT_BINARY_DIR}/libraries/zlib")
+ set_target_properties(zlibstatic PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${ZLIB_INCLUDE_DIR}")
+ add_library(ZLIB::ZLIB ALIAS zlibstatic)
+ set(ZLIB_LIBRARY ZLIB::ZLIB)
+ set(ZLIB_FOUND true)
+ find_package(ZLIB REQUIRED)
+else()
+ message(STATUS "Using system zlib")
+endif()
if (FORCE_BUNDLED_QUAZIP)
message(STATUS "Using bundled QuaZip")
set(BUILD_SHARED_LIBS 0) # link statically to avoid conflicts.
diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt
index 0dae47df..fd1dd03b 100644
--- a/launcher/CMakeLists.txt
+++ b/launcher/CMakeLists.txt
@@ -539,9 +539,6 @@ set(ATLAUNCHER_SOURCES
################################ COMPILE ################################
-# we need zlib
-find_package(ZLIB REQUIRED)
-
set(LOGIC_SOURCES
${CORE_SOURCES}
${PATHMATCHER_SOURCES}
@@ -1062,96 +1059,95 @@ if(INSTALL_BUNDLE STREQUAL "full")
COMPONENT Runtime
)
# Bundle plugins
- if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
- # Image formats
- install(
- DIRECTORY "${QT_PLUGINS_DIR}/imageformats"
- DESTINATION ${PLUGIN_DEST_DIR}
- COMPONENT Runtime
- REGEX "tga|tiff|mng" EXCLUDE
- )
- # Icon engines
- install(
- DIRECTORY "${QT_PLUGINS_DIR}/iconengines"
- DESTINATION ${PLUGIN_DEST_DIR}
- COMPONENT Runtime
- REGEX "fontawesome" EXCLUDE
- )
- # Platform plugins
+ # Image formats
+ install(
+ DIRECTORY "${QT_PLUGINS_DIR}/imageformats"
+ CONFIGURATIONS Debug RelWithDebInfo
+ DESTINATION ${PLUGIN_DEST_DIR}
+ COMPONENT Runtime
+ REGEX "tga|tiff|mng" EXCLUDE
+ )
+ install(
+ DIRECTORY "${QT_PLUGINS_DIR}/imageformats"
+ CONFIGURATIONS Release MinSizeRel
+ DESTINATION ${PLUGIN_DEST_DIR}
+ COMPONENT Runtime
+ REGEX "tga|tiff|mng" EXCLUDE
+ REGEX "d\\." EXCLUDE
+ REGEX "_debug\\." EXCLUDE
+ REGEX "\\.dSYM" EXCLUDE
+ )
+ # Icon engines
+ install(
+ DIRECTORY "${QT_PLUGINS_DIR}/iconengines"
+ CONFIGURATIONS Debug RelWithDebInfo
+ DESTINATION ${PLUGIN_DEST_DIR}
+ COMPONENT Runtime
+ REGEX "fontawesome" EXCLUDE
+ )
+ install(
+ DIRECTORY "${QT_PLUGINS_DIR}/iconengines"
+ CONFIGURATIONS Release MinSizeRel
+ DESTINATION ${PLUGIN_DEST_DIR}
+ COMPONENT Runtime
+ REGEX "fontawesome" EXCLUDE
+ REGEX "d\\." EXCLUDE
+ REGEX "_debug\\." EXCLUDE
+ REGEX "\\.dSYM" EXCLUDE
+ )
+ # Platform plugins
+ install(
+ DIRECTORY "${QT_PLUGINS_DIR}/platforms"
+ CONFIGURATIONS Debug RelWithDebInfo
+ DESTINATION ${PLUGIN_DEST_DIR}
+ COMPONENT Runtime
+ REGEX "minimal|linuxfb|offscreen" EXCLUDE
+ )
+ install(
+ DIRECTORY "${QT_PLUGINS_DIR}/platforms"
+ CONFIGURATIONS Release MinSizeRel
+ DESTINATION ${PLUGIN_DEST_DIR}
+ COMPONENT Runtime
+ REGEX "minimal|linuxfb|offscreen" EXCLUDE
+ REGEX "[^2]d\\." EXCLUDE
+ REGEX "_debug\\." EXCLUDE
+ REGEX "\\.dSYM" EXCLUDE
+ )
+ # Style plugins
+ if(EXISTS "${QT_PLUGINS_DIR}/styles")
install(
- DIRECTORY "${QT_PLUGINS_DIR}/platforms"
+ DIRECTORY "${QT_PLUGINS_DIR}/styles"
+ CONFIGURATIONS Debug RelWithDebInfo
DESTINATION ${PLUGIN_DEST_DIR}
COMPONENT Runtime
- REGEX "minimal|linuxfb|offscreen" EXCLUDE
)
- # Style plugins
- if(EXISTS "${QT_PLUGINS_DIR}/styles")
- install(
- DIRECTORY "${QT_PLUGINS_DIR}/styles"
- DESTINATION ${PLUGIN_DEST_DIR}
- COMPONENT Runtime
- )
- endif()
- # TLS plugins (Qt 6 only)
- if(EXISTS "${QT_PLUGINS_DIR}/tls")
- install(
- DIRECTORY "${QT_PLUGINS_DIR}/tls"
- DESTINATION ${PLUGIN_DEST_DIR}
- COMPONENT Runtime
- )
- endif()
- else()
- # Image formats
install(
- DIRECTORY "${QT_PLUGINS_DIR}/imageformats"
+ DIRECTORY "${QT_PLUGINS_DIR}/styles"
+ CONFIGURATIONS Release MinSizeRel
DESTINATION ${PLUGIN_DEST_DIR}
COMPONENT Runtime
- REGEX "tga|tiff|mng" EXCLUDE
REGEX "d\\." EXCLUDE
REGEX "_debug\\." EXCLUDE
REGEX "\\.dSYM" EXCLUDE
)
- # Icon engines
+ endif()
+ # TLS plugins (Qt 6 only)
+ if(EXISTS "${QT_PLUGINS_DIR}/tls")
install(
- DIRECTORY "${QT_PLUGINS_DIR}/iconengines"
+ DIRECTORY "${QT_PLUGINS_DIR}/tls"
+ CONFIGURATIONS Debug RelWithDebInfo
DESTINATION ${PLUGIN_DEST_DIR}
COMPONENT Runtime
- REGEX "fontawesome" EXCLUDE
- REGEX "d\\." EXCLUDE
- REGEX "_debug\\." EXCLUDE
- REGEX "\\.dSYM" EXCLUDE
)
- # Platform plugins
install(
- DIRECTORY "${QT_PLUGINS_DIR}/platforms"
+ DIRECTORY "${QT_PLUGINS_DIR}/tls"
+ CONFIGURATIONS Release MinSizeRel
DESTINATION ${PLUGIN_DEST_DIR}
COMPONENT Runtime
- REGEX "minimal|linuxfb|offscreen" EXCLUDE
- REGEX "d\\." EXCLUDE
+ REGEX "dd\\." EXCLUDE
REGEX "_debug\\." EXCLUDE
REGEX "\\.dSYM" EXCLUDE
)
- # Style plugins
- if(EXISTS "${QT_PLUGINS_DIR}/styles")
- install(
- DIRECTORY "${QT_PLUGINS_DIR}/styles"
- DESTINATION ${PLUGIN_DEST_DIR}
- COMPONENT Runtime
- REGEX "d\\." EXCLUDE
- REGEX "_debug\\." EXCLUDE
- REGEX "\\.dSYM" EXCLUDE
- )
- endif()
- # TLS plugins (Qt 6 only)
- if(EXISTS "${QT_PLUGINS_DIR}/tls")
- install(
- DIRECTORY "${QT_PLUGINS_DIR}/tls"
- DESTINATION ${PLUGIN_DEST_DIR}
- COMPONENT Runtime
- REGEX "_debug\\." EXCLUDE
- REGEX "\\.dSYM" EXCLUDE
- )
- endif()
endif()
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/install_prereqs.cmake.in"
diff --git a/launcher/modplatform/ModAPI.h b/launcher/modplatform/ModAPI.h
index c7408835..703de143 100644
--- a/launcher/modplatform/ModAPI.h
+++ b/launcher/modplatform/ModAPI.h
@@ -39,7 +39,7 @@
#include <QList>
#include <list>
-#include "Version.h"
+#include "../Version.h"
#include "net/NetJob.h"
namespace ModPlatform {
diff --git a/launcher/modplatform/modrinth/ModrinthPackManifest.cpp b/launcher/modplatform/modrinth/ModrinthPackManifest.cpp
index a4620df9..96f54067 100644
--- a/launcher/modplatform/modrinth/ModrinthPackManifest.cpp
+++ b/launcher/modplatform/modrinth/ModrinthPackManifest.cpp
@@ -140,7 +140,7 @@ auto loadIndexedVersion(QJsonObject &obj) -> ModpackVersion
for (auto file_iter : files) {
File indexed_file;
auto parent = Json::requireObject(file_iter);
- auto is_primary = Json::ensureBoolean(parent, "primary", false);
+ auto is_primary = Json::ensureBoolean(parent, (const QString)QStringLiteral("primary"), false);
if (!is_primary) {
auto filename = Json::ensureString(parent, "filename");
// Checking suffix here is fine because it's the response from Modrinth,
diff --git a/launcher/net/HttpMetaCache.cpp b/launcher/net/HttpMetaCache.cpp
index 42198b71..e242dcf4 100644
--- a/launcher/net/HttpMetaCache.cpp
+++ b/launcher/net/HttpMetaCache.cpp
@@ -242,7 +242,7 @@ void HttpMetaCache::Load()
foo->local_changed_timestamp = Json::ensureDouble(element_obj, "last_changed_timestamp");
foo->remote_changed_timestamp = Json::ensureString(element_obj, "remote_changed_timestamp");
- foo->makeEternal(Json::ensureBoolean(element_obj, "eternal", false));
+ foo->makeEternal(Json::ensureBoolean(element_obj, (const QString)QStringLiteral("eternal"), false));
if (!foo->isEternal()) {
foo->current_age = Json::ensureDouble(element_obj, "current_age");
foo->max_age = Json::ensureDouble(element_obj, "max_age");
diff --git a/libraries/extra-cmake-modules b/libraries/extra-cmake-modules
new file mode 160000
+Subproject bbcbaff78283270c2beee69afd8d5b91da854af
diff --git a/libraries/hoedown/src/autolink.c b/libraries/hoedown/src/autolink.c
index 3063b1a0..3592b8e3 100644
--- a/libraries/hoedown/src/autolink.c
+++ b/libraries/hoedown/src/autolink.c
@@ -150,7 +150,7 @@ hoedown_autolink__www(
uint8_t *data,
size_t max_rewind,
size_t size,
- unsigned int flags)
+ hoedown_autolink_flags flags)
{
size_t link_end;
@@ -186,7 +186,7 @@ hoedown_autolink__email(
uint8_t *data,
size_t max_rewind,
size_t size,
- unsigned int flags)
+ hoedown_autolink_flags flags)
{
size_t link_end, rewind;
int nb = 0, np = 0;
@@ -242,7 +242,7 @@ hoedown_autolink__url(
uint8_t *data,
size_t max_rewind,
size_t size,
- unsigned int flags)
+ hoedown_autolink_flags flags)
{
size_t link_end, rewind = 0, domain_len;
diff --git a/libraries/zlib b/libraries/zlib
new file mode 160000
+Subproject 04f42ceca40f73e2978b50e93806c2a18c1281f
diff --git a/tests/GZip_test.cpp b/tests/GZip_test.cpp
index 1e762b2e..82503d81 100644
--- a/tests/GZip_test.cpp
+++ b/tests/GZip_test.cpp
@@ -24,7 +24,7 @@ slots:
QByteArray compressed;
QByteArray decompressed;
std::default_random_engine eng((std::random_device())());
- std::uniform_int_distribution<uint8_t> idis(0, std::numeric_limits<uint8_t>::max());
+ std::uniform_int_distribution<uint16_t> idis(0, std::numeric_limits<uint8_t>::max());
// initialize random buffer
for(int i = 0; i < size; i++)