From af8a7bad7d7504caaa94f55a59fcb72db86ab45b Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Tue, 22 Oct 2013 00:40:17 +0200 Subject: [PATCH] Stop using Qt5Transitional in Plasma Frameworks Removes the find_package(Qt5Transitional) and does the proper find_package(Qt5) with the list of modules. Most of the porting is about using the Qt5:: targets. REVIEW: 113345 --- CMakeLists.txt | 28 ++++--------------- examples/kpart/CMakeLists.txt | 4 +-- examples/runner/CMakeLists.txt | 2 +- .../calendar/CMakeLists.txt | 6 ++-- src/declarativeimports/calendar/calendar.cpp | 2 -- src/declarativeimports/core/CMakeLists.txt | 10 +++---- .../core/tests/CMakeLists.txt | 9 ++---- .../draganddrop/CMakeLists.txt | 9 +++--- src/declarativeimports/locale/CMakeLists.txt | 2 +- .../plasmacomponents/CMakeLists.txt | 4 +-- .../qtextracomponents/CMakeLists.txt | 4 +-- .../qtextracomponents/tests/CMakeLists.txt | 7 ++--- .../tests/columnproxymodeltest.cpp | 6 ++-- src/plasma/autotests/CMakeLists.txt | 12 ++++---- .../CMakeLists.txt | 2 +- src/platformstatus/CMakeLists.txt | 4 +-- src/scriptengines/javascript/CMakeLists.txt | 4 +-- 17 files changed, 46 insertions(+), 69 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e4a1d8256..033d1f71b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,26 +1,15 @@ - cmake_minimum_required(VERSION 2.8.11) -project(plasma) - -################# Disallow in-source build ################# - -if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") - message(FATAL_ERROR "plasma requires an out of source build. Please create a separate build directory and run 'cmake path_to_plasma [options]' there.") -endif() - +project(Plasma) # Make CPack available to easy generate binary packages include(CPack) - include(FeatureSummary) ################# set KDE specific information ################# find_package(ECM 0.0.8 REQUIRED NO_MODULE) - -# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH}) +set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0) @@ -47,17 +36,18 @@ endif() set (QT_MIN_VERSION "5.2.0") +find_package(Qt5 REQUIRED NO_MODULE COMPONENTS Quick X11Extras Sql UiTools Qml Widgets Svg Declarative Script Test) + # Load CMake, Compiler and InstallDirs settings from KF5 and the following are already somewhat "done" tier1/tier2 libs from kdelibs: find_package(KF5 MODULE REQUIRED COMPONENTS CMake Compiler InstallDirs KIdleTime ItemModels KWidgetsAddons KWindowSystem KCodecs KArchive KCoreAddons Solid ThreadWeaver KConfig KAuth KJS KWallet KDBusAddons KI18n KGuiAddons KConfigWidgets - KService ItemViews KNotifications KIconThemes KCompletion KJobWidgets KConfigWidgets Sonnet KTextWidgets XmlGui KCrash + KService ItemViews KNotifications KIconThemes KCompletion KJobWidgets KConfigWidgets Sonnet KTextWidgets XmlGui KCrash KDeclarative KBookmarks KUnitConversion KDE4Attic Kross) #find_package(KF5Transitional REQUIRED) # those are not "done" yet: find_package(KIO REQUIRED NO_MODULE) -find_package(KDeclarative REQUIRED NO_MODULE) # Needed for some includes from KDE/ (KMimeType, etc.) # FIXME: remove when kdeui is fully split up @@ -66,11 +56,6 @@ find_package(KDELibs4 REQUIRED NO_MODULE) # must be after KDELibs4, since it links against imported targets coming from KDELibs4Config.cmake: find_package(KDE4Support REQUIRED NO_MODULE) -find_package(Qt5Transitional MODULE REQUIRED) - -find_package(Qt5Quick REQUIRED NO_MODULE) -find_package(Qt5X11Extras REQUIRED NO_MODULE) - #optional features find_package(X11 MODULE) find_package(XCB MODULE COMPONENTS XCB COMPOSITE DAMAGE) @@ -136,7 +121,7 @@ set_package_properties(OpenGL PROPERTIES DESCRIPTION "The OpenGL libraries" TYPE OPTIONAL ) if(OPENGL_FOUND) - set(HAVE_GLX HAVE_X11) + set(HAVE_GLX ${HAVE_X11}) else() set(HAVE_GLX 0) endif() @@ -147,7 +132,6 @@ endif() add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS) add_definitions(-DQT_NO_URL_CAST_FROM_STRING) -remove_definitions(-DQT3_SUPPORT_WARNINGS -DQT3_SUPPORT) remove_definitions(-DQT_NO_CAST_FROM_ASCII -DQT_STRICT_ITERATORS -DQT_NO_CAST_FROM_BYTEARRAY -DQT_NO_KEYWORDS) if(QCA2_FOUND) diff --git a/examples/kpart/CMakeLists.txt b/examples/kpart/CMakeLists.txt index 94597a96f..177115e22 100644 --- a/examples/kpart/CMakeLists.txt +++ b/examples/kpart/CMakeLists.txt @@ -5,8 +5,8 @@ set(plasma_example_kpart_shell_SRCS appletselector.cpp ) -kde4_add_ui_files(plasma_example_kpart_shell_SRCS appletselector.ui) -kde4_add_executable(plasma-example-kpart-shell ${plasma_example_kpart_shell_SRCS}) +qt5_wrap_ui(plasma_example_kpart_shell_SRCS appletselector.ui) +add_executable(plasma-example-kpart-shell ${plasma_example_kpart_shell_SRCS}) target_link_libraries(plasma-example-kpart-shell ${KDE4_KDEUI_LIBS} ${KDE4_KPARTS_LIBS} KF5::Plasma ) diff --git a/examples/runner/CMakeLists.txt b/examples/runner/CMakeLists.txt index 3aaaedd97..ebac31967 100644 --- a/examples/runner/CMakeLists.txt +++ b/examples/runner/CMakeLists.txt @@ -5,7 +5,7 @@ project(RunnerExample) set(example_SRCS homefilesrunner.cpp) # Now make sure all files get to the right place -kde4_add_plugin(plasma_runner_example_homefiles ${example_SRCS}) +plasma_add_plugin(plasma_runner_example_homefiles ${example_SRCS}) target_link_libraries(plasma_runner_example_homefiles KF5::Plasma KF5::KIOCore KF5::KIOWidgets) # Install the library and .desktop file diff --git a/src/declarativeimports/calendar/CMakeLists.txt b/src/declarativeimports/calendar/CMakeLists.txt index c27b07662..46d9abaef 100644 --- a/src/declarativeimports/calendar/CMakeLists.txt +++ b/src/declarativeimports/calendar/CMakeLists.txt @@ -12,16 +12,14 @@ set(calendar_SRCS daysmodel.cpp ) -qt4_automoc(${calendar_SRCS}) - add_library(calendarplugin SHARED ${calendar_SRCS}) target_link_libraries(calendarplugin Qt5::Core ${Qt5Quick_LIBRARIES} ${Qt5Qml_LIBRARIES} - ${QT_QTGUI_LIBRARY} - ${QT_QTDECLARATIVE_LIBRARY} + Qt5::Gui + Qt5::Declarative ${KDEPIMLIBS_AKONADI_LIBS} ${KDEPIMLIBS_KCALCORE_LIBS} ${KDEPIMLIBS_AKONADI_CALENDAR_LIBS} diff --git a/src/declarativeimports/calendar/calendar.cpp b/src/declarativeimports/calendar/calendar.cpp index 38937511a..c674f70f6 100644 --- a/src/declarativeimports/calendar/calendar.cpp +++ b/src/declarativeimports/calendar/calendar.cpp @@ -1,6 +1,4 @@ #include -#include -#include #include "calendar.h" diff --git a/src/declarativeimports/core/CMakeLists.txt b/src/declarativeimports/core/CMakeLists.txt index 732f34810..ee8ee5da8 100644 --- a/src/declarativeimports/core/CMakeLists.txt +++ b/src/declarativeimports/core/CMakeLists.txt @@ -30,11 +30,11 @@ set(corebindings_SRCS add_library(corebindingsplugin SHARED ${corebindings_SRCS}) target_link_libraries(corebindingsplugin - ${QT_QTSCRIPT_LIBRARY} - ${Qt5Quick_LIBRARIES} - ${Qt5Qml_LIBRARIES} - ${KDeclarative_LIBRARIES} - ${KCore_LIBRARIES} + Qt5::Script + Qt5::Quick + Qt5::Qml + KF5::KDeclarative + KF5::KCoreAddons KF5::KIconThemes KF5::KWindowSystem Plasma) diff --git a/src/declarativeimports/core/tests/CMakeLists.txt b/src/declarativeimports/core/tests/CMakeLists.txt index 974e8bbfc..70eab1a32 100644 --- a/src/declarativeimports/core/tests/CMakeLists.txt +++ b/src/declarativeimports/core/tests/CMakeLists.txt @@ -11,12 +11,10 @@ add_executable(sortfiltermodeltest ${corebindings_SOURCE_DIR}/datasource.cpp ) -qt4_automoc(sortfiltermodeltest.cpp) - target_link_libraries(sortfiltermodeltest Plasma - ${QT_QTGUI_LIBRARY} - ${QT_QTTEST_LIBRARY} + Qt5::Gui + Qt5::Test ${KDE4Support_LIBRARIES} KF5::KI18n Qt5::Qml @@ -33,7 +31,6 @@ ecm_mark_as_test(sortfiltermodeltest) # ../runnermodel.cpp # ) -#qt4_automoc(${runnermodeltest_SRCS}) #add_executable(runnermodeltest ${runnermodeltest_SRCS}) -#target_link_libraries(runnermodeltest ${QT_QTTEST_LIBRARY} ${plasma_LIBRARIES} plasma) +#target_link_libraries(runnermodeltest Qt5::Test ${plasma_LIBRARIES} plasma) #ecm_mark_as_test(runnermodeltest) diff --git a/src/declarativeimports/draganddrop/CMakeLists.txt b/src/declarativeimports/draganddrop/CMakeLists.txt index fa1f7f53c..081419319 100644 --- a/src/declarativeimports/draganddrop/CMakeLists.txt +++ b/src/declarativeimports/draganddrop/CMakeLists.txt @@ -10,10 +10,11 @@ set(declarativedragdrop_SRCS add_library(draganddropplugin SHARED ${declarativedragdrop_SRCS}) target_link_libraries(draganddropplugin - ${QT_QTCORE_LIBRARY} - ${Qt5Quick_LIBRARIES} - ${Qt5Qml_LIBRARIES} - ${QT_QTGUI_LIBRARY} + Qt5::Core + Qt5::Quick + Qt5::Qml + Qt5::Gui + Qt5::Widgets ) install(TARGETS draganddropplugin DESTINATION ${QML_INSTALL_DIR}/org/kde/draganddrop) diff --git a/src/declarativeimports/locale/CMakeLists.txt b/src/declarativeimports/locale/CMakeLists.txt index 35d940761..2d78db724 100644 --- a/src/declarativeimports/locale/CMakeLists.txt +++ b/src/declarativeimports/locale/CMakeLists.txt @@ -16,7 +16,7 @@ set(localebindings_SRCS add_library(localebindingsplugin SHARED ${localebindings_SRCS}) target_link_libraries(localebindingsplugin - ${QT_QTCORE_LIBRARY} + Qt5::Core ${Qt5Quick_LIBRARIES} ${Qt5Qml_LIBRARIES} ${KCore_LIBRARIES} diff --git a/src/declarativeimports/plasmacomponents/CMakeLists.txt b/src/declarativeimports/plasmacomponents/CMakeLists.txt index 197fa6a2b..fcd3baf13 100644 --- a/src/declarativeimports/plasmacomponents/CMakeLists.txt +++ b/src/declarativeimports/plasmacomponents/CMakeLists.txt @@ -16,10 +16,10 @@ set(plasmacomponents_SRCS add_library(plasmacomponentsplugin SHARED ${plasmacomponents_SRCS}) target_link_libraries(plasmacomponentsplugin - ${QT_QTCORE_LIBRARY} + Qt5::Core ${Qt5Quick_LIBRARIES} ${Qt5Qml_LIBRARIES} - ${QT_QTGUI_LIBRARY} + Qt5::Gui ${KDeclarative_LIBRARIES} Plasma) diff --git a/src/declarativeimports/qtextracomponents/CMakeLists.txt b/src/declarativeimports/qtextracomponents/CMakeLists.txt index 3dfd41935..a2247abbc 100644 --- a/src/declarativeimports/qtextracomponents/CMakeLists.txt +++ b/src/declarativeimports/qtextracomponents/CMakeLists.txt @@ -14,10 +14,10 @@ set(qtextracomponents_SRCS add_library(qtextracomponentsplugin SHARED ${qtextracomponents_SRCS}) target_link_libraries(qtextracomponentsplugin - ${QT_QTCORE_LIBRARY} + Qt5::Core ${Qt5Quick_LIBRARIES} ${Qt5Qml_LIBRARIES} - ${QT_QTGUI_LIBRARY} + Qt5::Gui ${KDeclarative_LIBRARIES} KF5::KIconThemes Plasma) diff --git a/src/declarativeimports/qtextracomponents/tests/CMakeLists.txt b/src/declarativeimports/qtextracomponents/tests/CMakeLists.txt index 0799123cd..89fb10df8 100644 --- a/src/declarativeimports/qtextracomponents/tests/CMakeLists.txt +++ b/src/declarativeimports/qtextracomponents/tests/CMakeLists.txt @@ -4,10 +4,9 @@ include(ECMMarkAsTest) add_executable(fullmodelaccesstest columnproxymodeltest.cpp ../columnproxymodel.cpp ../../core/tests/modeltest.cpp) target_link_libraries(fullmodelaccesstest - ${QT_QTCORE_LIBRARY} - ${QT_QTGUI_LIBRARY} - ${QT_QTTEST_LIBRARY} - ${KCore_LIBRARIES} + Qt5::Gui + Qt5::Test + KF5::KCoreAddons ${KDE4Support_LIBRARIES} KF5::KI18n ) diff --git a/src/declarativeimports/qtextracomponents/tests/columnproxymodeltest.cpp b/src/declarativeimports/qtextracomponents/tests/columnproxymodeltest.cpp index 9e512b538..491bbee6c 100644 --- a/src/declarativeimports/qtextracomponents/tests/columnproxymodeltest.cpp +++ b/src/declarativeimports/qtextracomponents/tests/columnproxymodeltest.cpp @@ -19,11 +19,11 @@ #include <../tests/columnproxymodeltest.h> #include #include <../../core/tests/modeltest.h> - -#include +#include +#include #include -QTEST_KDEMAIN_CORE(ColumnProxyModelTest) +QTEST_MAIN(ColumnProxyModelTest) void ColumnProxyModelTest::testInit() { diff --git a/src/plasma/autotests/CMakeLists.txt b/src/plasma/autotests/CMakeLists.txt index 1b8dbd577..7863cf39e 100644 --- a/src/plasma/autotests/CMakeLists.txt +++ b/src/plasma/autotests/CMakeLists.txt @@ -9,14 +9,14 @@ find_package(KCoreAddons REQUIRED) MACRO(PLASMA_UNIT_TESTS) FOREACH(_testname ${ARGN}) add_executable(${_testname} ${_testname}.cpp) - target_link_libraries(${_testname} ${QT_QTTEST_LIBRARY} ${QT_QTDECLARATIVE_LIBRARY} + target_link_libraries(${_testname} Qt5::Test Qt5::Declarative Plasma KF5::KArchive KF5::KCoreAddons KF5::KConfigGui KF5::KI18n - KF5::KIOCore - KF5::KService) + KF5::KIOCore + KF5::KService) if(QT_QTOPENGL_FOUND) - target_link_libraries(${_testname} ${QT_QTOPENGL_LIBRARY}) + target_link_libraries(${_testname} Qt5::OpenGL) endif(QT_QTOPENGL_FOUND) add_test(plasma-${_testname} ${_testname}) ecm_mark_as_test(${_testname}) @@ -32,12 +32,12 @@ PLASMA_UNIT_TESTS( ) add_executable(storagetest storagetest.cpp ../private/storage.cpp ../private/storagethread.cpp) -target_link_libraries(storagetest ${QT_QTTEST_LIBRARY} ${QT_QTDECLARATIVE_LIBRARY} ${QT_QTSQL_LIBRARY} KF5::KIOCore Plasma KF5::KCoreAddons ) +target_link_libraries(storagetest Qt5::Test Qt5::Declarative Qt5::Sql KF5::KIOCore Plasma KF5::KCoreAddons ) add_test(plasma-storagetest storagetest) ecm_mark_as_test(plasma-storagetest) if(QT_QTOPENGL_FOUND) - target_link_libraries(storagetest ${QT_QTOPENGL_LIBRARY}) + target_link_libraries(storagetest Qt5::OpenGL) endif(QT_QTOPENGL_FOUND) if(QCA2_FOUND) diff --git a/src/plasma/tests/testcontainmentactionsplugin/CMakeLists.txt b/src/plasma/tests/testcontainmentactionsplugin/CMakeLists.txt index af1ba9c46..32cbfcd80 100644 --- a/src/plasma/tests/testcontainmentactionsplugin/CMakeLists.txt +++ b/src/plasma/tests/testcontainmentactionsplugin/CMakeLists.txt @@ -9,7 +9,7 @@ include(KDE4Defaults) set(test_SRCS test.cpp ) -kde4_add_ui_files(test_SRCS config.ui) +qt5_wrap_ui(test_SRCS config.ui) plasma_add_plugin(plasma_containmentactions_test ${test_SRCS}) target_link_libraries(plasma_containmentactions_test ${Plasma_LIBRARIES} KF5::KIOCore KF5::KIOWidgets) diff --git a/src/platformstatus/CMakeLists.txt b/src/platformstatus/CMakeLists.txt index cb8fca88a..920052a04 100644 --- a/src/platformstatus/CMakeLists.txt +++ b/src/platformstatus/CMakeLists.txt @@ -3,7 +3,7 @@ set( platformstatus.cpp ) -qt4_add_dbus_adaptor ( +qt5_add_dbus_adaptor ( kded_platformstatus_SRCS org.kde.platformstatus.xml platformstatus.h PlatformStatus @@ -20,7 +20,7 @@ target_link_libraries( KF5::KIOCore KF5::KIOWidgets Qt5::DBus Qt5::Quick - ) +) install( TARGETS kded_platformstatus DESTINATION ${PLUGIN_INSTALL_DIR} ) install( FILES kded_platformstatus.desktop DESTINATION ${SERVICES_INSTALL_DIR}/kded ) diff --git a/src/scriptengines/javascript/CMakeLists.txt b/src/scriptengines/javascript/CMakeLists.txt index b339bbc99..12ad09754 100644 --- a/src/scriptengines/javascript/CMakeLists.txt +++ b/src/scriptengines/javascript/CMakeLists.txt @@ -55,10 +55,10 @@ target_link_libraries(plasma_appletscript_simple_javascript ${KCore_LIBRARIES} KF5::KIOCore KF5::KIOWidgets ${Plasma_LIBRARIES} - ${QT_QTDECLARATIVE_LIBRARY} + Qt5::Declarative ${QT_QTSCRIPT_LIBRARY} ${QT_QTUITOOLS_LIBRARY} - ${QT_QTXML_LIBRARY} + Qt5::Xml ) install(TARGETS plasma_appletscript_simple_javascript DESTINATION ${PLUGIN_INSTALL_DIR})