mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-21 18:50:47 +03:00
Select Qt6 in cmake
This commit is contained in:
parent
d95d2fcaa9
commit
0ac46ea209
2 changed files with 29 additions and 30 deletions
|
@ -57,7 +57,7 @@ option(USE_BUNDLED_OPENSSL "Use the bundled version of OpenSSL." OFF)
|
||||||
option(USE_BUNDLED_MTXCLIENT "Use the bundled version of the Matrix Client library." ${HUNTER_ENABLED})
|
option(USE_BUNDLED_MTXCLIENT "Use the bundled version of the Matrix Client library." ${HUNTER_ENABLED})
|
||||||
option(USE_BUNDLED_LMDB "Use the bundled version of lmdb." ${HUNTER_ENABLED})
|
option(USE_BUNDLED_LMDB "Use the bundled version of lmdb." ${HUNTER_ENABLED})
|
||||||
option(USE_BUNDLED_LMDBXX "Use the bundled version of lmdb++." ${HUNTER_ENABLED})
|
option(USE_BUNDLED_LMDBXX "Use the bundled version of lmdb++." ${HUNTER_ENABLED})
|
||||||
option(USE_BUNDLED_QTKEYCHAIN "Use the bundled version of Qt5Keychain." ${HUNTER_ENABLED})
|
option(USE_BUNDLED_QTKEYCHAIN "Use the bundled version of Qt6Keychain." ${HUNTER_ENABLED})
|
||||||
option(USE_BUNDLED_COEURL "Use a bundled version of the Curl wrapper"
|
option(USE_BUNDLED_COEURL "Use a bundled version of the Curl wrapper"
|
||||||
${HUNTER_ENABLED})
|
${HUNTER_ENABLED})
|
||||||
option(USE_BUNDLED_LIBEVENT "Use the bundled version of libevent." ${HUNTER_ENABLED})
|
option(USE_BUNDLED_LIBEVENT "Use the bundled version of libevent." ${HUNTER_ENABLED})
|
||||||
|
@ -239,16 +239,17 @@ endif()
|
||||||
#
|
#
|
||||||
# Discover Qt dependencies.
|
# Discover Qt dependencies.
|
||||||
#
|
#
|
||||||
find_package(Qt5 5.15 COMPONENTS Core Widgets LinguistTools Concurrent Svg Multimedia Qml QuickControls2 QuickWidgets REQUIRED)
|
find_package(Qt6 6.5 COMPONENTS Core Widgets LinguistTools Svg Multimedia Qml QuickControls2 REQUIRED)
|
||||||
find_package(Qt5QuickCompiler)
|
#find_package(Qt6QuickCompiler)
|
||||||
find_package(Qt5DBus)
|
find_package(Qt6DBus)
|
||||||
|
|
||||||
if (USE_BUNDLED_QTKEYCHAIN)
|
if (USE_BUNDLED_QTKEYCHAIN)
|
||||||
include(FetchContent)
|
include(FetchContent)
|
||||||
|
set(BUILD_WITH_QT6 ON)
|
||||||
FetchContent_Declare(
|
FetchContent_Declare(
|
||||||
qt5keychain
|
qt6keychain
|
||||||
GIT_REPOSITORY https://github.com/frankosterfeld/qtkeychain.git
|
GIT_REPOSITORY https://github.com/frankosterfeld/qtkeychain.git
|
||||||
GIT_TAG v0.13.1
|
GIT_TAG v0.14.0
|
||||||
)
|
)
|
||||||
if (BUILD_SHARED_LIBS)
|
if (BUILD_SHARED_LIBS)
|
||||||
set(QTKEYCHAIN_STATIC OFF CACHE INTERNAL "")
|
set(QTKEYCHAIN_STATIC OFF CACHE INTERNAL "")
|
||||||
|
@ -256,21 +257,21 @@ if (USE_BUNDLED_QTKEYCHAIN)
|
||||||
set(QTKEYCHAIN_STATIC ON CACHE INTERNAL "")
|
set(QTKEYCHAIN_STATIC ON CACHE INTERNAL "")
|
||||||
endif()
|
endif()
|
||||||
set(BUILD_TEST_APPLICATION OFF CACHE INTERNAL "")
|
set(BUILD_TEST_APPLICATION OFF CACHE INTERNAL "")
|
||||||
FetchContent_MakeAvailable(qt5keychain)
|
FetchContent_MakeAvailable(qt6keychain)
|
||||||
else()
|
else()
|
||||||
find_package(Qt5Keychain REQUIRED)
|
find_package(Qt6Keychain REQUIRED)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
find_package(Qt5MacExtras REQUIRED)
|
find_package(Qt6MacExtras REQUIRED)
|
||||||
endif(APPLE)
|
endif(APPLE)
|
||||||
|
|
||||||
if (Qt5Widgets_FOUND)
|
if (Qt6Widgets_FOUND)
|
||||||
if (Qt5Widgets_VERSION VERSION_LESS 5.15.0)
|
if (Qt6Widgets_VERSION VERSION_LESS 6.5.0)
|
||||||
message(STATUS "Qt version ${Qt5Widgets_VERSION}")
|
message(STATUS "Qt version ${Qt6Widgets_VERSION}")
|
||||||
message(WARNING "Minimum supported Qt5 version is 5.15!")
|
message(WARNING "Minimum supported Qt6 version is 6.5!")
|
||||||
endif()
|
endif()
|
||||||
endif(Qt5Widgets_FOUND)
|
endif(Qt6Widgets_FOUND)
|
||||||
|
|
||||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||||
if(NOT MSVC)
|
if(NOT MSVC)
|
||||||
|
@ -690,15 +691,15 @@ set_target_properties(nheko
|
||||||
AUTOMOC ON)
|
AUTOMOC ON)
|
||||||
|
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
target_link_libraries (nheko PRIVATE Qt5::MacExtras)
|
target_link_libraries (nheko PRIVATE Qt6::MacExtras)
|
||||||
elseif(WIN32)
|
elseif(WIN32)
|
||||||
target_compile_definitions(nheko PRIVATE WIN32_LEAN_AND_MEAN)
|
target_compile_definitions(nheko PRIVATE WIN32_LEAN_AND_MEAN)
|
||||||
target_link_libraries (nheko PRIVATE ${NTDLIB} Qt5::WinMain)
|
target_link_libraries (nheko PRIVATE ${NTDLIB} Qt6::WinMain)
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
target_compile_options(nheko PUBLIC "/Zc:__cplusplus")
|
target_compile_options(nheko PUBLIC "/Zc:__cplusplus")
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
target_link_libraries (nheko PRIVATE Qt5::DBus)
|
target_link_libraries (nheko PRIVATE Qt6::DBus)
|
||||||
if (FLATPAK)
|
if (FLATPAK)
|
||||||
target_compile_definitions(nheko PRIVATE NHEKO_FLATPAK)
|
target_compile_definitions(nheko PRIVATE NHEKO_FLATPAK)
|
||||||
endif()
|
endif()
|
||||||
|
@ -729,7 +730,7 @@ endif()
|
||||||
|
|
||||||
# Fixup bundled keychain include dirs
|
# Fixup bundled keychain include dirs
|
||||||
if (USE_BUNDLED_QTKEYCHAIN)
|
if (USE_BUNDLED_QTKEYCHAIN)
|
||||||
target_include_directories(nheko PRIVATE ${qt5keychain_SOURCE_DIR} ${qt5keychain_BINARY_DIR})
|
target_include_directories(nheko PRIVATE ${qt6keychain_SOURCE_DIR} ${qt6keychain_BINARY_DIR})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NOT JSON_ImplicitConversions)
|
if (NOT JSON_ImplicitConversions)
|
||||||
|
@ -744,14 +745,12 @@ target_link_libraries(nheko PRIVATE
|
||||||
MatrixClient::MatrixClient
|
MatrixClient::MatrixClient
|
||||||
cmark::cmark
|
cmark::cmark
|
||||||
spdlog::spdlog
|
spdlog::spdlog
|
||||||
Qt5::Widgets
|
Qt::Widgets
|
||||||
Qt5::Svg
|
Qt::Svg
|
||||||
Qt5::Concurrent
|
Qt::Multimedia
|
||||||
Qt5::Multimedia
|
Qt::Qml
|
||||||
Qt5::Qml
|
Qt::QuickControls2
|
||||||
Qt5::QuickControls2
|
qt6keychain
|
||||||
Qt5::QuickWidgets
|
|
||||||
qt5keychain
|
|
||||||
nlohmann_json::nlohmann_json
|
nlohmann_json::nlohmann_json
|
||||||
lmdbxx::lmdbxx
|
lmdbxx::lmdbxx
|
||||||
liblmdb::lmdb
|
liblmdb::lmdb
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
|
|
||||||
file(GLOB LANG_TS_SRC "${CMAKE_CURRENT_SOURCE_DIR}/resources/langs/*.ts")
|
file(GLOB LANG_TS_SRC "${CMAKE_CURRENT_SOURCE_DIR}/resources/langs/*.ts")
|
||||||
|
|
||||||
qt5_add_translation(QM_SRC ${LANG_TS_SRC})
|
qt_add_translation(QM_SRC ${LANG_TS_SRC})
|
||||||
qt5_create_translation(${QM_SRC})
|
qt_create_translation(${QM_SRC})
|
||||||
add_custom_target(LANG_QRC ALL DEPENDS ${QM_SRC})
|
add_custom_target(LANG_QRC ALL DEPENDS ${QM_SRC})
|
||||||
|
|
||||||
# Generate a qrc file for the translations
|
# Generate a qrc file for the translations
|
||||||
|
@ -20,9 +20,9 @@ if(NOT EXISTS ${_qrc})
|
||||||
file(APPEND ${_qrc} " </qresource>\n</RCC>\n")
|
file(APPEND ${_qrc} " </qresource>\n</RCC>\n")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
qt5_add_resources(LANG_QRC ${_qrc})
|
qt_add_resources(LANG_QRC ${_qrc})
|
||||||
if(Qt5QuickCompiler_FOUND AND COMPILE_QML)
|
if(Qt5QuickCompiler_FOUND AND COMPILE_QML)
|
||||||
qtquick_compiler_add_resources(QRC resources/res.qrc)
|
qtquick_compiler_add_resources(QRC resources/res.qrc)
|
||||||
else()
|
else()
|
||||||
qt5_add_resources(QRC resources/res.qrc)
|
qt_add_resources(QRC resources/res.qrc)
|
||||||
endif()
|
endif()
|
||||||
|
|
Loading…
Reference in a new issue