Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
This commit is contained in:
Matthieu Gallien 2022-05-20 19:03:40 +02:00 коммит произвёл Matthieu Gallien
Родитель d3442d137a
Коммит aa76de9b68
13 изменённых файлов: 113 добавлений и 91 удалений

Просмотреть файл

@ -139,7 +139,7 @@ if(APPLE AND BUILD_OWNCLOUD_OSX_BUNDLE)
add_definitions(-DBUILD_OWNCLOUD_OSX_BUNDLE)
endif()
find_package(Qt${QT_MAJOR_VERSION} COMPONENTS Core)
option(QUICK_COMPILER "Use QtQuick compiler to improve performance" OFF)
# this option removes Http authentication, keychain, shibboleth etc and is intended for

Просмотреть файл

@ -9,7 +9,7 @@ else()
set(MAC_INSTALLER_DO_CUSTOM_BACKGROUND "0")
endif()
find_package(Qt5 5.15 COMPONENTS Core REQUIRED)
find_package(Qt${QT_MAJOR_VERSION} 5.15 COMPONENTS Core REQUIRED)
configure_file(create_mac.sh.cmake ${CMAKE_CURRENT_BINARY_DIR}/create_mac.sh)
configure_file(macosx.pkgproj.cmake ${CMAKE_CURRENT_BINARY_DIR}/macosx.pkgproj)
configure_file(pre_install.sh.cmake ${CMAKE_CURRENT_BINARY_DIR}/pre_install.sh)

Просмотреть файл

@ -25,8 +25,13 @@ macro(libcloudproviders_add_config _sources)
endmacro(libcloudproviders_add_config _sources)
find_package(Qt5 5.15 COMPONENTS DBus)
IF (Qt5DBus_FOUND)
if (Qt6_FOUND)
find_package(Qt6 COMPONENTS COMPONENTS DBus)
else()
set(REQUIRED_QT_VERSION "5.15.0")
find_package(Qt5 ${REQUIRED_QT_VERSION} COMPONENTS DBus)
endif()
IF (Qt5DBus_FOUND OR Qt6DBus_FOUND)
STRING(TOLOWER "${APPLICATION_VENDOR}" DBUS_VENDOR)
STRING(REGEX REPLACE "[^A-z0-9]" "" DBUS_VENDOR "${DBUS_VENDOR}")
STRING(REGEX REPLACE "[^A-z0-9]" "" DBUS_APPLICATION_NAME "${APPLICATION_SHORTNAME}")

Просмотреть файл

