diff --git a/cmake/DbusInterfaceMacros.cmake b/cmake/DbusInterfaceMacros.cmake deleted file mode 100644 index 2c49753c7..000000000 --- a/cmake/DbusInterfaceMacros.cmake +++ /dev/null @@ -1,25 +0,0 @@ -macro (generate_and_install_dbus_interface main_project_target header_file output_xml_file) #OPTIONS qdbus_options -# qt5_extract_options( -# extra_files_ignore -# qdbus_options -# ${ARGN} -# ) - qt5_generate_dbus_interface( - ${header_file} - ${output_xml_file} -# OPTIONS ${qdbus_options} - ) - add_custom_target( - ${output_xml_file} - SOURCES ${CMAKE_CURRENT_BINARY_DIR}/${output_xml_file} - ) -# don't install until API is stable -# install( -# FILES ${CMAKE_CURRENT_BINARY_DIR}/${output_xml_file} -# DESTINATION ${DBUS_INTERFACES_INSTALL_DIR} -# ) - add_dependencies( - ${main_project_target} - ${output_xml_file} - ) -endmacro () diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 4d752512e..dd8fedbbe 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -50,20 +50,4 @@ set_target_properties(kdeconnectcore PROPERTIES target_include_directories(kdeconnectcore PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) generate_export_header(kdeconnectcore EXPORT_FILE_NAME ${CMAKE_CURRENT_BINARY_DIR}/kdeconnectcore_export.h BASE_NAME KDEConnectCore) -include(DbusInterfaceMacros) - -generate_and_install_dbus_interface( - kdeconnectcore - ../core/daemon.h - org.kde.kdeconnect.daemon.xml - OPTIONS -a -) - -generate_and_install_dbus_interface( - kdeconnectcore - ../core/device.h - org.kde.kdeconnect.device.xml - OPTIONS -a -) - install(TARGETS kdeconnectcore EXPORT kdeconnectLibraryTargets ${INSTALL_TARGETS_DEFAULT_ARGS} LIBRARY NAMELINK_SKIP) diff --git a/interfaces/CMakeLists.txt b/interfaces/CMakeLists.txt index bae0cff21..0220af8e5 100644 --- a/interfaces/CMakeLists.txt +++ b/interfaces/CMakeLists.txt @@ -1,11 +1,16 @@ project(KDEConnectInterfaces) -include_directories(${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_BINARY_DIR} - ${CMAKE_SOURCE_DIR}) +function(geninterface source_h output_h) + set(xml_file ${CMAKE_CURRENT_BINARY_DIR}/${output_h}.xml) + qt5_generate_dbus_interface( ${source_h} ${xml_file}) -add_definitions(-DKDECONNECT_LIBRARY) + list(APPEND libkdeconnect_HEADERS ${CMAKE_CURRENT_BINARY_DIR}/${output_h}) + set_source_files_properties(${xml_file} PROPERTIES NO_NAMESPACE true) + + get_filename_component(basename ${output_h} NAME_WE) + qt5_add_dbus_interface(libkdeconnect_SRC ${xml_file} ${basename}) + set(libkdeconnect_SRC ${libkdeconnect_SRC} PARENT_SCOPE) +endfunction() set(libkdeconnect_SRC dbusinterfaces.cpp @@ -25,32 +30,16 @@ set(libkdeconnect_HEADERS notificationsmodel.h dbusinterfaces.h ${CMAKE_CURRENT_BINARY_DIR}/kdeconnectinterfaces_export.h - ${CMAKE_BINARY_DIR}/interfaces/daemoninterface.h - ${CMAKE_BINARY_DIR}/interfaces/deviceinterface.h - ${CMAKE_BINARY_DIR}/interfaces/devicebatteryinterface.h - ${CMAKE_BINARY_DIR}/interfaces/devicesftpinterface.h - ${CMAKE_BINARY_DIR}/interfaces/devicenotificationsinterface.h - ${CMAKE_BINARY_DIR}/interfaces/notificationinterface.h - ${CMAKE_BINARY_DIR}/interfaces/mprisremoteinterface.h ) -set_source_files_properties( - ${CMAKE_BINARY_DIR}/core/org.kde.kdeconnect.daemon.xml - ${CMAKE_BINARY_DIR}/core/org.kde.kdeconnect.device.xml - ${CMAKE_BINARY_DIR}/plugins/battery/org.kde.kdeconnect.device.battery.xml - ${CMAKE_BINARY_DIR}/plugins/mprisremote/org.kde.kdeconnect.device.mprisremote.xml - ${CMAKE_BINARY_DIR}/plugins/sftp/org.kde.kdeconnect.device.sftp.xml - ${CMAKE_BINARY_DIR}/plugins/notifications/org.kde.kdeconnect.device.notifications.xml - ${CMAKE_BINARY_DIR}/plugins/notifications/org.kde.kdeconnect.device.notifications.notification.xml - PROPERTIES NO_NAMESPACE true -) -qt5_add_dbus_interface(libkdeconnect_SRC ${CMAKE_BINARY_DIR}/core/org.kde.kdeconnect.daemon.xml daemoninterface) -qt5_add_dbus_interface(libkdeconnect_SRC ${CMAKE_BINARY_DIR}/core/org.kde.kdeconnect.device.xml deviceinterface) -qt5_add_dbus_interface(libkdeconnect_SRC ${CMAKE_BINARY_DIR}/plugins/battery/org.kde.kdeconnect.device.battery.xml devicebatteryinterface ) -qt5_add_dbus_interface(libkdeconnect_SRC ${CMAKE_BINARY_DIR}/plugins/sftp/org.kde.kdeconnect.device.sftp.xml devicesftpinterface ) -qt5_add_dbus_interface(libkdeconnect_SRC ${CMAKE_BINARY_DIR}/plugins/notifications/org.kde.kdeconnect.device.notifications.xml devicenotificationsinterface ) -qt5_add_dbus_interface(libkdeconnect_SRC ${CMAKE_BINARY_DIR}/plugins/notifications/org.kde.kdeconnect.device.notifications.notification.xml notificationinterface ) -qt5_add_dbus_interface(libkdeconnect_SRC ${CMAKE_BINARY_DIR}/plugins/mprisremote/org.kde.kdeconnect.device.mprisremote.xml mprisremoteinterface ) +geninterface(${CMAKE_SOURCE_DIR}/core/daemon.h daemoninterface.h) +geninterface(${CMAKE_SOURCE_DIR}/core/device.h deviceinterface.h) +geninterface(${CMAKE_SOURCE_DIR}/plugins/battery/batterydbusinterface.h devicebatteryinterface.h) +geninterface(${CMAKE_SOURCE_DIR}/plugins/sftp/sftpplugin.h devicesftpinterface.h) +geninterface(${CMAKE_SOURCE_DIR}/plugins/notifications/notificationsdbusinterface.h devicenotificationsinterface.h) +geninterface(${CMAKE_SOURCE_DIR}/plugins/notifications/notification.h notificationinterface.h) +geninterface(${CMAKE_SOURCE_DIR}/plugins/mprisremote/mprisremoteplugin.h mprisremoteinterface) + add_library(kdeconnectinterfaces SHARED ${libkdeconnect_SRC}) set_target_properties(kdeconnectinterfaces PROPERTIES @@ -60,15 +49,6 @@ set_target_properties(kdeconnectinterfaces PROPERTIES generate_export_header(kdeconnectinterfaces EXPORT_FILE_NAME ${CMAKE_CURRENT_BINARY_DIR}/kdeconnectinterfaces_export.h BASE_NAME KDEConnectInterfaces) -add_dependencies(kdeconnectinterfaces - org.kde.kdeconnect.daemon.xml - org.kde.kdeconnect.device.xml - org.kde.kdeconnect.device.battery.xml - org.kde.kdeconnect.device.sftp.xml - org.kde.kdeconnect.device.notifications.xml - org.kde.kdeconnect.device.notifications.notification.xml -) - target_link_libraries(kdeconnectinterfaces LINK_PUBLIC Qt5::Gui diff --git a/plugins/battery/CMakeLists.txt b/plugins/battery/CMakeLists.txt index cfb799a58..a312ea66d 100644 --- a/plugins/battery/CMakeLists.txt +++ b/plugins/battery/CMakeLists.txt @@ -13,12 +13,3 @@ target_link_libraries(kdeconnect_battery KF5::I18n KF5::Notifications ) - -include(DbusInterfaceMacros) - -generate_and_install_dbus_interface( - kdeconnect_battery - batterydbusinterface.h - org.kde.kdeconnect.device.battery.xml - OPTIONS -a -) diff --git a/plugins/mprisremote/CMakeLists.txt b/plugins/mprisremote/CMakeLists.txt index 0392249e2..b4b7a2b1d 100644 --- a/plugins/mprisremote/CMakeLists.txt +++ b/plugins/mprisremote/CMakeLists.txt @@ -5,10 +5,3 @@ target_link_libraries(kdeconnect_mprisremote Qt5::DBus KF5::I18n ) - -generate_and_install_dbus_interface( - kdeconnect_mpriscontrol - mprisremoteplugin.h - org.kde.kdeconnect.device.mprisremote.xml - OPTIONS -a -) diff --git a/plugins/notifications/CMakeLists.txt b/plugins/notifications/CMakeLists.txt index 233fae18b..41c5b78f8 100644 --- a/plugins/notifications/CMakeLists.txt +++ b/plugins/notifications/CMakeLists.txt @@ -13,18 +13,3 @@ target_link_libraries(kdeconnect_notifications Qt5::DBus KF5::Notifications ) - -include(DbusInterfaceMacros) - -generate_and_install_dbus_interface( - kdeconnect_notifications - notificationsdbusinterface.h - org.kde.kdeconnect.device.notifications.xml - OPTIONS -a -) -generate_and_install_dbus_interface( - kdeconnect_notifications - notification.h - org.kde.kdeconnect.device.notifications.notification.xml - OPTIONS -a -) diff --git a/plugins/sftp/CMakeLists.txt b/plugins/sftp/CMakeLists.txt index 7f68e0c69..4e05e1999 100644 --- a/plugins/sftp/CMakeLists.txt +++ b/plugins/sftp/CMakeLists.txt @@ -17,12 +17,3 @@ target_link_libraries(kdeconnect_sftp KF5::KIOWidgets KF5::Notifications ) - -include(DbusInterfaceMacros) - -generate_and_install_dbus_interface( - kdeconnect_sftp - sftpplugin.h - org.kde.kdeconnect.device.sftp.xml - OPTIONS -a -)