Prepare CMake for Qt6 (#3103)

This commit is contained in:
Paweł 2021-08-08 12:37:37 +02:00 committed by GitHub
parent 359db17386
commit d0d32583a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 20 deletions

View file

@ -5,6 +5,7 @@
- Minor: Remove TwitchEmotes.com attribution and the open/copy options when right-clicking a Twitch Emote. (#2214, #3136) - Minor: Remove TwitchEmotes.com attribution and the open/copy options when right-clicking a Twitch Emote. (#2214, #3136)
- Bugfix: Moderation mode and active filters are now preserved when opening a split as a popup. (#3113, #3130) - Bugfix: Moderation mode and active filters are now preserved when opening a split as a popup. (#3113, #3130)
- Bugfix: Fixed a bug that caused all badge highlights to use the same color. (#3132, #3134) - Bugfix: Fixed a bug that caused all badge highlights to use the same color. (#3132, #3134)
- Dev: Renamed CMake's build option `USE_SYSTEM_QT5KEYCHAIN` to `USE_SYSTEM_QTKEYCHAIN`. (#3103)
## 2.3.4 ## 2.3.4

View file

@ -13,11 +13,18 @@ option(BUILD_APP "Build Chatterino" ON)
option(BUILD_TESTS "Build the tests for Chatterino" OFF) option(BUILD_TESTS "Build the tests for Chatterino" OFF)
option(USE_SYSTEM_PAJLADA_SETTINGS "Use system pajlada settings library" OFF) option(USE_SYSTEM_PAJLADA_SETTINGS "Use system pajlada settings library" OFF)
option(USE_SYSTEM_LIBCOMMUNI "Use system communi library" OFF) option(USE_SYSTEM_LIBCOMMUNI "Use system communi library" OFF)
option(USE_SYSTEM_QT5KEYCHAIN "Use system Qt5Keychain library" OFF) option(USE_SYSTEM_QTKEYCHAIN "Use system QtKeychain library" OFF)
option(USE_PRECOMPILED_HEADERS "Use precompiled headers" ON) option(USE_PRECOMPILED_HEADERS "Use precompiled headers" ON)
option(BUILD_WITH_QT6 "Use Qt6 instead of default Qt5" OFF)
option(USE_CONAN "Use conan" OFF) option(USE_CONAN "Use conan" OFF)
if (BUILD_WITH_QT6)
set(MAJOR_QT_VERSION "6")
else()
set(MAJOR_QT_VERSION "5")
endif()
if (USE_CONAN OR CONAN_EXPORTED) if (USE_CONAN OR CONAN_EXPORTED)
include(${CMAKE_CURRENT_BINARY_DIR}/conanbuildinfo.cmake) include(${CMAKE_CURRENT_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup(TARGETS NO_OUTPUT_DIRS) conan_basic_setup(TARGETS NO_OUTPUT_DIRS)
@ -31,7 +38,7 @@ endif ()
include(${CMAKE_CURRENT_LIST_DIR}/cmake/GIT.cmake) include(${CMAKE_CURRENT_LIST_DIR}/cmake/GIT.cmake)
find_package(Qt5 REQUIRED find_package(Qt${MAJOR_QT_VERSION} REQUIRED
COMPONENTS COMPONENTS
Core Core
Widgets Widgets
@ -72,17 +79,17 @@ endif()
# Link QtKeychain statically # Link QtKeychain statically
option(QTKEYCHAIN_STATIC "" ON) option(QTKEYCHAIN_STATIC "" ON)
if (USE_SYSTEM_QT5KEYCHAIN) if (USE_SYSTEM_QTKEYCHAIN)
find_package(Qt5Keychain REQUIRED) find_package(Qt${MAJOR_QT_VERSION}Keychain REQUIRED)
else() else()
set(QT5KEYCHAIN_ROOT_LIB_FOLDER "${CMAKE_SOURCE_DIR}/lib/qtkeychain") set(QTKEYCHAIN_ROOT_LIB_FOLDER "${CMAKE_SOURCE_DIR}/lib/qtkeychain")
if (NOT EXISTS "${QT5KEYCHAIN_ROOT_LIB_FOLDER}/CMakeLists.txt") if (NOT EXISTS "${QTKEYCHAIN_ROOT_LIB_FOLDER}/CMakeLists.txt")
message(FATAL_ERROR "Submodules probably not loaded, unable to find lib/qtkeychain/CMakeLists.txt") message(FATAL_ERROR "Submodules probably not loaded, unable to find lib/qtkeychain/CMakeLists.txt")
endif() endif()
add_subdirectory("${QT5KEYCHAIN_ROOT_LIB_FOLDER}" EXCLUDE_FROM_ALL) add_subdirectory("${QTKEYCHAIN_ROOT_LIB_FOLDER}" EXCLUDE_FROM_ALL)
if (NOT TARGET qt5keychain) if (NOT TARGET qt${MAJOR_QT_VERSION}keychain)
message(FATAL_ERROR "qt5keychain target was not created :@") message(FATAL_ERROR "qt${MAJOR_QT_VERSION}keychain target was not created :@")
endif() endif()
endif() endif()

View file

@ -486,16 +486,16 @@ add_library(${LIBRARY_PROJECT} OBJECT ${SOURCE_FILES})
target_link_libraries(${LIBRARY_PROJECT} target_link_libraries(${LIBRARY_PROJECT}
PUBLIC PUBLIC
Qt5::Core Qt${MAJOR_QT_VERSION}::Core
Qt5::Widgets Qt${MAJOR_QT_VERSION}::Widgets
Qt5::Gui Qt${MAJOR_QT_VERSION}::Gui
Qt5::Network Qt${MAJOR_QT_VERSION}::Network
Qt5::Multimedia Qt${MAJOR_QT_VERSION}::Multimedia
Qt5::Svg Qt${MAJOR_QT_VERSION}::Svg
Qt5::Concurrent Qt${MAJOR_QT_VERSION}::Concurrent
LibCommuni::LibCommuni LibCommuni::LibCommuni
qt5keychain qt${MAJOR_QT_VERSION}keychain
Pajlada::Serialize Pajlada::Serialize
Pajlada::Settings Pajlada::Settings
Pajlada::Signals Pajlada::Signals
@ -524,8 +524,8 @@ if (BUILD_APP)
) )
if (MSVC) if (MSVC)
get_target_property(Qt5_Core_Location Qt5::Core LOCATION) get_target_property(Qt_Core_Location Qt${MAJOR_QT_VERSION}::Core LOCATION)
get_filename_component(QT_BIN_DIR ${Qt5_Core_Location} DIRECTORY) get_filename_component(QT_BIN_DIR ${Qt_Core_Location} DIRECTORY)
set(WINDEPLOYQT_COMMAND "${QT_BIN_DIR}/windeployqt.exe" $<TARGET_FILE:${EXECUTABLE_PROJECT}> --release --no-compiler-runtime --no-translations --no-opengl-sw) set(WINDEPLOYQT_COMMAND "${QT_BIN_DIR}/windeployqt.exe" $<TARGET_FILE:${EXECUTABLE_PROJECT}> --release --no-compiler-runtime --no-translations --no-opengl-sw)
install(TARGETS ${EXECUTABLE_PROJECT} install(TARGETS ${EXECUTABLE_PROJECT}
@ -582,7 +582,7 @@ target_compile_definitions(${LIBRARY_PROJECT} PUBLIC
CHATTERINO_GIT_RELEASE=\"${GIT_RELEASE}\" CHATTERINO_GIT_RELEASE=\"${GIT_RELEASE}\"
CHATTERINO_GIT_COMMIT=\"${GIT_COMMIT}\" CHATTERINO_GIT_COMMIT=\"${GIT_COMMIT}\"
) )
if (USE_SYSTEM_QT5KEYCHAIN) if (USE_SYSTEM_QTKEYCHAIN)
target_compile_definitions(${LIBRARY_PROJECT} PUBLIC target_compile_definitions(${LIBRARY_PROJECT} PUBLIC
CMAKE_BUILD CMAKE_BUILD
) )