From 16cc0f5ebb5b44578933c136c77f092134602113 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Tue, 20 Jun 2023 21:38:36 +0300 Subject: [PATCH] autotests: Make test framework a static lib again Static plugins being linked with shared libraries doesn't work smoothly. POSITION_INDEPENDENT_CODE target property needs to be set for every such plugin. However, there can be targets that we have no control over, which need POSITION_INDEPENDENT_CODE to be set too. Asking such projects to add this property and them refusing to do so would be reasonable because kwin's entire static plugin pipeline is weird. The test framework was made a shared library because kwin build directory used to get really big (in 10s of gigabytes). Due to the -fPIC issues, this change makes the test framework a static lib again. Obviously, this brings back the big build directory problem. But, it's not as terrible as it used to be. With this change, kwin build directory is a couple of gigabytes in debug build, which is a lot but not as bad as it used to be before. --- autotests/integration/CMakeLists.txt | 11 ++++++----- autotests/integration/effects/CMakeLists.txt | 18 +++++++++--------- src/plugins/CMakeLists.txt | 1 - src/plugins/idletime/CMakeLists.txt | 1 - src/plugins/kglobalaccel/CMakeLists.txt | 1 - src/plugins/qpa/CMakeLists.txt | 1 - src/plugins/windowsystem/CMakeLists.txt | 1 - src/xwayland/CMakeLists.txt | 1 - src/xwayland/lib/CMakeLists.txt | 2 -- 9 files changed, 15 insertions(+), 22 deletions(-) diff --git a/autotests/integration/CMakeLists.txt b/autotests/integration/CMakeLists.txt index 0ed053dcdc..7e8e3fc9ad 100644 --- a/autotests/integration/CMakeLists.txt +++ b/autotests/integration/CMakeLists.txt @@ -1,6 +1,6 @@ add_subdirectory(helper) -add_library(KWinIntegrationTestFramework SHARED) +add_library(KWinIntegrationTestFramework STATIC) qt6_generate_wayland_protocol_client_sources(KWinIntegrationTestFramework NO_INCLUDE_CORE_ONLY @@ -43,16 +43,17 @@ target_link_libraries(KWinIntegrationTestFramework KF6WindowSystemKWinPlugin KF6IdleTimeKWinPlugin ) -kcoreaddons_target_static_plugins(KWinIntegrationTestFramework "kwin/effects/plugins" LINK_OPTION "PRIVATE") -set_target_properties(KWinIntegrationTestFramework PROPERTIES CXX_VISIBILITY_PRESET default) function(integrationTest) - set(optionArgs) + set(optionArgs BUILTIN_EFFECTS) set(oneValueArgs NAME) set(multiValueArgs SRCS LIBS) cmake_parse_arguments(ARGS "${optionArgs}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) add_executable(${ARGS_NAME} ${ARGS_SRCS}) target_link_libraries(${ARGS_NAME} KWinIntegrationTestFramework Qt::Test ${ARGS_LIBS}) + if(${ARGS_BUILTIN_EFFECTS}) + kcoreaddons_target_static_plugins(${ARGS_NAME} "kwin/effects/plugins") + endif() add_test(NAME kwin-${ARGS_NAME} COMMAND dbus-run-session ${CMAKE_BINARY_DIR}/bin/${ARGS_NAME}) endfunction() @@ -92,7 +93,7 @@ integrationTest(NAME testLayerShellV1Window SRCS layershellv1window_test.cpp) integrationTest(NAME testVirtualDesktop SRCS virtual_desktop_test.cpp) integrationTest(NAME testXdgShellWindowRules SRCS xdgshellwindow_rules_test.cpp) integrationTest(NAME testIdleInhibition SRCS idle_inhibition_test.cpp) -integrationTest(NAME testDontCrashReinitializeCompositor SRCS dont_crash_reinitialize_compositor.cpp) +integrationTest(NAME testDontCrashReinitializeCompositor SRCS dont_crash_reinitialize_compositor.cpp BUILTIN_EFFECTS) integrationTest(NAME testNoGlobalShortcuts SRCS no_global_shortcuts_test.cpp) integrationTest(NAME testPlacement SRCS placement_test.cpp) integrationTest(NAME testActivation SRCS activation_test.cpp) diff --git a/autotests/integration/effects/CMakeLists.txt b/autotests/integration/effects/CMakeLists.txt index f74feb6328..8550841d42 100644 --- a/autotests/integration/effects/CMakeLists.txt +++ b/autotests/integration/effects/CMakeLists.txt @@ -1,9 +1,9 @@ -integrationTest(NAME testTranslucency SRCS translucency_test.cpp LIBS XCB::ICCCM) -integrationTest(NAME testSlidingPopups SRCS slidingpopups_test.cpp LIBS XCB::ICCCM) -integrationTest(NAME testShadeWobblyWindows SRCS wobbly_shade_test.cpp LIBS XCB::ICCCM) -integrationTest(NAME testScriptedEffects SRCS scripted_effects_test.cpp) -integrationTest(NAME testToplevelOpenCloseAnimation SRCS toplevel_open_close_animation_test.cpp) -integrationTest(NAME testPopupOpenCloseAnimation SRCS popup_open_close_animation_test.cpp) -integrationTest(NAME testDesktopSwitchingAnimation SRCS desktop_switching_animation_test.cpp) -integrationTest(NAME testMinimizeAnimation SRCS minimize_animation_test.cpp) -integrationTest(NAME testMaximizeAnimation SRCS maximize_animation_test.cpp) +integrationTest(NAME testTranslucency SRCS translucency_test.cpp LIBS XCB::ICCCM BUILTIN_EFFECTS) +integrationTest(NAME testSlidingPopups SRCS slidingpopups_test.cpp LIBS XCB::ICCCM BUILTIN_EFFECTS) +integrationTest(NAME testShadeWobblyWindows SRCS wobbly_shade_test.cpp LIBS XCB::ICCCM BUILTIN_EFFECTS) +integrationTest(NAME testScriptedEffects SRCS scripted_effects_test.cpp BUILTIN_EFFECTS) +integrationTest(NAME testToplevelOpenCloseAnimation SRCS toplevel_open_close_animation_test.cpp BUILTIN_EFFECTS) +integrationTest(NAME testPopupOpenCloseAnimation SRCS popup_open_close_animation_test.cpp BUILTIN_EFFECTS) +integrationTest(NAME testDesktopSwitchingAnimation SRCS desktop_switching_animation_test.cpp BUILTIN_EFFECTS) +integrationTest(NAME testMinimizeAnimation SRCS minimize_animation_test.cpp BUILTIN_EFFECTS) +integrationTest(NAME testMaximizeAnimation SRCS maximize_animation_test.cpp BUILTIN_EFFECTS) diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt index 9b64a5b479..91dd1559c0 100644 --- a/src/plugins/CMakeLists.txt +++ b/src/plugins/CMakeLists.txt @@ -26,7 +26,6 @@ endfunction() macro(kwin_add_builtin_effect name) kcoreaddons_add_plugin(${name} STATIC SOURCES ${ARGN} INSTALL_NAMESPACE "kwin/effects/plugins") target_compile_definitions(${name} PRIVATE -DTRANSLATION_DOMAIN=\"kwin\") - set_property(TARGET ${name} PROPERTY POSITION_INDEPENDENT_CODE ON) kwin_strip_builtin_effect_metadata(${name} metadata.json) install(FILES metadata.json DESTINATION ${KDE_INSTALL_DATADIR}/kwin/builtin-effects/ RENAME ${name}.json) endmacro() diff --git a/src/plugins/idletime/CMakeLists.txt b/src/plugins/idletime/CMakeLists.txt index 4f090d445a..30e965a431 100644 --- a/src/plugins/idletime/CMakeLists.txt +++ b/src/plugins/idletime/CMakeLists.txt @@ -3,7 +3,6 @@ set(idletime_plugin_SRCS ) add_library(KF6IdleTimeKWinPlugin OBJECT ${idletime_plugin_SRCS}) -set_property(TARGET KF6IdleTimeKWinPlugin PROPERTY POSITION_INDEPENDENT_CODE ON) target_compile_definitions(KF6IdleTimeKWinPlugin PRIVATE QT_STATICPLUGIN) target_link_libraries(KF6IdleTimeKWinPlugin KF6::IdleTime diff --git a/src/plugins/kglobalaccel/CMakeLists.txt b/src/plugins/kglobalaccel/CMakeLists.txt index 35c1fe0d07..4594d68180 100644 --- a/src/plugins/kglobalaccel/CMakeLists.txt +++ b/src/plugins/kglobalaccel/CMakeLists.txt @@ -3,6 +3,5 @@ set(kglobalaccel_plugin_SRCS ) add_library(KF6GlobalAccelKWinPlugin OBJECT ${kglobalaccel_plugin_SRCS}) -set_property(TARGET KF6GlobalAccelKWinPlugin PROPERTY POSITION_INDEPENDENT_CODE ON) target_compile_definitions(KF6GlobalAccelKWinPlugin PRIVATE QT_STATICPLUGIN) target_link_libraries(KF6GlobalAccelKWinPlugin K::KGlobalAccelD kwin) diff --git a/src/plugins/qpa/CMakeLists.txt b/src/plugins/qpa/CMakeLists.txt index 60672a8c9a..739ea9996c 100644 --- a/src/plugins/qpa/CMakeLists.txt +++ b/src/plugins/qpa/CMakeLists.txt @@ -1,5 +1,4 @@ add_library(KWinQpaPlugin OBJECT) -set_property(TARGET KWinQpaPlugin PROPERTY POSITION_INDEPENDENT_CODE ON) target_sources(KWinQpaPlugin PRIVATE backingstore.cpp eglhelpers.cpp diff --git a/src/plugins/windowsystem/CMakeLists.txt b/src/plugins/windowsystem/CMakeLists.txt index d16e20037c..e765798751 100644 --- a/src/plugins/windowsystem/CMakeLists.txt +++ b/src/plugins/windowsystem/CMakeLists.txt @@ -6,6 +6,5 @@ set(kwindowsystem_plugin_SRCS ) add_library(KF6WindowSystemKWinPlugin OBJECT ${kwindowsystem_plugin_SRCS}) -set_property(TARGET KF6WindowSystemKWinPlugin PROPERTY POSITION_INDEPENDENT_CODE ON) target_compile_definitions(KF6WindowSystemKWinPlugin PRIVATE QT_STATICPLUGIN) target_link_libraries(KF6WindowSystemKWinPlugin kwin) diff --git a/src/xwayland/CMakeLists.txt b/src/xwayland/CMakeLists.txt index ea001edd1b..62c8c54984 100644 --- a/src/xwayland/CMakeLists.txt +++ b/src/xwayland/CMakeLists.txt @@ -16,5 +16,4 @@ add_library(KWinXwaylandServerModule OBJECT xwldrophandler.cpp xwaylandlauncher.cpp ) -set_property(TARGET KWinXwaylandServerModule PROPERTY POSITION_INDEPENDENT_CODE ON) target_link_libraries(KWinXwaylandServerModule PUBLIC kwin KWinXwaylandCommon) diff --git a/src/xwayland/lib/CMakeLists.txt b/src/xwayland/lib/CMakeLists.txt index 64d4b71949..806a0b75da 100644 --- a/src/xwayland/lib/CMakeLists.txt +++ b/src/xwayland/lib/CMakeLists.txt @@ -14,7 +14,5 @@ ecm_qt_declare_logging_category(KWinXwaylandCommon Warning ) -set_property(TARGET KWinXwaylandCommon PROPERTY POSITION_INDEPENDENT_CODE ON) - target_include_directories(KWinXwaylandCommon PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) target_link_libraries(KWinXwaylandCommon Qt::Core)