Reduce number of optional dependencies
Change some optional dependencies from being optional to being mandatory or being mandatory but behind on-by-default cmake flags. Eg: instead of only compiling Wayland support if we find the appropriate libraries, we always require the libraries unless the user specifies WITH_WAYLAND=OFF. Optional libraries are hard to discover by packagers (since they don't see an error once we add them) and create lots of possible build flavors with a different features that can confuse users.
This commit is contained in:
parent
c96559372b
commit
495e3019e4
11 changed files with 48 additions and 74 deletions
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -12,10 +12,6 @@
|
|||
#include <core_debug.h>
|
||||
#include <daemon.h>
|
||||
|
||||
#ifdef HAVE_KIO
|
||||
#include <kio/global.h>
|
||||
#endif
|
||||
|
||||
CompositeUploadJob::CompositeUploadJob(const QString &deviceId, bool displayNotification)
|
||||
: KCompositeJob()
|
||||
, m_server(new Server(this))
|
||||
|
|
|
@ -8,9 +8,7 @@
|
|||
|
||||
#include <QDebug>
|
||||
|
||||
#if HAVE_KIO
|
||||
#include <KIO/CommandLauncherJob>
|
||||
#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();
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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 <pluginmodel.h>
|
||||
#include <remotecommandsmodel.h>
|
||||
#include <remotesinksmodel.h>
|
||||
#if WITH_WAYLAND
|
||||
#include "pointerlockerwayland.h"
|
||||
#endif
|
||||
|
||||
QObject *createDBusResponse()
|
||||
{
|
||||
|
@ -89,7 +89,7 @@ void KdeConnectDeclarativePlugin::registerTypes(const char *uri)
|
|||
});
|
||||
qmlRegisterSingletonType<AbstractPointerLocker>("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
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -1,4 +1 @@
|
|||
#cmakedefine01 HAVE_WAYLAND
|
||||
#cmakedefine01 HAVE_X11
|
||||
#cmakedefine01 HAVE_WINDOWS
|
||||
#cmakedefine01 HAVE_MACOS
|
||||
#cmakedefine01 WITH_X11
|
||||
|
|
|
@ -11,16 +11,14 @@
|
|||
#include <KPluginFactory>
|
||||
#include <QGuiApplication>
|
||||
|
||||
#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
|
||||
|
||||
|
|
|
@ -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})
|
||||
|
|
Loading…
Reference in a new issue