From 3485eb6200cd4f33b47e95eab5c7b24d02ce7f0c Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Mon, 8 Nov 2021 11:50:25 +0200 Subject: [PATCH] cmake: Move base render backend classes to libkwin This allows using base opengl backends in libkwin, which can be useful later on for the purpose of moving the ownership of render backends from the Scene class to the Compositor class. --- src/backends/drm/CMakeLists.txt | 2 +- src/backends/fbdev/CMakeLists.txt | 2 +- src/backends/virtual/CMakeLists.txt | 2 +- src/backends/wayland/CMakeLists.txt | 4 ++-- src/backends/x11/common/CMakeLists.txt | 2 +- src/backends/x11/standalone/CMakeLists.txt | 2 +- src/backends/x11/windowed/CMakeLists.txt | 2 +- .../scenes/opengl/CMakeLists.txt | 19 ++----------------- .../scenes/opengl/abstract_egl_backend.cpp | 1 - .../basiceglsurfacetexture_internal.cpp | 2 +- .../opengl/basiceglsurfacetexture_wayland.cpp | 1 - .../scenes/opengl/egl_dmabuf.cpp | 2 +- .../scenes/opengl/openglbackend.cpp | 2 +- .../scenes/qpainter/CMakeLists.txt | 19 ++----------------- .../scenes/qpainter/qpainterbackend.cpp | 2 +- src/scenes/opengl/CMakeLists.txt | 5 +---- src/scenes/opengl/lanczosfilter.cpp | 3 +-- src/scenes/opengl/scene_opengl.cpp | 1 - src/scenes/qpainter/CMakeLists.txt | 5 +---- src/utils.cpp | 2 ++ src/utils.h | 2 ++ 21 files changed, 23 insertions(+), 59 deletions(-) diff --git a/src/backends/drm/CMakeLists.txt b/src/backends/drm/CMakeLists.txt index 651532eed6..d97b4c4371 100644 --- a/src/backends/drm/CMakeLists.txt +++ b/src/backends/drm/CMakeLists.txt @@ -38,7 +38,7 @@ endif() add_library(KWinWaylandDrmBackend MODULE ${DRM_SOURCES}) set_target_properties(KWinWaylandDrmBackend PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/org.kde.kwin.waylandbackends/") -target_link_libraries(KWinWaylandDrmBackend kwin Libdrm::Libdrm SceneQPainterBackend SceneOpenGLBackend VsyncSupport) +target_link_libraries(KWinWaylandDrmBackend kwin Libdrm::Libdrm VsyncSupport) if (HAVE_GBM) target_link_libraries(KWinWaylandDrmBackend gbm::gbm) diff --git a/src/backends/fbdev/CMakeLists.txt b/src/backends/fbdev/CMakeLists.txt index 85e226c4d8..5d1b7dcccd 100644 --- a/src/backends/fbdev/CMakeLists.txt +++ b/src/backends/fbdev/CMakeLists.txt @@ -6,7 +6,7 @@ set(FBDEV_SOURCES add_library(KWinWaylandFbdevBackend MODULE ${FBDEV_SOURCES}) set_target_properties(KWinWaylandFbdevBackend PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/org.kde.kwin.waylandbackends/") -target_link_libraries(KWinWaylandFbdevBackend kwin SceneQPainterBackend VsyncSupport) +target_link_libraries(KWinWaylandFbdevBackend kwin VsyncSupport) install( TARGETS diff --git a/src/backends/virtual/CMakeLists.txt b/src/backends/virtual/CMakeLists.txt index 5d2e3932c2..f2787c4540 100644 --- a/src/backends/virtual/CMakeLists.txt +++ b/src/backends/virtual/CMakeLists.txt @@ -10,7 +10,7 @@ ecm_qt_declare_logging_category(VIRTUAL_SOURCES HEADER logging.h IDENTIFIER KWIN add_library(KWinWaylandVirtualBackend MODULE ${VIRTUAL_SOURCES}) set_target_properties(KWinWaylandVirtualBackend PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/org.kde.kwin.waylandbackends/") -target_link_libraries(KWinWaylandVirtualBackend kwin SceneQPainterBackend SceneOpenGLBackend VsyncSupport) +target_link_libraries(KWinWaylandVirtualBackend kwin VsyncSupport) install( TARGETS diff --git a/src/backends/wayland/CMakeLists.txt b/src/backends/wayland/CMakeLists.txt index d00909ae55..1194f09e6f 100644 --- a/src/backends/wayland/CMakeLists.txt +++ b/src/backends/wayland/CMakeLists.txt @@ -14,10 +14,10 @@ endif() add_library(KWinWaylandWaylandBackend MODULE ${WAYLAND_BACKEND_SOURCES}) set_target_properties(KWinWaylandWaylandBackend PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/org.kde.kwin.waylandbackends/") -target_link_libraries(KWinWaylandWaylandBackend kwin KF5::WaylandClient SceneQPainterBackend) +target_link_libraries(KWinWaylandWaylandBackend kwin KF5::WaylandClient) if (HAVE_WAYLAND_EGL) - target_link_libraries(KWinWaylandWaylandBackend SceneOpenGLBackend Wayland::Egl) + target_link_libraries(KWinWaylandWaylandBackend Wayland::Egl) if (HAVE_GBM) target_link_libraries(KWinWaylandWaylandBackend gbm::gbm) endif() diff --git a/src/backends/x11/common/CMakeLists.txt b/src/backends/x11/common/CMakeLists.txt index 890f8e09b2..20622d2d07 100644 --- a/src/backends/x11/common/CMakeLists.txt +++ b/src/backends/x11/common/CMakeLists.txt @@ -5,4 +5,4 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-int-to-void-pointer-cast") endif() add_library(eglx11common STATIC eglonxbackend.cpp) -target_link_libraries(eglx11common kwin SceneOpenGLBackend) +target_link_libraries(eglx11common kwin) diff --git a/src/backends/x11/standalone/CMakeLists.txt b/src/backends/x11/standalone/CMakeLists.txt index 899b0b0dc3..9f21a14471 100644 --- a/src/backends/x11/standalone/CMakeLists.txt +++ b/src/backends/x11/standalone/CMakeLists.txt @@ -17,7 +17,7 @@ set(X11PLATFORM_SOURCES add_library(KWinX11Platform MODULE ${X11PLATFORM_SOURCES}) set_target_properties(KWinX11Platform PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/org.kde.kwin.platforms/") -target_link_libraries(KWinX11Platform eglx11common kwin kwinxrenderutils SceneOpenGLBackend VsyncSupport Qt::X11Extras KF5::Crash X11::X11) +target_link_libraries(KWinX11Platform eglx11common kwin kwinxrenderutils VsyncSupport Qt::X11Extras KF5::Crash X11::X11) if (X11_Xi_FOUND) target_sources(KWinX11Platform PRIVATE xinputintegration.cpp) target_link_libraries(KWinX11Platform X11::Xi) diff --git a/src/backends/x11/windowed/CMakeLists.txt b/src/backends/x11/windowed/CMakeLists.txt index 59ed811b73..26d83d7348 100644 --- a/src/backends/x11/windowed/CMakeLists.txt +++ b/src/backends/x11/windowed/CMakeLists.txt @@ -8,7 +8,7 @@ set(X11BACKEND_SOURCES add_library(KWinWaylandX11Backend MODULE ${X11BACKEND_SOURCES}) set_target_properties(KWinWaylandX11Backend PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/org.kde.kwin.waylandbackends/") -target_link_libraries(KWinWaylandX11Backend eglx11common kwin kwinxrenderutils X11::XCB SceneQPainterBackend SceneOpenGLBackend VsyncSupport X11::X11) +target_link_libraries(KWinWaylandX11Backend eglx11common kwin kwinxrenderutils X11::XCB VsyncSupport X11::X11) if (X11_Xi_FOUND) target_link_libraries(KWinWaylandX11Backend X11::Xi) endif() diff --git a/src/platformsupport/scenes/opengl/CMakeLists.txt b/src/platformsupport/scenes/opengl/CMakeLists.txt index d0e227b345..0b6bb7f5d9 100644 --- a/src/platformsupport/scenes/opengl/CMakeLists.txt +++ b/src/platformsupport/scenes/opengl/CMakeLists.txt @@ -1,4 +1,4 @@ -set(SCENE_OPENGL_BACKEND_SRCS +target_sources(kwin PRIVATE abstract_egl_backend.cpp basiceglsurfacetexture_internal.cpp basiceglsurfacetexture_wayland.cpp @@ -9,19 +9,4 @@ set(SCENE_OPENGL_BACKEND_SRCS openglsurfacetexture_wayland.cpp openglsurfacetexture_x11.cpp ) - -include(ECMQtDeclareLoggingCategory) -ecm_qt_declare_logging_category(SCENE_OPENGL_BACKEND_SRCS - HEADER - logging.h - IDENTIFIER - KWIN_OPENGL - CATEGORY_NAME - kwin_scene_opengl - DEFAULT_SEVERITY - Critical -) - -add_library(SceneOpenGLBackend STATIC ${SCENE_OPENGL_BACKEND_SRCS}) -target_link_libraries(SceneOpenGLBackend Qt::Core Qt::Widgets KF5::CoreAddons KF5::ConfigCore KF5::WindowSystem Plasma::KWaylandServer) -target_include_directories(SceneOpenGLBackend PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/src) +target_include_directories(kwin PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/src/platformsupport/scenes/opengl/abstract_egl_backend.cpp b/src/platformsupport/scenes/opengl/abstract_egl_backend.cpp index 84dd3341f6..9b56b53a41 100644 --- a/src/platformsupport/scenes/opengl/abstract_egl_backend.cpp +++ b/src/platformsupport/scenes/opengl/abstract_egl_backend.cpp @@ -16,7 +16,6 @@ #include "abstract_wayland_output.h" #include // kwin libs -#include #include #include // Qt diff --git a/src/platformsupport/scenes/opengl/basiceglsurfacetexture_internal.cpp b/src/platformsupport/scenes/opengl/basiceglsurfacetexture_internal.cpp index 211fa5d260..704ddb3c7b 100644 --- a/src/platformsupport/scenes/opengl/basiceglsurfacetexture_internal.cpp +++ b/src/platformsupport/scenes/opengl/basiceglsurfacetexture_internal.cpp @@ -6,8 +6,8 @@ #include "basiceglsurfacetexture_internal.h" #include "kwingltexture.h" -#include "logging.h" #include "surfaceitem_internal.h" +#include "utils.h" #include diff --git a/src/platformsupport/scenes/opengl/basiceglsurfacetexture_wayland.cpp b/src/platformsupport/scenes/opengl/basiceglsurfacetexture_wayland.cpp index 3598943b11..f399f6e3c3 100644 --- a/src/platformsupport/scenes/opengl/basiceglsurfacetexture_wayland.cpp +++ b/src/platformsupport/scenes/opengl/basiceglsurfacetexture_wayland.cpp @@ -8,7 +8,6 @@ #include "egl_dmabuf.h" #include "kwineglext.h" #include "kwingltexture.h" -#include "logging.h" #include "surfaceitem_wayland.h" #include "utils.h" diff --git a/src/platformsupport/scenes/opengl/egl_dmabuf.cpp b/src/platformsupport/scenes/opengl/egl_dmabuf.cpp index bd847831ae..dde2decf43 100644 --- a/src/platformsupport/scenes/opengl/egl_dmabuf.cpp +++ b/src/platformsupport/scenes/opengl/egl_dmabuf.cpp @@ -10,8 +10,8 @@ #include "egl_dmabuf.h" #include "drm_fourcc.h" #include "kwineglext.h" -#include "logging.h" +#include "utils.h" #include "wayland_server.h" #include diff --git a/src/platformsupport/scenes/opengl/openglbackend.cpp b/src/platformsupport/scenes/opengl/openglbackend.cpp index f7fc5d1df5..a2d3552a2f 100644 --- a/src/platformsupport/scenes/opengl/openglbackend.cpp +++ b/src/platformsupport/scenes/opengl/openglbackend.cpp @@ -9,9 +9,9 @@ */ #include "openglbackend.h" #include -#include #include "screens.h" +#include "utils.h" #include diff --git a/src/platformsupport/scenes/qpainter/CMakeLists.txt b/src/platformsupport/scenes/qpainter/CMakeLists.txt index a62e6fee60..d7d1d3cb80 100644 --- a/src/platformsupport/scenes/qpainter/CMakeLists.txt +++ b/src/platformsupport/scenes/qpainter/CMakeLists.txt @@ -1,22 +1,7 @@ -set(SCENE_QPAINTER_BACKEND_SRCS +target_sources(kwin PRIVATE qpaintersurfacetexture.cpp qpaintersurfacetexture_internal.cpp qpaintersurfacetexture_wayland.cpp qpainterbackend.cpp ) - -include(ECMQtDeclareLoggingCategory) -ecm_qt_declare_logging_category(SCENE_QPAINTER_BACKEND_SRCS - HEADER - logging.h - IDENTIFIER - KWIN_QPAINTER - CATEGORY_NAME - kwin_scene_qpainter - DEFAULT_SEVERITY - Critical -) - -add_library(SceneQPainterBackend STATIC ${SCENE_QPAINTER_BACKEND_SRCS}) -target_link_libraries(SceneQPainterBackend Qt::Core KF5::CoreAddons KF5::ConfigCore KF5::WindowSystem Plasma::KWaylandServer) -target_include_directories(SceneQPainterBackend PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/src) +target_include_directories(kwin PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/src/platformsupport/scenes/qpainter/qpainterbackend.cpp b/src/platformsupport/scenes/qpainter/qpainterbackend.cpp index a7b8f84bc3..3fc56aca7a 100644 --- a/src/platformsupport/scenes/qpainter/qpainterbackend.cpp +++ b/src/platformsupport/scenes/qpainter/qpainterbackend.cpp @@ -9,7 +9,7 @@ #include "qpainterbackend.h" #include "qpaintersurfacetexture_internal.h" #include "qpaintersurfacetexture_wayland.h" -#include +#include "utils.h" #include diff --git a/src/scenes/opengl/CMakeLists.txt b/src/scenes/opengl/CMakeLists.txt index 6f6da5f219..93ce2c326e 100644 --- a/src/scenes/opengl/CMakeLists.txt +++ b/src/scenes/opengl/CMakeLists.txt @@ -19,10 +19,7 @@ qt5_add_resources(SCENE_OPENGL_SRCS resources.qrc) add_library(KWinSceneOpenGL MODULE ${SCENE_OPENGL_SRCS}) set_target_properties(KWinSceneOpenGL PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/org.kde.kwin.scenes/") -target_link_libraries(KWinSceneOpenGL - kwin - SceneOpenGLBackend -) +target_link_libraries(KWinSceneOpenGL kwin) install( TARGETS diff --git a/src/scenes/opengl/lanczosfilter.cpp b/src/scenes/opengl/lanczosfilter.cpp index b82d39480c..43dfc5e6cf 100644 --- a/src/scenes/opengl/lanczosfilter.cpp +++ b/src/scenes/opengl/lanczosfilter.cpp @@ -15,10 +15,9 @@ #include "screens.h" #include "unmanaged.h" #include "options.h" +#include "utils.h" #include "workspace.h" -#include - #include #include diff --git a/src/scenes/opengl/scene_opengl.cpp b/src/scenes/opengl/scene_opengl.cpp index acb9408e72..fa839b347f 100644 --- a/src/scenes/opengl/scene_opengl.cpp +++ b/src/scenes/opengl/scene_opengl.cpp @@ -35,7 +35,6 @@ #include "surfaceitem.h" #include "windowitem.h" #include "abstract_output.h" -#include #include #include diff --git a/src/scenes/qpainter/CMakeLists.txt b/src/scenes/qpainter/CMakeLists.txt index 5b14390925..d26dd858b2 100644 --- a/src/scenes/qpainter/CMakeLists.txt +++ b/src/scenes/qpainter/CMakeLists.txt @@ -2,10 +2,7 @@ set(SCENE_QPAINTER_SRCS scene_qpainter.cpp) add_library(KWinSceneQPainter MODULE scene_qpainter.cpp) set_target_properties(KWinSceneQPainter PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/org.kde.kwin.scenes/") -target_link_libraries(KWinSceneQPainter - kwin - SceneQPainterBackend -) +target_link_libraries(KWinSceneQPainter kwin) install( TARGETS diff --git a/src/utils.cpp b/src/utils.cpp index 3a627904d7..859087c00f 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -34,6 +34,8 @@ #endif Q_LOGGING_CATEGORY(KWIN_CORE, "kwin_core", QtWarningMsg) +Q_LOGGING_CATEGORY(KWIN_OPENGL, "kwin_scene_opengl", QtWarningMsg) +Q_LOGGING_CATEGORY(KWIN_QPAINTER, "kwin_scene_qpainter", QtWarningMsg) Q_LOGGING_CATEGORY(KWIN_VIRTUALKEYBOARD, "kwin_virtualkeyboard", QtWarningMsg) namespace KWin { diff --git a/src/utils.h b/src/utils.h index 44e9d12757..76a91ff56b 100644 --- a/src/utils.h +++ b/src/utils.h @@ -27,6 +27,8 @@ // system #include Q_DECLARE_LOGGING_CATEGORY(KWIN_CORE) +Q_DECLARE_LOGGING_CATEGORY(KWIN_OPENGL) +Q_DECLARE_LOGGING_CATEGORY(KWIN_QPAINTER) Q_DECLARE_LOGGING_CATEGORY(KWIN_VIRTUALKEYBOARD) namespace KWin {