Move the generation of dbus interfaces into interfaces/
Simplifies the code altogether by centralizing the generation into 1 call that does all the steps. REVIEW: 124120
This commit is contained in:
parent
700eff446e
commit
68b206e525
7 changed files with 18 additions and 119 deletions
|
@ -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 ()
|
|
|
@ -50,20 +50,4 @@ set_target_properties(kdeconnectcore PROPERTIES
|
||||||
target_include_directories(kdeconnectcore PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
|
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)
|
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)
|
install(TARGETS kdeconnectcore EXPORT kdeconnectLibraryTargets ${INSTALL_TARGETS_DEFAULT_ARGS} LIBRARY NAMELINK_SKIP)
|
||||||
|
|
|
@ -1,11 +1,16 @@
|
||||||
project(KDEConnectInterfaces)
|
project(KDEConnectInterfaces)
|
||||||
|
|
||||||
include_directories(${CMAKE_CURRENT_BINARY_DIR}
|
function(geninterface source_h output_h)
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
set(xml_file ${CMAKE_CURRENT_BINARY_DIR}/${output_h}.xml)
|
||||||
${CMAKE_BINARY_DIR}
|
qt5_generate_dbus_interface( ${source_h} ${xml_file})
|
||||||
${CMAKE_SOURCE_DIR})
|
|
||||||
|
|
||||||
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
|
set(libkdeconnect_SRC
|
||||||
dbusinterfaces.cpp
|
dbusinterfaces.cpp
|
||||||
|
@ -25,32 +30,16 @@ set(libkdeconnect_HEADERS
|
||||||
notificationsmodel.h
|
notificationsmodel.h
|
||||||
dbusinterfaces.h
|
dbusinterfaces.h
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/kdeconnectinterfaces_export.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(
|
geninterface(${CMAKE_SOURCE_DIR}/core/daemon.h daemoninterface.h)
|
||||||
${CMAKE_BINARY_DIR}/core/org.kde.kdeconnect.daemon.xml
|
geninterface(${CMAKE_SOURCE_DIR}/core/device.h deviceinterface.h)
|
||||||
${CMAKE_BINARY_DIR}/core/org.kde.kdeconnect.device.xml
|
geninterface(${CMAKE_SOURCE_DIR}/plugins/battery/batterydbusinterface.h devicebatteryinterface.h)
|
||||||
${CMAKE_BINARY_DIR}/plugins/battery/org.kde.kdeconnect.device.battery.xml
|
geninterface(${CMAKE_SOURCE_DIR}/plugins/sftp/sftpplugin.h devicesftpinterface.h)
|
||||||
${CMAKE_BINARY_DIR}/plugins/mprisremote/org.kde.kdeconnect.device.mprisremote.xml
|
geninterface(${CMAKE_SOURCE_DIR}/plugins/notifications/notificationsdbusinterface.h devicenotificationsinterface.h)
|
||||||
${CMAKE_BINARY_DIR}/plugins/sftp/org.kde.kdeconnect.device.sftp.xml
|
geninterface(${CMAKE_SOURCE_DIR}/plugins/notifications/notification.h notificationinterface.h)
|
||||||
${CMAKE_BINARY_DIR}/plugins/notifications/org.kde.kdeconnect.device.notifications.xml
|
geninterface(${CMAKE_SOURCE_DIR}/plugins/mprisremote/mprisremoteplugin.h mprisremoteinterface)
|
||||||
${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 )
|
|
||||||
|
|
||||||
add_library(kdeconnectinterfaces SHARED ${libkdeconnect_SRC})
|
add_library(kdeconnectinterfaces SHARED ${libkdeconnect_SRC})
|
||||||
set_target_properties(kdeconnectinterfaces PROPERTIES
|
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)
|
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
|
target_link_libraries(kdeconnectinterfaces
|
||||||
LINK_PUBLIC
|
LINK_PUBLIC
|
||||||
Qt5::Gui
|
Qt5::Gui
|
||||||
|
|
|
@ -13,12 +13,3 @@ target_link_libraries(kdeconnect_battery
|
||||||
KF5::I18n
|
KF5::I18n
|
||||||
KF5::Notifications
|
KF5::Notifications
|
||||||
)
|
)
|
||||||
|
|
||||||
include(DbusInterfaceMacros)
|
|
||||||
|
|
||||||
generate_and_install_dbus_interface(
|
|
||||||
kdeconnect_battery
|
|
||||||
batterydbusinterface.h
|
|
||||||
org.kde.kdeconnect.device.battery.xml
|
|
||||||
OPTIONS -a
|
|
||||||
)
|
|
||||||
|
|
|
@ -5,10 +5,3 @@ target_link_libraries(kdeconnect_mprisremote
|
||||||
Qt5::DBus
|
Qt5::DBus
|
||||||
KF5::I18n
|
KF5::I18n
|
||||||
)
|
)
|
||||||
|
|
||||||
generate_and_install_dbus_interface(
|
|
||||||
kdeconnect_mpriscontrol
|
|
||||||
mprisremoteplugin.h
|
|
||||||
org.kde.kdeconnect.device.mprisremote.xml
|
|
||||||
OPTIONS -a
|
|
||||||
)
|
|
||||||
|
|
|
@ -13,18 +13,3 @@ target_link_libraries(kdeconnect_notifications
|
||||||
Qt5::DBus
|
Qt5::DBus
|
||||||
KF5::Notifications
|
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
|
|
||||||
)
|
|
||||||
|
|
|
@ -17,12 +17,3 @@ target_link_libraries(kdeconnect_sftp
|
||||||
KF5::KIOWidgets
|
KF5::KIOWidgets
|
||||||
KF5::Notifications
|
KF5::Notifications
|
||||||
)
|
)
|
||||||
|
|
||||||
include(DbusInterfaceMacros)
|
|
||||||
|
|
||||||
generate_and_install_dbus_interface(
|
|
||||||
kdeconnect_sftp
|
|
||||||
sftpplugin.h
|
|
||||||
org.kde.kdeconnect.device.sftp.xml
|
|
||||||
OPTIONS -a
|
|
||||||
)
|
|
||||||
|
|
Loading…
Reference in a new issue