diff --git a/CMakeLists.txt b/CMakeLists.txt index 20e0a40a1..8801ab1af 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,8 +49,7 @@ target_include_directories(kdeconnectversion INTERFACE ${CMAKE_CURRENT_BINARY_DI find_package(Qca-qt${QT_MAJOR_VERSION} ${QCA_MIN_VERSION} REQUIRED) set(Qca_LIBRARY qca-qt${QT_MAJOR_VERSION}) -set(KF5_REQUIRED_COMPONENTS I18n ConfigWidgets DBusAddons IconThemes Notifications KIO KCMUtils Service Solid Kirigami2 People WindowSystem GuiAddons) -set(KF5_OPTIONAL_COMPONENTS DocTools) +set(KF5_REQUIRED_COMPONENTS I18n ConfigWidgets DBusAddons IconThemes Notifications KIO KCMUtils Service Solid Kirigami2 People WindowSystem GuiAddons DocTools) set_package_properties(KF5Kirigami2 PROPERTIES DESCRIPTION "QtQuick plugins to build user interfaces based on KDE UX guidelines" @@ -59,12 +58,21 @@ set_package_properties(KF5Kirigami2 PROPERTIES TYPE RUNTIME ) +if(UNIX AND NOT APPLE) + option(WITH_X11 "Build with X11 support" ON) + option(WITH_PULSEAUDIO "Build with Pulseaudio support" ON) +else() + set(WITH_X11 OFF) + set(WITH_PULSEAUDIO OFF) + +endif() + if(UNIX AND NOT APPLE) find_package(KF5Package REQUIRED) - find_package(KF5PulseAudioQt) - if (QT_MAJOR_VERSION EQUAL "5") - find_package(QtWaylandScanner REQUIRED) + if (WITH_PULSEAUDIO) + find_package(KF5PulseAudioQt) endif() + find_package(QtWaylandScanner REQUIRED) find_package(Wayland 1.9 REQUIRED Client) find_package(Qt${QT_MAJOR_VERSION} REQUIRED COMPONENTS WaylandClient) find_package(WaylandProtocols REQUIRED) @@ -79,8 +87,6 @@ set_package_properties(KF5PeopleVCard PROPERTIES TYPE RUNTIME ) -add_definitions(-DHAVE_KIO) - #ecm_find_qmlmodule(org.kde.people 1.0) FIXME This results in KPeople code being called which triggers DBus calls which breaks the Windows CI ecm_find_qmlmodule(QtQuick.Particles 2.0) @@ -91,9 +97,6 @@ if (UNIX AND NOT APPLE AND QT_MAJOR_VERSION EQUAL "5") find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS X11Extras) endif() find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS ${KF5_REQUIRED_COMPONENTS}) -if (KF5_OPTIONAL_COMPONENTS) - find_package(KF5 ${KF5_MIN_VERSION} OPTIONAL_COMPONENTS ${KF5_OPTIONAL_COMPONENTS}) -endif() if (WIN32) get_filename_component(WINDOWS_KITS_DIR @@ -132,10 +135,9 @@ if(NOT WIN32 AND NOT APPLE) add_subdirectory(plasmoid) endif() -if(KF5DocTools_FOUND) - add_subdirectory(doc) - kdoctools_install(po) -endif() +add_subdirectory(doc) +kdoctools_install(po) + ki18n_install(po) if(BUILD_TESTING) diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index dfb920982..e68535fa5 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -64,6 +64,8 @@ PUBLIC Qt${QT_MAJOR_VERSION}::Network KF5::CoreAddons ${Qca_LIBRARY} + KF5::KIOCore + KF5::KIOGui PRIVATE Qt${QT_MAJOR_VERSION}::DBus KF5::I18n @@ -74,10 +76,6 @@ if(WIN32) target_link_libraries(kdeconnectcore PRIVATE ws2_32.lib) # winsock2 endif() -if(${KF5KIO_FOUND}) - target_link_libraries(kdeconnectcore PUBLIC KF5::KIOCore KF5::KIOGui) -endif() - if (BLUETOOTH_ENABLED) target_compile_definitions(kdeconnectcore PRIVATE -DKDECONNECT_BLUETOOTH) target_link_libraries(kdeconnectcore PRIVATE Qt5::Bluetooth) diff --git a/core/backends/lan/compositeuploadjob.cpp b/core/backends/lan/compositeuploadjob.cpp index 0c8f55a27..58e590c07 100644 --- a/core/backends/lan/compositeuploadjob.cpp +++ b/core/backends/lan/compositeuploadjob.cpp @@ -12,10 +12,6 @@ #include #include -#ifdef HAVE_KIO -#include -#endif - CompositeUploadJob::CompositeUploadJob(const QString &deviceId, bool displayNotification) : KCompositeJob() , m_server(new Server(this)) diff --git a/core/openconfig.cpp b/core/openconfig.cpp index 65a4f2487..bc5951347 100644 --- a/core/openconfig.cpp +++ b/core/openconfig.cpp @@ -8,9 +8,7 @@ #include -#if HAVE_KIO #include -#endif void OpenConfig::setXdgActivationToken(const QString &token) { @@ -34,14 +32,10 @@ void OpenConfig::openConfiguration(const QString &deviceId, const QString &plugi args << argument; } -#if HAVE_KIO auto job = new KIO::CommandLauncherJob(QStringLiteral("kdeconnect-settings"), args); job->setDesktopName(QStringLiteral("org.kde.kdeconnect-settings")); job->setStartupId(m_currentToken.toUtf8()); job->start(); -#else - QProcess::startDetached(QStringLiteral("kdeconnect-settings"), args); -#endif m_currentToken = QString(); } diff --git a/declarativeplugin/CMakeLists.txt b/declarativeplugin/CMakeLists.txt index 2ebd0e1f6..f5b9334a3 100644 --- a/declarativeplugin/CMakeLists.txt +++ b/declarativeplugin/CMakeLists.txt @@ -35,7 +35,6 @@ if(UNIX AND NOT APPLE) target_sources(kdeconnectdeclarativeplugin PRIVATE ${wayland_SRCS}) target_link_libraries(kdeconnectdeclarativeplugin PRIVATE Wayland::Client Qt::WaylandClient Qt::GuiPrivate) target_sources(kdeconnectdeclarativeplugin PUBLIC pointerlockerwayland.cpp) - target_compile_definitions(kdeconnectdeclarativeplugin PRIVATE -DWITH_WAYLAND=1) endif() target_link_libraries(kdeconnectdeclarativeplugin PRIVATE Qt::Quick kdeconnectinterfaces kdeconnectcore) diff --git a/declarativeplugin/kdeconnectdeclarativeplugin.cpp b/declarativeplugin/kdeconnectdeclarativeplugin.cpp index 4b695bbf2..fc0886966 100644 --- a/declarativeplugin/kdeconnectdeclarativeplugin.cpp +++ b/declarativeplugin/kdeconnectdeclarativeplugin.cpp @@ -23,12 +23,12 @@ #include "interfaces/notificationsmodel.h" #include "openconfig.h" #include "pointerlocker.h" +#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD) +#include "pointerlockerwayland.h" +#endif #include #include #include -#if WITH_WAYLAND -#include "pointerlockerwayland.h" -#endif QObject *createDBusResponse() { @@ -89,7 +89,7 @@ void KdeConnectDeclarativePlugin::registerTypes(const char *uri) }); qmlRegisterSingletonType("org.kde.kdeconnect", 1, 0, "PointerLocker", [](QQmlEngine *, QJSEngine *) -> QObject * { AbstractPointerLocker *ret; -#if WITH_WAYLAND +#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD) if (qGuiApp->platformName() == QLatin1String("wayland")) ret = new PointerLockerWayland; else diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index ec4b809ba..89dfb675b 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -52,15 +52,15 @@ if(NOT APPLE) add_subdirectory(sftp) endif() -if(KF5PulseAudioQt_FOUND OR WIN32) +if(WITH_PULSEAUDIO OR WIN32) add_subdirectory(pausemusic) endif() -if(Qt5Multimedia_FOUND AND (KF5PulseAudioQt_FOUND OR WIN32)) +if(WITH_PULSEAUDIO OR WIN32) add_subdirectory(findthisdevice) endif() -if (WIN32 OR APPLE OR KF5PulseAudioQt_FOUND) +if (WITH_PULSEAUDIO OR WIN32 OR APPLE) add_subdirectory(systemvolume) endif() diff --git a/plugins/mousepad/CMakeLists.txt b/plugins/mousepad/CMakeLists.txt index 614f157fc..c8984f1c1 100644 --- a/plugins/mousepad/CMakeLists.txt +++ b/plugins/mousepad/CMakeLists.txt @@ -9,19 +9,18 @@ if(UNIX AND NOT APPLE) target_sources(kdeconnect_mousepad PUBLIC waylandremoteinput.cpp ${SRCS}) - find_package(LibFakeKey QUIET) - set_package_properties(LibFakeKey PROPERTIES DESCRIPTION "fake key events" - URL "https://www.yoctoproject.org/tools-resources/projects/matchbox" - TYPE OPTIONAL - PURPOSE "Needed for the remote mousepad plugin" - ) - target_sources(kdeconnect_mousepad PRIVATE ${wayland_SRCS}) target_link_libraries(kdeconnect_mousepad Wayland::Client Qt::WaylandClient PkgConfig::XkbCommon) target_sources(kdeconnect_mousepad PUBLIC waylandremoteinput.cpp) - set(HAVE_WAYLAND TRUE) - if (LibFakeKey_FOUND) + if (WITH_X11) + find_package(LibFakeKey REQUIRED) + set_package_properties(LibFakeKey PROPERTIES DESCRIPTION "fake key events" + URL "https://github.com/dtapuska/fakekey" + TYPE REQUIRED + PURPOSE "Needed for the remote mouse input plugin" + ) + if (QT_MAJOR_VERSION EQUAL "5") find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS X11Extras) endif() @@ -31,18 +30,15 @@ if(UNIX AND NOT APPLE) endif() endif() -set(HAVE_WINDOWS ${WIN32}) -set(HAVE_X11 ${LibFakeKey_FOUND}) -set(HAVE_MACOS ${APPLE}) configure_file(config-mousepad.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-mousepad.h) target_link_libraries(kdeconnect_mousepad kdeconnectcore Qt::Gui KF5::I18n) -if (HAVE_WINDOWS) +if (WIN32) target_sources(kdeconnect_mousepad PUBLIC windowsremoteinput.cpp) endif() -if(HAVE_X11) +if(WITH_X11) target_sources(kdeconnect_mousepad PUBLIC x11remoteinput.cpp) if (QT_MAJOR_VERSION EQUAL "5") target_link_libraries(kdeconnect_mousepad Qt5::X11Extras) @@ -50,7 +46,7 @@ if(HAVE_X11) target_link_libraries(kdeconnect_mousepad ${X11_LIBRARIES} ${XTEST_LIBRARIES} ${LibFakeKey_LIBRARIES}) endif() -if (HAVE_MACOS) +if (APPLE) target_sources(kdeconnect_mousepad PUBLIC macosremoteinput.mm) target_link_libraries(kdeconnect_mousepad "-framework CoreGraphics" "-framework ApplicationServices" "-framework Cocoa") endif() diff --git a/plugins/mousepad/config-mousepad.h.cmake b/plugins/mousepad/config-mousepad.h.cmake index 12f9d1a05..03550c094 100644 --- a/plugins/mousepad/config-mousepad.h.cmake +++ b/plugins/mousepad/config-mousepad.h.cmake @@ -1,4 +1 @@ -#cmakedefine01 HAVE_WAYLAND -#cmakedefine01 HAVE_X11 -#cmakedefine01 HAVE_WINDOWS -#cmakedefine01 HAVE_MACOS +#cmakedefine01 WITH_X11 diff --git a/plugins/mousepad/mousepadplugin.cpp b/plugins/mousepad/mousepadplugin.cpp index 845886d32..45465918b 100644 --- a/plugins/mousepad/mousepadplugin.cpp +++ b/plugins/mousepad/mousepadplugin.cpp @@ -11,16 +11,14 @@ #include #include -#if HAVE_WINDOWS +#if defined(Q_OS_WIN) #include "windowsremoteinput.h" -#elif HAVE_MACOS +#elif defined(Q_OS_MACOS) #include "macosremoteinput.h" #else -#if HAVE_X11 -#include "x11remoteinput.h" -#endif -#if HAVE_WAYLAND #include "waylandremoteinput.h" +#if WITH_X11 +#include "x11remoteinput.h" #endif #endif @@ -30,21 +28,18 @@ MousepadPlugin::MousepadPlugin(QObject *parent, const QVariantList &args) : KdeConnectPlugin(parent, args) , m_impl(nullptr) { -#if HAVE_WINDOWS +#if defined(Q_OS_WIN) m_impl = new WindowsRemoteInput(this); -#elif HAVE_MACOS +#elif defined(Q_OS_APPLE) m_impl = new MacOSRemoteInput(this); #else -#if HAVE_X11 - if (QGuiApplication::platformName() == QLatin1String("xcb")) { - m_impl = new X11RemoteInput(this); - } -#endif - -#if HAVE_WAYLAND if (QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) { m_impl = new WaylandRemoteInput(this); } +#if WITH_X11 + if (QGuiApplication::platformName() == QLatin1String("xcb")) { + m_impl = new X11RemoteInput(this); + } #endif #endif diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index b246945e3..1e0359dab 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -4,14 +4,11 @@ set(kdeconnect_libraries kdeconnectcore kdeconnectversion KF5::I18n + KF5::KIOWidgets Qt::DBus Qt::Network Qt::Test ) -if(${KF5KIO_FOUND}) - list(APPEND kdeconnect_libraries KF5::KIOWidgets) -endif() - ecm_add_test(pluginloadtest.cpp LINK_LIBRARIES ${kdeconnect_libraries}) ecm_add_test(sendfiletest.cpp LINK_LIBRARIES ${kdeconnect_libraries})