From 2c8e0f1552dd17f95da5ee1051b8cc64132209ce Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Tue, 1 Mar 2022 17:21:29 -0500 Subject: [PATCH] Fix the last of the system libraries issue --- CMakeLists.txt | 46 ++++++++++++++++++++++++++++++++++++++--- external/CMakeLists.txt | 4 ++++ src/launchercore.cpp | 2 +- src/launcherwindow.cpp | 2 +- src/main.cpp | 2 +- 5 files changed, 50 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 09ee480..85b76ce 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,6 +8,7 @@ set(CMAKE_CXX_STANDARD 17) find_package(Qt5 COMPONENTS Core Widgets Network CONFIG REQUIRED) option(ENABLE_WATCHDOG "Build with Tesseract support (needed for Watchdog)" OFF) +option(USE_OWN_LIBRARIES "Build with own libraries" OFF) if(ENABLE_WATCHDOG) find_package(PkgConfig REQUIRED) @@ -33,24 +34,63 @@ set(SRC src/gamescopesettingswindow.cpp include/gamescopesettingswindow.h) -find_package(Qt5Keychain) +include(FetchContent) + +if(NOT USE_OWN_LIBRARIES) + find_package(Qt5Keychain) +endif() + if(TARGET Qt5Keychain::Qt5Keychain) message("Using system library for Qt5 Keychain") set(LIBRARIES Qt5Keychain::Qt5Keychain ${LIBRARIES}) + set(KEYCHAIN_INCLUDE_DIRS ${QTKEYCHAIN_INCLUDE_DIRS}/qt5keychain) # this is to be consistent with the built-in lib? +else() + message("Using built-in qt keychain") + + FetchContent_Declare( + qtkeychain + GIT_REPOSITORY https://github.com/frankosterfeld/qtkeychain.git + GIT_TAG v0.12.0 + ) + + set(BUILD_WITH_QT6 OFF CACHE BOOL "" FORCE) + set(QTKEYCHAIN_STATIC ON CACHE BOOL "" FORCE) + + FetchContent_MakeAvailable(qtkeychain) + + set(LIBRARIES qt5keychain ${LIBRARIES}) + set(KEYCHAIN_INCLUDE_DIRS + ${CMAKE_BINARY_DIR}/_deps/qtkeychain-src + ${CMAKE_BINARY_DIR}/_deps/qtkeychain-build) +endif() + +if(NOT USE_OWN_LIBRARIES) + find_package(QuaZip-Qt5) endif() -find_package(QuaZip-Qt5) if(TARGET QuaZip::QuaZip) message("Using system library for Quazip") set(LIBRARIES QuaZip::QuaZip ${LIBRARIES}) +else() + message("Using built-in quazip") + + FetchContent_Declare( + quazip + GIT_REPOSITORY https://github.com/stachenov/quazip.git + GIT_TAG v1.2 + ) + FetchContent_MakeAvailable(quazip) + + set(LIBRARIES QuaZip ${LIBRARIES}) + set(QUAZIP_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/_deps/quazip-src/quazip) endif() add_subdirectory(external) set(LIBRARIES - Qt5::Core Qt5::Widgets Qt5::Network Qt5Keychain::Qt5Keychain ${LIBRARIES}) + Qt5::Core Qt5::Widgets Qt5::Network ${LIBRARIES}) if(ENABLE_WATCHDOG) set(LIBRARIES ${LIBRARIES} ${TESSERACT_LIBRARIES} ${LEPTONICA_LIBRARIES}) diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index 11f8f95..99d919b 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -1,6 +1,8 @@ include(FetchContent) if(NOT TARGET Qt5Keychain::Qt5Keychain) + message("Using built-in qt keychain") + FetchContent_Declare( qtkeychain GIT_REPOSITORY https://github.com/frankosterfeld/qtkeychain.git @@ -20,6 +22,8 @@ endif() if(NOT TARGET QuaZip::QuaZip) + message("Using built-in quazip") + FetchContent_Declare( quazip GIT_REPOSITORY https://github.com/stachenov/quazip.git diff --git a/src/launchercore.cpp b/src/launchercore.cpp index d7500fd..118553c 100755 --- a/src/launchercore.cpp +++ b/src/launchercore.cpp @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/launcherwindow.cpp b/src/launcherwindow.cpp index 3b42b3a..1044f59 100644 --- a/src/launcherwindow.cpp +++ b/src/launcherwindow.cpp @@ -1,7 +1,7 @@ #include "launcherwindow.h" #include -#include +#include #include #include #include diff --git a/src/main.cpp b/src/main.cpp index 0c25207..8b8ad9f 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include "sapphirelauncher.h" #include "squareboot.h"