aboutsummaryrefslogtreecommitdiff
path: root/tests/service-mocks/media-player-mpris-mock/CMakeLists.txt
blob: abe109ecce4b531793d5cc97e4684f59671a4219 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -fPIC -pthread")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -fno-strict-aliasing -Wextra -fPIC -pthread")

find_package(Qt5DBus REQUIRED)
include_directories(${Qt5DBus_INCLUDE_DIRS}
                    "${CMAKE_SOURCE_DIR}/tests/service-mocks")

add_definitions(-DQT_NO_KEYWORDS=1)

set(dbusinterface_mediaplayermpris_xml "org.mpris.MediaPlayer2.Player.xml")
set_source_files_properties(${dbusinterface_mediaplayermpris_xml} PROPERTIES
  CLASSNAME MediaPlayerMprisMockInterface)

qt5_add_dbus_interface(interface_files ${dbusinterface_mediaplayermpris_xml} MediaPlayerMprisMockInterface)

qt5_add_dbus_adaptor(adaptor_files
    org.mpris.MediaPlayer2.Player.xml
    MediaPlayerMprisMock.h
    ayatana::indicators::testing::MediaPlayerMprisMock
    MediaPlayerMprisMockAdaptor)

qt5_add_dbus_adaptor(adaptor_files
    org.mpris.MediaPlayer2.xml
    MediaPlayerMprisMock.h
    ayatana::indicators::testing::MediaPlayerMprisMock
    MediaPlayer2MockAdaptor)

add_executable(
  media-player-mpris-mock
  ${adaptor_files}
  MediaPlayerMprisMock.cpp
  ${CMAKE_SOURCE_DIR}/tests/service-mocks/DBusPropertiesNotifier.cpp
  main.cpp
  testplayers
)

add_executable(
  media-player-mpris-mock-update
  ${interface_files}
  player-update.cpp
  testplayers
)

target_link_libraries(
    media-player-mpris-mock
    Qt5::Core
    Qt5::DBus
)

target_link_libraries(
    media-player-mpris-mock-update
    Qt5::Core
    Qt5::DBus
)

# test players desktop files
add_custom_command (OUTPUT testplayers
                    DEPENDS ${CMAKE_SOURCE_DIR}/tests/service-mocks/media-player-mpris-mock/applications
                    COMMAND mkdir -p ${XDG_DATA_DIRS}
                    COMMAND cp -r ${CMAKE_SOURCE_DIR}/tests/service-mocks/media-player-mpris-mock/applications ${XDG_DATA_DIRS})