diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,25 +21,33 @@ include(FindPkgConfig) -# remove? -pkg_check_modules(PIPEWIRE REQUIRED libpipewire-0.1) -pkg_check_modules(SPA REQUIRED libspa-0.1) -pkg_check_modules(GLIB REQUIRED glib-2.0) +pkg_check_modules(PIPEWIRE libpipewire-0.1) +pkg_check_modules(SPA libspa-0.1) +pkg_check_modules(GLIB glib-2.0) -find_package(gbm REQUIRED) +find_package(gbm) set_package_properties(gbm PROPERTIES DESCRIPTION "GBM - Generic Buffer Management" - TYPE REQUIRED + TYPE OPTIONAL PURPOSE "Required for egl ouput of drm backend." ) -find_package(epoxy REQUIRED) +find_package(epoxy) include_directories(${epoxy_INCLUDE_DIRS}) set_package_properties(epoxy PROPERTIES DESCRIPTION "libepoxy" URL "http://github.com/anholt/libepoxy" - TYPE REQUIRED + TYPE OPTIONAL PURPOSE "OpenGL dispatch library for GBM backend" ) +if (${PIPEWIRE_FOUND} AND ${SPA_FOUND} AND ${GLIB_FOUND} AND ${GBM_FOUND} AND ${EPOXY_FOUND}) + set (SCREENCAST_ENABLED true) +else() + set (SCREENCAST_ENABLED false) +endif() +add_definitions(-DSCREENCAST_ENABLED=${SCREENCAST_ENABLED}) + +add_feature_info ("Screencast portal" ${SCREENCAST_ENABLED} "Support for screen sharing") + find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Core DBus diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -19,16 +19,23 @@ notification.cpp print.cpp request.cpp - screencast.cpp - screencaststream.cpp - screenchooserdialog.cpp session.cpp ) +if (SCREENCAST_ENABLED) + set (xdg_desktop_portal_kde_SRCS + ${xdg_desktop_portal_kde_SRCS} + screencast.cpp + screencaststream.cpp + screenchooserdialog.cpp) + + ki18n_wrap_ui(xdg_desktop_portal_kde_SRCS + screenchooserdialog.ui) +endif() + ki18n_wrap_ui(xdg_desktop_portal_kde_SRCS accessdialog.ui appchooserdialog.ui - screenchooserdialog.ui ) add_executable(xdg-desktop-portal-kde ${xdg_desktop_portal_kde_SRCS}) @@ -42,11 +49,15 @@ KF5::I18n KF5::Notifications KF5::WaylandClient - ${PIPEWIRE_LIBRARIES} - ${SPA_LIBRARIES} - ${GLIB_LIBRARIES} - ${epoxy_LIBRARY} - gbm::gbm ) +if (SCREENCAST_ENABLED) + target_link_libraries(xdg-desktop-portal-kde + ${PIPEWIRE_LIBRARIES} + ${SPA_LIBRARIES} + ${GLIB_LIBRARIES} + ${epoxy_LIBRARY} + gbm::gbm) +endif() + install(TARGETS xdg-desktop-portal-kde DESTINATION ${KDE_INSTALL_LIBEXECDIR}) diff --git a/src/desktopportal.h b/src/desktopportal.h --- a/src/desktopportal.h +++ b/src/desktopportal.h @@ -31,7 +31,9 @@ #include "inhibit.h" #include "notification.h" #include "print.h" +#if SCREENCAST_ENABLED #include "screencast.h" +#endif class DesktopPortal : public QObject { @@ -48,7 +50,9 @@ InhibitPortal *m_inhibit; NotificationPortal *m_notification; PrintPortal *m_print; +#if SCREENCAST_ENABLED ScreenCastPortal *m_screenCast; +#endif }; #endif // XDG_DESKTOP_PORTAL_KDE_DESKTOP_PORTAL_H diff --git a/src/desktopportal.cpp b/src/desktopportal.cpp --- a/src/desktopportal.cpp +++ b/src/desktopportal.cpp @@ -37,7 +37,9 @@ , m_inhibit(new InhibitPortal(this)) , m_notification(new NotificationPortal(this)) , m_print(new PrintPortal(this)) +#if SCREENCAST_ENABLED , m_screenCast(new ScreenCastPortal(this)) +#endif { }