From 5e60e64a5da90d779ce153454cf9c027faca80f5 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Fri, 20 Nov 2020 14:28:47 +0000 Subject: [PATCH] Bundle QPA plugin directly On wayland, we know we're always going to load our internal QPA. Instead of shipping a plugin and loading it dynamically we can use Qt static plugins. This should result in slightly faster load times, but also reduce the number of moving pieces for kwin. This also prevents anyone outside kwin loading our QPA which wouldn't have made any sense and just crashed. --- CMakeLists.txt | 1 + autotests/integration/CMakeLists.txt | 2 +- autotests/integration/kwin_wayland_test.cpp | 2 ++ main_wayland.cpp | 2 ++ plugins/qpa/CMakeLists.txt | 11 ++--------- 5 files changed, 8 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7f48aebabc..efa813eb6e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -826,6 +826,7 @@ endif() add_subdirectory(platformsupport) add_subdirectory(plugins) +target_link_libraries(kwin_wayland KWinQpaPlugin) ########### install files ############### diff --git a/autotests/integration/CMakeLists.txt b/autotests/integration/CMakeLists.txt index 422fd26aac..9db3bf486c 100644 --- a/autotests/integration/CMakeLists.txt +++ b/autotests/integration/CMakeLists.txt @@ -26,7 +26,7 @@ ecm_add_qtwayland_client_protocol(KWinIntegrationTestFramework_SOURCES BASENAME xdg-shell ) add_library(KWinIntegrationTestFramework STATIC ${KWinIntegrationTestFramework_SOURCES}) -target_link_libraries(KWinIntegrationTestFramework kwin Qt5::Test Wayland::Client) +target_link_libraries(KWinIntegrationTestFramework kwin Qt5::Test Wayland::Client KWinQpaPlugin) function(integrationTest) set(optionArgs WAYLAND_ONLY) diff --git a/autotests/integration/kwin_wayland_test.cpp b/autotests/integration/kwin_wayland_test.cpp index a1aff34235..780bff9220 100644 --- a/autotests/integration/kwin_wayland_test.cpp +++ b/autotests/integration/kwin_wayland_test.cpp @@ -30,6 +30,8 @@ #include #include +Q_IMPORT_PLUGIN(KWinIntegrationPlugin) + namespace KWin { diff --git a/main_wayland.cpp b/main_wayland.cpp index 8a4cd1f915..89efc46e0a 100644 --- a/main_wayland.cpp +++ b/main_wayland.cpp @@ -60,6 +60,8 @@ #include #include +Q_IMPORT_PLUGIN(KWinIntegrationPlugin) + namespace KWin { diff --git a/plugins/qpa/CMakeLists.txt b/plugins/qpa/CMakeLists.txt index 1eca68dbc0..9dcca439b2 100644 --- a/plugins/qpa/CMakeLists.txt +++ b/plugins/qpa/CMakeLists.txt @@ -16,8 +16,8 @@ set(QPA_SOURCES include(ECMQtDeclareLoggingCategory) ecm_qt_declare_logging_category(QPA_SOURCES HEADER logging.h IDENTIFIER KWIN_QPA CATEGORY_NAME kwin_qpa_plugin DEFAULT_SEVERITY Critical) -add_library(KWinQpaPlugin MODULE ${QPA_SOURCES}) -set_target_properties(KWinQpaPlugin PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/platforms/") +add_library(KWinQpaPlugin OBJECT ${QPA_SOURCES}) +target_compile_definitions(KWinQpaPlugin PRIVATE QT_STATICPLUGIN) set(QT5PLATFORMSUPPORT_LIBS Qt5::FontDatabaseSupportPrivate @@ -31,10 +31,3 @@ target_link_libraries(KWinQpaPlugin Fontconfig::Fontconfig kwin ) - -install( - TARGETS - KWinQpaPlugin - DESTINATION - ${PLUGIN_INSTALL_DIR}/platforms/ -)