Commit 68b206e5 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧
Browse files

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
parent 700eff44
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})
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)
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
......
......@@ -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
)
......@@ -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
)
......@@ -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
)
......@@ -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
)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment