From e14050d40c15f821491efb1ac2fd39686de36e93 Mon Sep 17 00:00:00 2001 From: zneix Date: Fri, 30 Jul 2021 17:08:31 +0200 Subject: [PATCH] First changes to build systems For the time being I hardcoded qt6 in cmake for convenience, but in the end there'll be a flag you should specify for building with either Qt6 or Qt5 --- CMakeLists.txt | 18 +++++++++--------- lib/qtkeychain.pri | 6 +++--- src/CMakeLists.txt | 22 +++++++++++----------- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 22fab10c3..4684868b7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,7 @@ option(BUILD_APP "Build Chatterino" ON) option(BUILD_TESTS "Build the tests for Chatterino" OFF) option(USE_SYSTEM_PAJLADA_SETTINGS "Use system pajlada settings library" OFF) option(USE_SYSTEM_LIBCOMMUNI "Use system communi library" OFF) -option(USE_SYSTEM_QT5KEYCHAIN "Use system Qt5Keychain library" OFF) +option(USE_SYSTEM_QT6KEYCHAIN "Use system Qt6Keychain library" OFF) option(USE_PRECOMPILED_HEADERS "Use precompiled headers" ON) option(USE_CONAN "Use conan" OFF) @@ -31,7 +31,7 @@ endif () include(${CMAKE_CURRENT_LIST_DIR}/cmake/GIT.cmake) -find_package(Qt5 REQUIRED +find_package(Qt6 REQUIRED COMPONENTS Core Widgets @@ -72,17 +72,17 @@ endif() # Link QtKeychain statically option(QTKEYCHAIN_STATIC "" ON) -if (USE_SYSTEM_QT5KEYCHAIN) - find_package(Qt5Keychain REQUIRED) +if (USE_SYSTEM_QT6KEYCHAIN) + find_package(Qt6Keychain REQUIRED) else() - set(QT5KEYCHAIN_ROOT_LIB_FOLDER "${CMAKE_SOURCE_DIR}/lib/qtkeychain") - if (NOT EXISTS "${QT5KEYCHAIN_ROOT_LIB_FOLDER}/CMakeLists.txt") + set(QT6KEYCHAIN_ROOT_LIB_FOLDER "${CMAKE_SOURCE_DIR}/lib/qtkeychain") + if (NOT EXISTS "${QT6KEYCHAIN_ROOT_LIB_FOLDER}/CMakeLists.txt") message(FATAL_ERROR "Submodules probably not loaded, unable to find lib/qtkeychain/CMakeLists.txt") endif() - add_subdirectory("${QT5KEYCHAIN_ROOT_LIB_FOLDER}" EXCLUDE_FROM_ALL) - if (NOT TARGET qt5keychain) - message(FATAL_ERROR "qt5keychain target was not created :@") + add_subdirectory("${QT6KEYCHAIN_ROOT_LIB_FOLDER}" EXCLUDE_FROM_ALL) + if (NOT TARGET qt6keychain) + message(FATAL_ERROR "qt6keychain target was not created :@") endif() endif() diff --git a/lib/qtkeychain.pri b/lib/qtkeychain.pri index 0cda579cb..f4741ca64 100644 --- a/lib/qtkeychain.pri +++ b/lib/qtkeychain.pri @@ -1,9 +1,9 @@ freebsd { - INCLUDEPATH += /usr/local/include/qt5keychain - LIBS += -lqt5keychain + INCLUDEPATH += /usr/local/include/qt6keychain + LIBS += -lqt6keychain } else { unix:!android:!macx:!ios { DEFINES += KEYCHAIN_DBUS } - include(qtkeychain/qt5keychain.pri) + include(qtkeychain/qt6keychain.pri) } diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 207f8c104..3a9f20ad6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -476,16 +476,16 @@ add_library(${LIBRARY_PROJECT} OBJECT ${SOURCE_FILES}) target_link_libraries(${LIBRARY_PROJECT} PUBLIC - Qt5::Core - Qt5::Widgets - Qt5::Gui - Qt5::Network - Qt5::Multimedia - Qt5::Svg - Qt5::Concurrent + Qt6::Core + Qt6::Widgets + Qt6::Gui + Qt6::Network + Qt6::Multimedia + Qt6::Svg + Qt6::Concurrent LibCommuni::LibCommuni - qt5keychain + qt6keychain Pajlada::Serialize Pajlada::Settings Pajlada::Signals @@ -514,8 +514,8 @@ if (BUILD_APP) ) if (MSVC) - get_target_property(Qt5_Core_Location Qt5::Core LOCATION) - get_filename_component(QT_BIN_DIR ${Qt5_Core_Location} DIRECTORY) + get_target_property(Qt6_Core_Location Qt6::Core LOCATION) + get_filename_component(QT_BIN_DIR ${Qt6_Core_Location} DIRECTORY) set(WINDEPLOYQT_COMMAND "${QT_BIN_DIR}/windeployqt.exe" $ --release --no-compiler-runtime --no-translations --no-opengl-sw) install(TARGETS ${EXECUTABLE_PROJECT} @@ -572,7 +572,7 @@ target_compile_definitions(${LIBRARY_PROJECT} PUBLIC CHATTERINO_GIT_RELEASE=\"${GIT_RELEASE}\" CHATTERINO_GIT_COMMIT=\"${GIT_COMMIT}\" ) -if (USE_SYSTEM_QT5KEYCHAIN) +if (USE_SYSTEM_QT6KEYCHAIN) target_compile_definitions(${LIBRARY_PROJECT} PUBLIC CMAKE_BUILD )