@ -2,71 +2,73 @@ include(ECMEnableSanitizers)
set(REQUIRED_QT_VERSION "5.15.0")
find_package(Qt5Core ${REQUIRED_QT_VERSION} CONFIG QUIET)
set_package_properties(Qt5Core PROPERTIES
DESCRIPTION "Qt5 Core component."
find_package(Qt${QT_MAJOR_VERSION}Core ${REQUIRED_QT_VERSION} CONFIG QUIET)
set_package_properties(Qt${QT_MAJOR_VERSION}Core PROPERTIES
DESCRIPTION "Qt${QT_MAJOR_VERSION} Core component."
TYPE REQUIRED
)
find_package(Qt5Network ${REQUIRED_QT_VERSION} CONFIG QUIET)
set_package_properties(Qt5Network PROPERTIES
DESCRIPTION "Qt5 Network component."
find_package(Qt${QT_MAJOR_VERSION}Network ${REQUIRED_QT_VERSION} CONFIG QUIET)
set_package_properties(Qt${QT_MAJOR_VERSION}Network PROPERTIES
DESCRIPTION "Qt${QT_MAJOR_VERSION} Network component."
TYPE REQUIRED
)
find_package(Qt5Xml ${REQUIRED_QT_VERSION} CONFIG QUIET)
set_package_properties(Qt5Xml PROPERTIES
DESCRIPTION "Qt5 Xml component."
find_package(Qt${QT_MAJOR_VERSION}Xml ${REQUIRED_QT_VERSION} CONFIG QUIET)
set_package_properties(Qt${QT_MAJOR_VERSION}Xml PROPERTIES
DESCRIPTION "Qt${QT_MAJOR_VERSION} Xml component."
TYPE REQUIRED
)
find_package(Qt5Concurrent ${REQUIRED_QT_VERSION} CONFIG QUIET)
set_package_properties(Qt5Concurrent PROPERTIES
DESCRIPTION "Qt5 Concurrent component."
find_package(Qt${QT_MAJOR_VERSION}Concurrent ${REQUIRED_QT_VERSION} CONFIG QUIET)
set_package_properties(Qt${QT_MAJOR_VERSION}Concurrent PROPERTIES
DESCRIPTION "Qt${QT_MAJOR_VERSION} Concurrent component."
TYPE REQUIRED
)
find_package(Qt5QuickWidgets ${REQUIRED_QT_VERSION} CONFIG QUIET)
set_package_properties(Qt5QuickWidgets PROPERTIES
find_package(Qt${QT_MAJOR_VERSION}QuickWidgets ${REQUIRED_QT_VERSION} CONFIG QUIET)
set_package_properties(Qt${QT_MAJOR_VERSION}QuickWidgets PROPERTIES
DESCRIPTION "Qt5 QuickWidgets component."
TYPE REQUIRED
)
find_package(Qt5WebEngineWidgets ${REQUIRED_QT_VERSION} CONFIG QUIET)
find_package(Qt${QT_MAJOR_VERSION}WebEngineWidgets ${REQUIRED_QT_VERSION} CONFIG QUIET)
if(NOT BUILD_WITH_WEBENGINE)
set_package_properties(Qt5WebEngineWidgets PROPERTIES
DESCRIPTION "Qt5 WebEngineWidgets component."
set_package_properties(Qt${QT_MAJOR_VERSION}WebEngineWidgets PROPERTIES
DESCRIPTION "Qt${QT_MAJOR_VERSION} WebEngineWidgets component."
TYPE RECOMMENDED
)
else()
set_package_properties(Qt5WebEngineWidgets PROPERTIES
DESCRIPTION "Qt5 WebEngineWidgets component."
set_package_properties(Qt${QT_MAJOR_VERSION}WebEngineWidgets PROPERTIES
DESCRIPTION "Qt${QT_MAJOR_VERSION} WebEngineWidgets component."
TYPE REQUIRED
)
endif()
find_package(Qt5WebEngine ${REQUIRED_QT_VERSION} CONFIG QUIET)
if(NOT BUILD_WITH_WEBENGINE)
set_package_properties(Qt5WebEngine PROPERTIES
DESCRIPTION "Qt5 WebEngine component."
TYPE RECOMMENDED
)
else()
set_package_properties(Qt5WebEngine PROPERTIES
DESCRIPTION "Qt5 WebEngine component."
TYPE REQUIRED
)
if (${QT_MAJOR_VERSION} STREQUAL "5")
find_package(Qt${QT_MAJOR_VERSION}WebEngine ${REQUIRED_QT_VERSION} CONFIG QUIET)
if(APPLE)
set_package_properties(Qt${QT_MAJOR_VERSION}WebEngine PROPERTIES
DESCRIPTION "Qt${QT_MAJOR_VERSION} WebEngine component."
TYPE RECOMMENDED
)
else()
set_package_properties(Qt${QT_MAJOR_VERSION}WebEngine PROPERTIES
DESCRIPTION "Qt${QT_MAJOR_VERSION} WebEngine component."
TYPE REQUIRED
)
endif()
endif()
if(BUILD_WITH_WEBENGINE AND Qt5WebEngine_FOUND AND Qt5WebEngineWidgets_FOUND)
if(Qt${QT_MAJOR_VERSION}WebEngine_FOUND AND Qt${QT_MAJOR_VERSION}WebEngineWidgets_FOUND)
add_compile_definitions(WITH_WEBENGINE=1)
endif()
get_target_property (QT_QMAKE_EXECUTABLE Qt5::qmake IMPORTED_LOCATION)
message(STATUS "Using Qt ${Qt5Core_VERSION} (${QT_QMAKE_EXECUTABLE})")
get_target_property (QT_QMAKE_EXECUTABLE Qt::qmake IMPORTED_LOCATION)
message(STATUS "Using Qt ${Qt${QT_MAJOR_VERSION}Core_VERSION} (${QT_QMAKE_EXECUTABLE})")
if(NOT TOKEN_AUTH_ONLY)
find_package(Qt5Keychain REQUIRED)
find_package(Qt${QT_MAJOR_VERSION}Keychain REQUIRED)
endif()
# TODO: Mingw64 7.3 might also need to be excluded here as it seems to not automatically link libssp

Просмотреть файл

@ -10,8 +10,8 @@ add_library(cmdCore STATIC
target_link_libraries(cmdCore
PUBLIC
Nextcloud::sync
Qt5::Core
Qt5::Network
Qt::Core
Qt::Network
)
# Need tokenizer for netrc parser

Просмотреть файл

@ -24,14 +24,14 @@ if(NOT BUILD_LIBRARIES_ONLY)
${crashreporter_RC_RCC}
)
find_package(Qt5 REQUIRED COMPONENTS Widgets)
find_package(Qt${QT_MAJOR_VERSION} REQUIRED COMPONENTS Widgets)
target_include_directories(${CRASHREPORTER_EXECUTABLE} PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
set_target_properties(${CRASHREPORTER_EXECUTABLE} PROPERTIES AUTOMOC ON)
set_target_properties(${CRASHREPORTER_EXECUTABLE} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${BIN_OUTPUT_DIRECTORY} )
target_link_libraries(${CRASHREPORTER_EXECUTABLE}
crashreporter-gui
Qt5::Core Qt5::Widgets
Qt::Core Qt::Widgets
)
if(BUILD_OWNCLOUD_OSX_BUNDLE)
@ -48,7 +48,7 @@ if(NOT BUILD_LIBRARIES_ONLY)
# currently it needs to be done because the code right above needs to be executed no matter
# if building a bundle or not and the install_qt4_executable needs to be called afterwards
if(BUILD_OWNCLOUD_OSX_BUNDLE)
get_target_property (QT_QMAKE_EXECUTABLE Qt5::qmake IMPORTED_LOCATION)
get_target_property (QT_QMAKE_EXECUTABLE Qt::qmake IMPORTED_LOCATION)
get_filename_component(QT_BIN_DIR "${QT_QMAKE_EXECUTABLE}" DIRECTORY)
find_program(MACDEPLOYQT_EXECUTABLE macdeployqt HINTS "${QT_BIN_DIR}")

Просмотреть файл

@ -72,7 +72,7 @@ generate_export_header(nextcloud_csync
target_link_libraries(nextcloud_csync
PUBLIC
${CSYNC_REQUIRED_LIBRARIES}
Qt5::Core Qt5::Concurrent
Qt::Core Qt::Concurrent
)
if(ZLIB_FOUND)

Просмотреть файл

@ -1,17 +1,21 @@
project(gui)
find_package(Qt5 REQUIRED COMPONENTS Widgets Svg Qml Quick QuickControls2 QuickWidgets Xml Network)
find_package(Qt${QT_MAJOR_VERSION} REQUIRED COMPONENTS Widgets Svg Qml Quick QuickControls2 QuickWidgets Xml Network)
find_package(KF5Archive REQUIRED)
find_package(KF5GuiAddons)
if(QUICK_COMPILER)
find_package(Qt5QuickCompiler)
if (${QT_MAJOR_VERSION} STREQUAL "6")
else()
set(REQUIRED_QT_VERSION "5.15.0")
find_package(Qt${QT_MAJOR_VERSION} ${REQUIRED_QT_VERSION} CONFIG REQUIRED QuickCompiler)
set_package_properties(Qt5QuickCompiler PROPERTIES
DESCRIPTION "Compile QML at build time"
TYPE REQUIRED
)
endif()
endif()
if (NOT TARGET Qt5::GuiPrivate)
if (NOT TARGET Qt::GuiPrivate)
message(FATAL_ERROR "Could not find GuiPrivate component of Qt5. It might be shipped as a separate package, please check that.")
endif()
@ -55,7 +59,7 @@ set(client_UI_SRCS
wizard/welcomepage.ui
)
if(QUICK_COMPILER)
if(Qt5QuickCompiler_FOUND)
qtquick_compiler_add_resources(client_UI_SRCS ../../resources.qrc ${CMAKE_SOURCE_DIR}/theme.qrc)
else()
qt_add_resources(client_UI_SRCS ../../resources.qrc ${CMAKE_SOURCE_DIR}/theme.qrc)
@ -261,7 +265,7 @@ set(client_SRCS
wizard/linklabel.cpp
)
if (Qt5WebEngine_FOUND AND Qt5WebEngineWidgets_FOUND)
if (Qt${QT_MAJOR_VERSION}WebEngine_FOUND AND Qt${QT_MAJOR_VERSION}WebEngineWidgets_FOUND)
list(APPEND client_SRCS
wizard/webviewpage.h
wizard/webviewpage.cpp
@ -377,9 +381,9 @@ else()
set_property(SOURCE ../3rdparty/qtlockedfile/qtlockedfile_win.cpp PROPERTY SKIP_UNITY_BUILD_INCLUSION ON)
endif()
find_package(Qt5LinguistTools)
if(Qt5LinguistTools_FOUND)
qt5_add_translation(client_I18N ${TRANSLATIONS})
find_package(Qt6 COMPONENTS LinguistTools)
if(Qt${QT_MAJOR_VERSION}LinguistTools_FOUND)
qt_add_translation(client_I18N ${TRANSLATIONS})
endif()
IF( WIN32 )
@ -402,7 +406,7 @@ set( final_src
${3rdparty_MOC}
)
if(Qt5Keychain_FOUND)
if(Qt${QT_MAJOR_VERSION}Keychain_FOUND)
list(APPEND libsync_LINK_TARGETS qt5keychain)
endif()
@ -556,15 +560,15 @@ add_library(nextcloudCore STATIC ${final_src})
target_link_libraries(nextcloudCore
PUBLIC
Nextcloud::sync
Qt5::Widgets
Qt5::GuiPrivate
Qt5::Svg
Qt5::Network
Qt5::Xml
Qt5::Qml
Qt5::Quick
Qt5::QuickControls2
Qt5::QuickWidgets
Qt::Widgets
Qt::GuiPrivate
Qt::Svg
Qt::Network
Qt::Xml
Qt::Qml
Qt::Quick
Qt::QuickControls2
Qt::QuickWidgets
KF5::Archive
)
@ -589,7 +593,7 @@ foreach(FILE IN LISTS client_UI_SRCS)
endforeach()
if(Qt5WebEngine_FOUND AND Qt5WebEngineWidgets_FOUND)
target_link_libraries(nextcloudCore PUBLIC Qt5::WebEngineWidgets)
target_link_libraries(nextcloudCore PUBLIC Qt::WebEngineWidgets)
endif()
set_target_properties(nextcloudCore
@ -647,7 +651,7 @@ else()
set (QM_DIR ${OWNCLOUD_OSX_BUNDLE}/Contents/Resources/Translations)
install(FILES ${client_I18N} DESTINATION ${QM_DIR})
get_target_property(_qmake Qt5::qmake LOCATION)
get_target_property(_qmake Qt::qmake LOCATION)
execute_process(COMMAND ${_qmake} -query QT_INSTALL_TRANSLATIONS
OUTPUT_VARIABLE QT_TRANSLATIONS_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE
@ -662,7 +666,7 @@ endif()
IF(BUILD_UPDATER)
add_library(updater STATIC ${updater_SRCS})
target_link_libraries(updater Nextcloud::sync ${updater_DEPS} Qt5::Widgets Qt5::Svg Qt5::Network Qt5::Xml)
target_link_libraries(updater Nextcloud::sync ${updater_DEPS} Qt::Widgets Qt::Svg Qt::Network Qt::Xml)
target_include_directories(updater PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
set_target_properties(updater PROPERTIES AUTOMOC ON)
target_link_libraries(nextcloudCore PUBLIC updater)
@ -705,20 +709,25 @@ endif()
## handle DBUS for Fdo notifications
if( UNIX AND NOT APPLE )
find_package(Qt5 COMPONENTS DBus)
target_link_libraries(nextcloudCore PUBLIC Qt5::DBus)
if (Qt6_FOUND)
find_package(Qt6 COMPONENTS DBus)
else()
set(REQUIRED_QT_VERSION "5.15.0")
find_package(Qt5 ${REQUIRED_QT_VERSION} COMPONENTS DBus)
endif()
target_link_libraries(nextcloudCore PUBLIC Qt::DBus)
target_compile_definitions(nextcloudCore PUBLIC "USE_FDO_NOTIFICATIONS")
endif()
if (APPLE)
find_package(Qt5 COMPONENTS MacExtras)
find_package(Qt${QT_MAJOR_VERSION} COMPONENTS MacExtras)
if (BUILD_FILE_PROVIDER_MODULE)
target_link_libraries(nextcloudCore PUBLIC Qt5::MacExtras "-framework UserNotifications -framework FileProvider")
target_link_libraries(nextcloudCore PUBLIC Qt::MacExtras "-framework UserNotifications -framework FileProvider")
elseif(CMAKE_OSX_DEPLOYMENT_TARGET VERSION_GREATER_EQUAL 10.14)
target_link_libraries(nextcloudCore PUBLIC Qt5::MacExtras "-framework UserNotifications")
target_link_libraries(nextcloudCore PUBLIC Qt::MacExtras "-framework UserNotifications")
else()
target_link_libraries(nextcloudCore PUBLIC Qt5::MacExtras)
target_link_libraries(nextcloudCore PUBLIC Qt::MacExtras)
endif()
endif()
@ -746,7 +755,7 @@ install(TARGETS nextcloud
#
# OSX: Run macdeployqt for src/gui and for src/cmd using the -executable option
if(BUILD_OWNCLOUD_OSX_BUNDLE AND NOT BUILD_LIBRARIES_ONLY)
get_target_property (QT_QMAKE_EXECUTABLE Qt5::qmake IMPORTED_LOCATION)
get_target_property (QT_QMAKE_EXECUTABLE Qt::qmake IMPORTED_LOCATION)
get_filename_component(QT_BIN_DIR "${QT_QMAKE_EXECUTABLE}" DIRECTORY)
find_program(MACDEPLOYQT_EXECUTABLE macdeployqt HINTS "${QT_BIN_DIR}")

Просмотреть файл

@ -195,7 +195,7 @@ IF (NOT APPLE)
)
ENDIF(NOT APPLE)
find_package(Qt5 REQUIRED COMPONENTS WebSockets Xml Sql)
find_package(Qt${QT_MAJOR_VERSION} REQUIRED COMPONENTS WebSockets Xml Sql)
add_library(nextcloudsync SHARED ${libsync_SRCS})
add_library(Nextcloud::sync ALIAS nextcloudsync)
@ -206,11 +206,11 @@ target_link_libraries(nextcloudsync
OpenSSL::Crypto
OpenSSL::SSL
${OS_SPECIFIC_LINK_LIBRARIES}
Qt5::Core
Qt5::Network
Qt5::WebSockets
Qt5::Xml
Qt5::Sql
Qt::Core
Qt::Network
Qt::WebSockets
Qt::Xml
Qt::Sql
KF5::Archive
)
@ -225,7 +225,8 @@ find_package(Qt5 REQUIRED COMPONENTS Gui Widgets Svg)
target_link_libraries(nextcloudsync PUBLIC Qt5::Gui Qt5::Widgets Qt5::Svg)
if (NOT TOKEN_AUTH_ONLY)
target_link_libraries(nextcloudsync PUBLIC qt5keychain)
find_package(Qt${QT_MAJOR_VERSION} COMPONENTS REQUIRED Widgets Svg)
target_link_libraries(nextcloudsync PUBLIC Qt::Widgets Qt::Svg qt5keychain)
endif()
if(Inotify_FOUND)

Просмотреть файл

@ -185,7 +185,7 @@ endif()
add_dependencies(CfApiShellExtensions CustomStateProviderImpl)
target_link_libraries(CfApiShellExtensions shlwapi Gdiplus onecoreuap Nextcloud::csync Qt5::Core Qt5::Network)
target_link_libraries(CfApiShellExtensions shlwapi Gdiplus onecoreuap Nextcloud::csync Qt::Core Qt::Network)
target_include_directories(CfApiShellExtensions PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_include_directories(CfApiShellExtensions PRIVATE ${GeneratedFilesPath})

Просмотреть файл

@ -15,7 +15,7 @@ add_library(testutils
activitylistmodeltestutils.cpp
)
target_link_libraries(testutils PUBLIC Nextcloud::sync Qt5::Test)
target_link_libraries(testutils PUBLIC Nextcloud::sync Qt::Test)
target_include_directories(testutils PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
set_target_properties(testutils PROPERTIES FOLDER Tests)

Просмотреть файл

@ -14,7 +14,7 @@ include_directories(
add_library(${TORTURE_LIBRARY} STATIC torture.c cmdline.c)
target_link_libraries(${TORTURE_LIBRARY} ${CMOCKA_LIBRARIES})
set(TEST_TARGET_LIBRARIES ${TORTURE_LIBRARY} Qt5::Core Nextcloud::csync)
set(TEST_TARGET_LIBRARIES ${TORTURE_LIBRARY} Qt::Core Nextcloud::csync)
# create tests

Просмотреть файл

@ -1,4 +1,9 @@
find_package(Qt5 COMPONENTS Core Test Xml Network Qml Quick REQUIRED)
if (Qt6_FOUND)
find_package(Qt6 COMPONENTS REQUIRED Core Test Xml Network Qml Quick)
else()
set(REQUIRED_QT_VERSION "5.15.0")
find_package(Qt5 ${REQUIRED_QT_VERSION} COMPONENTS REQUIRED Core Test Xml Network Qml Quick)
endif()
macro(nextcloud_build_test test_class)
set(CMAKE_AUTOMOC TRUE)
@ -13,8 +18,8 @@ macro(nextcloud_build_test test_class)
testutils
nextcloudCore
cmdCore
Qt5::Test
Qt5::Quick
Qt::Test
Qt::Quick
)
if (WIN32)
@ -50,8 +55,8 @@ macro(nextcloud_add_test test_class)
testutils
nextcloudCore
cmdCore
Qt5::Test
Qt5::Quick
Qt::Test
Qt::Quick
)
if (WIN32)
@ -99,10 +104,10 @@ macro(nextcloud_add_benchmark test_class)
testutils
nextcloudCore
cmdCore
Qt5::Core
Qt5::Test
Qt5::Xml
Qt5::Network
Qt::Core
Qt::Test
Qt::Xml
Qt::Network
)
IF(BUILD_UPDATER)