From 92c08071b6df6afcbfbd230d815f87809985f34f Mon Sep 17 00:00:00 2001 From: Michael Pyne Date: Thu, 14 Jul 2022 21:15:30 -0400 Subject: [PATCH] libtaskmanager: Fix build when PipeWire is not installed. The CMake code is careful not to include PipeWire when it is not installed, however what it *does* include (taskmanagerplugin) still has a dependency on Screencasting classes, which prior to this are gated under the PipeWire check. Since these classes only require Wayland, not PipeWire, I fix the build error by reducing the CMake check for PipeWire to only add the PipeWire-specific bits when PipeWire is present, and to build the screencasting stuff unconditionally. The ECM logging code is named after PipeWire but doesn't depend on it either so that is also built unconditionally to avoid build failures about a missing "logging.h". BUG:456655 --- libtaskmanager/declarative/CMakeLists.txt | 71 ++++++++++++----------- 1 file changed, 36 insertions(+), 35 deletions(-) diff --git a/libtaskmanager/declarative/CMakeLists.txt b/libtaskmanager/declarative/CMakeLists.txt index 797f1fc2c..29afa57b5 100644 --- a/libtaskmanager/declarative/CMakeLists.txt +++ b/libtaskmanager/declarative/CMakeLists.txt @@ -7,44 +7,45 @@ target_link_libraries(taskmanagerplugin taskmanager) install(TARGETS taskmanagerplugin DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/taskmanager) install(FILES qmldir DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/taskmanager) -if(TARGET K::KPipeWire) - ecm_qt_declare_logging_category(SRCS - HEADER logging.h - IDENTIFIER PIPEWIRE_LOGGING - CATEGORY_NAME plasma_workspace_pipewire_logging - DESCRIPTION "PipeWire components for window thumbnails" - EXPORT PlasmaWorkspacePipeWire) - ecm_qt_install_logging_categories( - EXPORT PlasmaWorkspacePipeWire - FILE myproject.categories - DESTINATION "${KDE_INSTALL_LOGGINGCATEGORIESDIR}" +ecm_qt_declare_logging_category(SRCS + HEADER logging.h + IDENTIFIER PIPEWIRE_LOGGING + CATEGORY_NAME plasma_workspace_pipewire_logging + DESCRIPTION "PipeWire components for window thumbnails" + EXPORT PlasmaWorkspacePipeWire) +ecm_qt_install_logging_categories( + EXPORT PlasmaWorkspacePipeWire + FILE myproject.categories + DESTINATION "${KDE_INSTALL_LOGGINGCATEGORIESDIR}" +) + +if (QT_MAJOR_VERSION EQUAL "5") + ecm_add_qtwayland_client_protocol(SRCS + PROTOCOL ${PLASMA_WAYLAND_PROTOCOLS_DIR}/zkde-screencast-unstable-v1.xml + BASENAME zkde-screencast-unstable-v1 ) +else() + qt6_generate_wayland_protocol_client_sources(taskmanagerplugin FILES + ${PLASMA_WAYLAND_PROTOCOLS_DIR}/zkde-screencast-unstable-v1.xml) +endif() +target_include_directories(taskmanagerplugin PRIVATE ${Libdrm_INCLUDE_DIR}) - if (QT_MAJOR_VERSION EQUAL "5") - ecm_add_qtwayland_client_protocol(SRCS - PROTOCOL ${PLASMA_WAYLAND_PROTOCOLS_DIR}/zkde-screencast-unstable-v1.xml - BASENAME zkde-screencast-unstable-v1 - ) - else() - qt6_generate_wayland_protocol_client_sources(taskmanagerplugin FILES - ${PLASMA_WAYLAND_PROTOCOLS_DIR}/zkde-screencast-unstable-v1.xml) - endif() - target_include_directories(taskmanagerplugin PRIVATE ${Libdrm_INCLUDE_DIR}) +target_sources(taskmanagerplugin PUBLIC screencasting.cpp screencastingrequest.cpp ${SRCS}) +target_link_libraries(taskmanagerplugin Qt::Qml Qt::GuiPrivate + KF5::I18n + KF5::WaylandClient + Wayland::Client) +if (${Qt5Gui_OPENGL_IMPLEMENTATION} STREQUAL "GLESv2") + target_link_libraries(taskmanagerplugin Qt5::Gui_GLESv2) +elseif(TARGET Qt5::Gui_GL) + target_link_libraries(taskmanagerplugin Qt5::Gui_GL) +endif() +if (TARGET Qt5::Gui_EGL) + target_link_libraries(taskmanagerplugin Qt5::Gui_EGL) +endif() +if(TARGET K::KPipeWire) target_compile_definitions(taskmanagerplugin PRIVATE -DWITH_KPIPEWIRE) - target_sources(taskmanagerplugin PUBLIC screencasting.cpp screencastingrequest.cpp ${SRCS}) target_link_libraries(taskmanagerplugin PkgConfig::PipeWire - Qt::Qml Qt::GuiPrivate - KF5::I18n - KF5::WaylandClient - K::KPipeWire - Wayland::Client) - if (${Qt5Gui_OPENGL_IMPLEMENTATION} STREQUAL "GLESv2") - target_link_libraries(taskmanagerplugin Qt5::Gui_GLESv2) - elseif(TARGET Qt5::Gui_GL) - target_link_libraries(taskmanagerplugin Qt5::Gui_GL) - endif() - if (TARGET Qt5::Gui_EGL) - target_link_libraries(taskmanagerplugin Qt5::Gui_EGL) - endif() + K::KPipeWire) endif()