Commit 854e4d35 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Change build system for building against qt6

parent 1f6bd7a1
Pipeline #121301 passed with stage
in 7 minutes and 57 seconds
......@@ -57,13 +57,13 @@ ecm_setup_version(PROJECT
SOVERSION 5)
# Find packages
find_package(Qt5Core ${QT_REQUIRED_VERSION} REQUIRED COMPONENTS Private)
find_package(Qt5Sql ${QT_REQUIRED_VERSION} REQUIRED COMPONENTS Private)
find_package(Qt5DBus ${QT_REQUIRED_VERSION} REQUIRED)
find_package(Qt5Network ${QT_REQUIRED_VERSION} REQUIRED)
find_package(Qt5Test ${QT_REQUIRED_VERSION} REQUIRED)
find_package(Qt5Widgets ${QT_REQUIRED_VERSION} REQUIRED)
find_package(Qt5Xml ${QT_REQUIRED_VERSION} REQUIRED)
find_package(Qt${QT_MAJOR_VERSION}Core ${QT_REQUIRED_VERSION} REQUIRED COMPONENTS Private)
find_package(Qt${QT_MAJOR_VERSION}Sql ${QT_REQUIRED_VERSION} REQUIRED COMPONENTS Private)
find_package(Qt${QT_MAJOR_VERSION}DBus ${QT_REQUIRED_VERSION} REQUIRED)
find_package(Qt${QT_MAJOR_VERSION}Network ${QT_REQUIRED_VERSION} REQUIRED)
find_package(Qt${QT_MAJOR_VERSION}Test ${QT_REQUIRED_VERSION} REQUIRED)
find_package(Qt${QT_MAJOR_VERSION}Widgets ${QT_REQUIRED_VERSION} REQUIRED)
find_package(Qt${QT_MAJOR_VERSION}Xml ${QT_REQUIRED_VERSION} REQUIRED)
find_package(KF5Config ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5ConfigWidgets ${KF5_MIN_VERSION} CONFIG REQUIRED)
......@@ -77,7 +77,7 @@ find_package(KF5WidgetsAddons ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5WindowSystem ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5XmlGui ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5Crash ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(Qt5Designer NO_MODULE)
find_package(Qt${QT_MAJOR_VERSION}Designer NO_MODULE)
set_package_properties(Qt5Designer PROPERTIES
PURPOSE "Required to build the Qt Designer plugins"
TYPE OPTIONAL
......@@ -85,6 +85,9 @@ set_package_properties(Qt5Designer PROPERTIES
option(BUILD_DESIGNERPLUGIN "Build plugin for Qt Designer" ON)
add_feature_info(DESIGNERPLUGIN ${BUILD_DESIGNERPLUGIN} "Build plugin for Qt Designer")
if (QT_MAJOR_VERSION STREQUAL "6")
find_package(Qt6Core5Compat)
endif()
set(AccountsQt5_MINIMUM_VERSION "1.16")
find_package(AccountsQt5 ${AccountsQt5_MINIMUM_VERSION})
......@@ -128,10 +131,10 @@ ecm_setup_qtplugin_macro_names(
# Make sure the KF5Akonadi_DATA_DIR is absolute before passing it to KF5AkonadiConfig.cmake.in
# otherwise build fails either on OSX CI, or for normal users
if (IS_ABSOLUTE "${KDE_INSTALL_DATADIR_KF5}")
set(KF5Akonadi_DATA_DIR "${KDE_INSTALL_DATADIR_KF5}/akonadi")
if (IS_ABSOLUTE "${KDE_INSTALL_DATADIR_KF}")
set(KF5Akonadi_DATA_DIR "${KDE_INSTALL_DATADIR_KF}/akonadi")
else()
set(KF5Akonadi_DATA_DIR "${CMAKE_INSTALL_PREFIX}/${KDE_INSTALL_DATADIR_KF5}/akonadi")
set(KF5Akonadi_DATA_DIR "${CMAKE_INSTALL_PREFIX}/${KDE_INSTALL_DATADIR_KF}/akonadi")
endif()
check_symbol_exists(malloc_trim "malloc.h" HAVE_MALLOC_TRIM)
......@@ -225,10 +228,10 @@ else()
set(AKONADI_DBUS_INTERFACES_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${DBUS_INTERFACES_INSTALL_DIR}")
endif()
if (IS_ABSOLUTE "${KDE_INSTALL_INCLUDEDIR_KF5}")
set(AKONADI_INCLUDE_DIR "${KDE_INSTALL_INCLUDEDIR_KF5}")
if (IS_ABSOLUTE "${KDE_INSTALL_INCLUDEDIR_KF}")
set(AKONADI_INCLUDE_DIR "${KDE_INSTALL_INCLUDEDIR_KF}")
else()
set(AKONADI_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/${KDE_INSTALL_INCLUDEDIR_KF5}")
set(AKONADI_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/${KDE_INSTALL_INCLUDEDIR_KF}")
endif()
############### Build Options ###############
......@@ -376,7 +379,7 @@ ecm_qt_install_logging_categories(
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/akonadi_version.h
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5} COMPONENT Devel
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF} COMPONENT Devel
)
kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)
......
......@@ -23,8 +23,8 @@ function(add_akonadi_isolated_test)
add_executable(${_name} ${_test} ${CONFIG_ADDITIONAL_SOURCES})
ecm_mark_as_test(${_name})
target_link_libraries(${_name}
Qt::Test Qt::Gui Qt::Widgets Qt::Network KF5::KIOCore
KF5::AkonadiCore KF5::AkonadiPrivate Qt::DBus
Qt${QT_MAJOR_VERSION}::Test Qt${QT_MAJOR_VERSION}::Gui Qt${QT_MAJOR_VERSION}::Widgets Qt${QT_MAJOR_VERSION}::Network KF5::KIOCore
KF5::AkonadiCore KF5::AkonadiPrivate Qt${QT_MAJOR_VERSION}::DBus
${CONFIG_LINK_LIBRARIES}
)
......
find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Test DBus)
find_package(Qt${QT_MAJOR_VERSION} ${QT_REQUIRED_VERSION} CONFIG REQUIRED Test DBus)
if(${EXECUTABLE_OUTPUT_PATH})
set(PREVIOUS_EXEC_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH})
......@@ -22,7 +22,7 @@ macro(add_akonadi_test _source)
get_filename_component(_name ${_source} NAME_WE)
ecm_add_test(TEST_NAME ${_name} ${_test})
set_tests_properties(${_name} PROPERTIES ENVIRONMENT "QT_HASH_SEED=1;QT_NO_CPU_FEATURE=sse4.2")
target_link_libraries(${_name} akonaditestfake Qt::Test KF5::AkonadiPrivate KF5::I18n)
target_link_libraries(${_name} akonaditestfake Qt${QT_MAJOR_VERSION}::Test KF5::AkonadiPrivate KF5::I18n)
endmacro()
# convenience macro to add akonadi qtestlib unit-tests
......@@ -35,7 +35,7 @@ macro(add_akonadi_test_widgets _source)
get_filename_component(_name ${_source} NAME_WE)
ecm_add_test(TEST_NAME ${_name} ${_test})
set_tests_properties(${_name} PROPERTIES ENVIRONMENT "QT_HASH_SEED=1;QT_NO_CPU_FEATURE=sse4.2")
target_link_libraries(${_name} akonaditestfake Qt::Test KF5::AkonadiWidgets KF5::AkonadiPrivate)
target_link_libraries(${_name} akonaditestfake Qt${QT_MAJOR_VERSION}::Test KF5::AkonadiWidgets KF5::AkonadiPrivate)
endmacro()
include(../KF5AkonadiMacros.cmake)
......
......@@ -18,7 +18,7 @@ macro(add_unit_test _source)
target_link_libraries(${_name}
akonadi_shared
KF5AkonadiPrivate
Qt::Test
Qt${QT_MAJOR_VERSION}::Test
KF5::ConfigCore
${CMAKE_EXE_LINKER_FLAGS_ASAN}
)
......
......@@ -26,11 +26,11 @@ add_library(akonaditestfake SHARED
generate_export_header(akonaditestfake BASE_NAME akonaditestfake)
target_link_libraries(akonaditestfake
Qt::DBus
Qt${QT_MAJOR_VERSION}::DBus
KF5::AkonadiCore
Qt::Test
Qt::Widgets
Qt::Network
Qt${QT_MAJOR_VERSION}::Test
Qt${QT_MAJOR_VERSION}::Widgets
Qt${QT_MAJOR_VERSION}::Network
KF5::AkonadiPrivate
akonadi_shared
)
......@@ -40,7 +40,7 @@ add_executable(akonadi-firstrun
firstrunner.cpp
${CMAKE_BINARY_DIR}/src/core/akonadicore_debug.cpp
)
target_link_libraries( akonadi-firstrun Qt::Test Qt::Core KF5::AkonadiCore KF5::AkonadiPrivate KF5::ConfigCore Qt::Widgets)
target_link_libraries( akonadi-firstrun Qt${QT_MAJOR_VERSION}::Test Qt${QT_MAJOR_VERSION}::Core KF5::AkonadiCore KF5::AkonadiPrivate KF5::ConfigCore Qt${QT_MAJOR_VERSION}::Widgets)
add_akonadi_test(itemhydratest.cpp)
add_akonadi_test(itemtest.cpp)
......@@ -69,7 +69,7 @@ add_akonadi_test(cachepolicytest.cpp)
#add_executable( resourceschedulertest resourceschedulertest.cpp ../src/agentbase/resourcescheduler.cpp )
#add_test( resourceschedulertest resourceschedulertest )
#ecm_mark_as_test(akonadi-resourceschedulertest)
#target_link_libraries(resourceschedulertest Qt::Test KF5::AkonadiAgentBase)
#target_link_libraries(resourceschedulertest Qt${QT_MAJOR_VERSION}::Test KF5::AkonadiAgentBase)
# testrunner tests
......
......@@ -29,10 +29,10 @@ target_link_libraries(akonadi_knut_resource
KF5::AkonadiCore
KF5::KIOCore
KF5::AkonadiAgentBase
Qt::Xml
Qt${QT_MAJOR_VERSION}::Xml
KF5::I18n
)
install( TARGETS akonadi_knut_resource ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})
install( FILES knutresource.desktop DESTINATION "${KDE_INSTALL_DATAROOTDIR}/akonadi/agents" )
install( FILES knut-template.xml DESTINATION ${KDE_INSTALL_DATADIR_KF5}/akonadi_knut_resource/ )
install( FILES knut-template.xml DESTINATION ${KDE_INSTALL_DATADIR_KF}/akonadi_knut_resource/ )
......@@ -17,9 +17,9 @@ target_link_libraries(akonaditest
KF5::AkonadiCore
KF5::I18n
KF5::ConfigCore
Qt::Xml
Qt::DBus
Qt::Widgets
Qt${QT_MAJOR_VERSION}::Xml
Qt${QT_MAJOR_VERSION}::DBus
Qt${QT_MAJOR_VERSION}::Widgets
)
install(TARGETS akonaditest ${KF5_INSTALL_TARGETS_DEFAULT_ARGS})
......
......@@ -12,9 +12,9 @@ macro(add_unit_test _source)
target_link_libraries(${_name}
akonadi_shared
akonadiprivate_static
Qt::Network
Qt::Widgets
Qt::Test
Qt${QT_MAJOR_VERSION}::Network
Qt${QT_MAJOR_VERSION}::Widgets
Qt${QT_MAJOR_VERSION}::Test
${CMAKE_EXE_LINKER_FLAGS_ASAN}
)
endmacro()
......
......@@ -47,11 +47,11 @@ target_sources(akonadi_unittest_common PRIVATE
target_link_libraries(akonadi_unittest_common
KF5AkonadiPrivate
libakonadiserver
Qt::Core
Qt::DBus
Qt::Test
Qt::Sql
Qt::Network
Qt${QT_MAJOR_VERSION}::Core
Qt${QT_MAJOR_VERSION}::DBus
Qt${QT_MAJOR_VERSION}::Test
Qt${QT_MAJOR_VERSION}::Sql
Qt${QT_MAJOR_VERSION}::Network
)
macro(add_server_test _source)
......@@ -71,11 +71,11 @@ macro(add_server_test _source)
akonadi_unittest_common
libakonadiserver
KF5AkonadiPrivate
Qt::Core
Qt::DBus
Qt::Test
Qt::Sql
Qt::Network
Qt${QT_MAJOR_VERSION}::Core
Qt${QT_MAJOR_VERSION}::DBus
Qt${QT_MAJOR_VERSION}::Test
Qt${QT_MAJOR_VERSION}::Sql
Qt${QT_MAJOR_VERSION}::Network
${CMAKE_SHARED_LINKER_FLAGS_ASAN}
)
endmacro()
......
......@@ -11,7 +11,7 @@ macro(add_unit_test _source)
endif()
target_link_libraries(${_name}
akonadi_shared
Qt::Test
Qt${QT_MAJOR_VERSION}::Test
${CMAKE_EXE_LINKER_FLAGS_ASAN}
)
endmacro()
......
......@@ -11,4 +11,4 @@ set(icons
sc-apps-akonadi.svgz
)
ecm_install_icons(ICONS ${icons} DESTINATION ${ICON_INSTALL_DIR})
ecm_install_icons(ICONS ${icons} DESTINATION ${KDE_INSTALL_ICONDIR})
# base install include dir
set(AkonadiAgentBase_INSTALL_INCLUDEDIR "${KDE_INSTALL_INCLUDEDIR_KF5}/AkonadiAgentBase")
set(AkonadiAgentBase_INSTALL_INCLUDEDIR "${KDE_INSTALL_INCLUDEDIR_KF}/AkonadiAgentBase")
add_library(KF5AkonadiAgentBase)
add_library(KF5::AkonadiAgentBase ALIAS KF5AkonadiAgentBase)
......@@ -80,8 +80,8 @@ target_include_directories(KF5AkonadiAgentBase INTERFACE "$<INSTALL_INTERFACE:${
target_link_libraries(KF5AkonadiAgentBase
PUBLIC
Qt::DBus
Qt::Widgets # for QApplication
Qt${QT_MAJOR_VERSION}::DBus
Qt${QT_MAJOR_VERSION}::Widgets # for QApplication
KF5::AkonadiCore
KF5::ConfigCore
KF5::ConfigGui # for KConfigSkeleton
......@@ -89,7 +89,7 @@ PRIVATE
KF5::AkonadiPrivate
KF5::AkonadiWidgets
KF5::I18n
Qt::Network
Qt${QT_MAJOR_VERSION}::Network
akonadi_shared
)
......
......@@ -26,8 +26,8 @@ set_target_properties(akonadi_agent_server PROPERTIES MACOSX_BUNDLE FALSE)
target_link_libraries(akonadi_agent_server
akonadi_shared
KF5AkonadiPrivate
Qt::Core
Qt::DBus
Qt${QT_MAJOR_VERSION}::Core
Qt${QT_MAJOR_VERSION}::DBus
)
# Agent plugin launcher
......@@ -48,8 +48,8 @@ set_target_properties(akonadi_agent_launcher PROPERTIES MACOSX_BUNDLE FALSE)
target_link_libraries(akonadi_agent_launcher
akonadi_shared
KF5AkonadiPrivate
Qt::Core
Qt::Widgets
Qt${QT_MAJOR_VERSION}::Core
Qt${QT_MAJOR_VERSION}::Widgets
)
# Install both helper apps.
......
......@@ -65,15 +65,15 @@ target_link_libraries(akonadi_control
KF5AkonadiPrivate
KF5::CoreAddons
KF5::ConfigCore
Qt::Core
Qt::DBus
Qt::Gui
Qt${QT_MAJOR_VERSION}::Core
Qt${QT_MAJOR_VERSION}::DBus
Qt${QT_MAJOR_VERSION}::Gui
)
if (WITH_ACCOUNTS)
target_include_directories(akonadi_control PRIVATE ${ACCOUNTSQT_INCLUDE_DIRS})
# We need Qt::Xml because the Accounts framework leaks QDocument includes into public interface
target_link_libraries(akonadi_control ${ACCOUNTSQT_LIBRARIES} Qt::Xml)
target_link_libraries(akonadi_control ${ACCOUNTSQT_LIBRARIES} Qt${QT_MAJOR_VERSION}::Xml)
endif()
install(TARGETS akonadi_control
......
......@@ -30,8 +30,8 @@ target_link_libraries(akonadictl
akonadi_shared
KF5AkonadiPrivate
KF5::CoreAddons
Qt::Core
Qt::DBus
Qt${QT_MAJOR_VERSION}::Core
Qt${QT_MAJOR_VERSION}::DBus
)
install(TARGETS akonadictl
......
......@@ -9,8 +9,8 @@ set_target_properties(asapcat PROPERTIES MACOSX_BUNDLE FALSE)
target_link_libraries(asapcat
akonadi_shared
KF5AkonadiPrivate
Qt::Core
Qt::Network
Qt${QT_MAJOR_VERSION}::Core
Qt${QT_MAJOR_VERSION}::Network
)
install(TARGETS asapcat
......
......@@ -10,7 +10,7 @@ endif()
configure_file(akonaditests_export.h.in "${CMAKE_CURRENT_BINARY_DIR}/akonaditests_export.h")
# base install include dir
set(AkonadiCore_INSTALL_INCLUDEDIR "${KDE_INSTALL_INCLUDEDIR_KF5}/AkonadiCore")
set(AkonadiCore_INSTALL_INCLUDEDIR "${KDE_INSTALL_INCLUDEDIR_KF}/AkonadiCore")
set(akonadicore_base_SRCS
agentconfigurationbase.cpp
......@@ -434,10 +434,10 @@ target_link_libraries(KF5AkonadiCore
PUBLIC
KF5::CoreAddons # for KJob
KF5::ItemModels
Qt::Gui # for QColor
Qt${QT_MAJOR_VERSION}::Gui # for QColor
PRIVATE
Qt::Network
Qt::Widgets
Qt${QT_MAJOR_VERSION}::Network
Qt${QT_MAJOR_VERSION}::Widgets
KF5::AkonadiPrivate
KF5::I18n
KF5::IconThemes
......@@ -493,7 +493,7 @@ install(FILES
install( FILES
kcfg2dbus.xsl
DESTINATION ${KDE_INSTALL_DATADIR_KF5}/akonadi
DESTINATION ${KDE_INSTALL_DATADIR_KF}/akonadi
)
......
......@@ -43,8 +43,8 @@ set(akonadiprivate_SRCS
set(akonadiprivate_LIBS
PUBLIC
Qt::Core
Qt::DBus
Qt${QT_MAJOR_VERSION}::Core
Qt${QT_MAJOR_VERSION}::DBus
PRIVATE
${LIBLZMA_LIBRARIES}
)
......@@ -52,7 +52,7 @@ if (WIN32)
set(akonadiprivate_LIBS
${akonadiprivate_LIBS}
PRIVATE
Qt::Network
Qt${QT_MAJOR_VERSION}::Network
)
endif()
......@@ -65,7 +65,7 @@ ecm_qt_declare_logging_category(akonadiprivate_SRCS HEADER akonadiprivate_debug.
macro(update_include_directories _target)
target_include_directories(${_target} PUBLIC "$<BUILD_INTERFACE:${Akonadi_SOURCE_DIR}/src/private;${Akonadi_BINARY_DIR}/src/private;${Akonadi_BINARY_DIR}/src>")
target_include_directories(${_target} PRIVATE "${Akonadi_SOURCE_DIR}/src/shared")
target_include_directories(${_target} PUBLIC "$<BUILD_INTERFACE:${Qt5Core_INCLUDE_DIRS};${Qt5DBus_INCLUDE_DIRS}>")
target_include_directories(${_target} PUBLIC "$<BUILD_INTERFACE:${Qt${QT_MAJOR_VERSION}Core_INCLUDE_DIRS};${Qt${QT_MAJOR_VERSION}DBus_INCLUDE_DIRS}>")
endmacro()
if (WIN32)
......@@ -120,7 +120,7 @@ install(FILES
scope_p.h
tristate_p.h
compressionstream_p.h
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/akonadi/private
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF}/akonadi/private
)
......
......@@ -17,5 +17,5 @@ target_sources(protocolgen PRIVATE
set_target_properties(protocolgen PROPERTIES MACOSX_BUNDLE FALSE)
target_link_libraries(protocolgen
Qt::Core
Qt${QT_MAJOR_VERSION}::Core
)
......@@ -10,8 +10,8 @@ set(QSQLITE_INSTALL_PREFIX "${KDE_INSTALL_PLUGINDIR}/sqldrivers")
# TODO KF6: Use Qt6::CorePrivate and Qt6::SqlPrivate
include_directories(
${Qt5Core_PRIVATE_INCLUDE_DIRS}
${Qt5Sql_PRIVATE_INCLUDE_DIRS}
${Qt${QT_MAJOR_VERSION}Core_PRIVATE_INCLUDE_DIRS}
${Qt${QT_MAJOR_VERSION}Sql_PRIVATE_INCLUDE_DIRS}
)
add_library(qsqlite3 SHARED ${QSqlite_SRCS} ${QSqlite_MOC_SRCS})
......@@ -19,8 +19,8 @@ add_library(qsqlite3 SHARED ${QSqlite_SRCS} ${QSqlite_MOC_SRCS})
set_target_properties(qsqlite3 PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/sqldrivers")
target_link_libraries(qsqlite3
Qt::Core
Qt::Sql
Qt${QT_MAJOR_VERSION}::Core
Qt${QT_MAJOR_VERSION}::Sql
Sqlite::Sqlite
)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment