
## libraries
set(kded_wacomtablet_LIBS
   wacom_common
   KF5::CoreAddons
   KF5::Notifications
   KF5::XmlGui
   KF5::DBusAddons
   KF5::ConfigCore
   ${USING_X_LIBRARIES}
)

## sources
set(kded_wacomtablet_SRCS
    dbustabletservice.cpp
    eventnotifier.cpp
    procsystemadaptor.cpp
    procsystemproperty.cpp
    tabletbackend.cpp
    tabletbackendfactory.cpp
    tabletdaemon.cpp
    tabletfinder.cpp
    tablethandler.cpp
    x11eventnotifier.cpp
    x11tabletfinder.cpp
    xinputadaptor.cpp
    xinputproperty.cpp
    xsetwacomadaptor.cpp
    xsetwacomproperty.cpp
    ../common/globalactions.cpp
)

## dbus interfaces
qt5_add_dbus_adaptor(kded_wacomtablet_SRCS org.kde.Wacom.xml dbustabletservice.h Wacom::DBusTabletService)

## build KDE daemon module
add_definitions(-DTRANSLATION_DOMAIN=\"wacomtablet\")
add_library(kded_wacomtablet MODULE ${kded_wacomtablet_SRCS})
target_link_libraries( kded_wacomtablet ${kded_wacomtablet_LIBS} )

## files to install
install(TARGETS kded_wacomtablet DESTINATION ${KDE_INSTALL_PLUGINDIR})

install(FILES wacomtablet.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}/kded)
install(FILES wacomtablet.notifyrc DESTINATION "${KNOTIFYRC_INSTALL_DIR}")

install(FILES org.kde.Wacom.xml DESTINATION ${KDE_INSTALL_DBUSINTERFACEDIR})


## LIBRARY FOR UNIT TESTS
if (BUILD_TESTING)

    ## headers which need to be moc'ed for the static unit-testing library
    set(kded_wacomtablet_HDRS
        dbustabletservice.h
        tabletdaemon.h
        tablethandler.h
        eventnotifier.h
        x11eventnotifier.h
    )

    ## build static library for unit testing
    add_library( kded_wacomtablet_lib STATIC ${kded_wacomtablet_SRCS} )
    target_link_libraries( kded_wacomtablet_lib ${kded_wacomtablet_LIBS} )
    set_target_properties( kded_wacomtablet_lib PROPERTIES COMPILE_FLAGS "-fPIC" )

endif (BUILD_TESTING)
