-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
219 lines (188 loc) · 7.03 KB
/
CMakeLists.txt
File metadata and controls
219 lines (188 loc) · 7.03 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
cmake_minimum_required(VERSION 3.16)
# set(FLAVOR kirigami)
# set(FLAVOR uuitk)
# set(FLAVOR silica)
# set(WATCHFISH_FEATURES "notificationmonitor;walltime;music;calendar;voicecall;volume;soundprofile")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_library(libwatchfish STATIC)
# Make sure to choose same Qt version as rest of project
if(TARGET Qt6::Core)
set(QT_VERSION_MAJOR 6)
find_package(Qt6 REQUIRED COMPONENTS Core DBus)
elseif(TARGET Qt5::Core)
set(QT_VERSION_MAJOR 5)
find_package(Qt5 REQUIRED COMPONENTS Core DBus)
else()
# Use Qt6 first if available
find_package(Qt6 COMPONENTS Core DBus QUIET)
if(Qt6_FOUND)
set(QT_VERSION_MAJOR 6)
else()
find_package(Qt5 REQUIRED COMPONENTS Core Xml)
set(QT_VERSION_MAJOR 5)
endif()
endif()
if(QT_VERSION_MAJOR EQUAL 5)
macro(qt_add_dbus_interface outfiles interface basename)
qt5_add_dbus_interface(${outfiles} ${interface} ${basename})
endmacro()
endif()
message(STATUS "libwatchfish: using Qt ${QT_VERSION_MAJOR}")
find_package(PkgConfig REQUIRED)
target_include_directories(libwatchfish PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
target_link_libraries(libwatchfish PUBLIC
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::DBus
)
set(SOURCES)
set(HEADERS)
set(DBUS_INTERFACES_GEN)
# Feature: soundprofile
if(WATCHFISH_FEATURES MATCHES "soundprofile")
LIST(APPEND SOURCES
soundprofile.cpp
)
LIST(APPEND HEADERS
soundprofile.h
)
endif()
# Feature: notificationmonitor
if(WATCHFISH_FEATURES MATCHES "notificationmonitor")
pkg_check_modules(DBUS REQUIRED dbus-1)
target_include_directories(libwatchfish PUBLIC ${DBUS_INCLUDE_DIRS})
target_link_libraries(libwatchfish PUBLIC ${DBUS_LIBRARIES})
list(APPEND SOURCES
notificationmonitor.cpp
notification.cpp
)
list(APPEND HEADERS
notificationmonitor.h
notificationmonitor_p.h
notification.h
)
endif()
# Feature: walltime
if(WATCHFISH_FEATURES MATCHES "walltime")
pkg_check_modules(TIMED REQUIRED timed-qt${QT_VERSION_MAJOR})
target_include_directories(libwatchfish PUBLIC ${TIMED_INCLUDE_DIRS})
target_link_libraries(libwatchfish PUBLIC ${TIMED_LIBRARIES})
list(APPEND SOURCES
walltimemonitor.cpp
)
list(APPEND HEADERS
walltimemonitor.h
walltimemonitor_p.h
)
endif()
# Feature: music
if(WATCHFISH_FEATURES MATCHES "music")
if(QT_VERSION_MAJOR EQUAL 6)
pkg_check_modules(MPRIS REQUIRED ambermpris6)
else()
pkg_check_modules(MPRIS REQUIRED ambermpris)
endif()
target_include_directories(libwatchfish PUBLIC ${MPRIS_INCLUDE_DIRS})
target_link_libraries(libwatchfish PUBLIC ${MPRIS_LIBRARIES})
list(APPEND SOURCES musiccontroller.cpp)
list(APPEND HEADERS musiccontroller.h musiccontroller_p.h)
if(FLAVOR STREQUAL "silica")
target_compile_definitions(libwatchfish PUBLIC MER_EDITION_SAILFISH)
list(APPEND SOURCES musiccontroller_sailfish.cpp)
qt_add_dbus_interface(DBUS_INTERFACES_GEN com.Meego.MainVolume2.xml mainvolume2_interface)
elseif(FLAVOR STREQUAL "uuitk")
target_compile_definitions(libwatchfish PUBLIC UUITK_EDITION)
list(APPEND SOURCES musiccontroller_ubuntu.cpp)
else()
pkg_check_modules(PULSEAUDIO REQUIRED libpulse)
target_include_directories(libwatchfish PUBLIC ${PULSEAUDIO_INCLUDE_DIRS})
target_link_libraries(libwatchfish PUBLIC ${PULSEAUDIO_LIBRARIES})
target_compile_options(libwatchfish PUBLIC ${PULSEAUDIO_CFLAGS_OTHER})
list(APPEND SOURCES musiccontroller_kirigami.cpp)
endif()
endif()
# Feature: calendar
if(WATCHFISH_FEATURES MATCHES "calendar")
if(FLAVOR STREQUAL "silica")
pkg_check_modules(LIBMKCAL REQUIRED libmkcal-qt${QT_VERSION_MAJOR})
target_include_directories(libwatchfish PUBLIC ${LIBMKCAL_INCLUDE_DIRS})
target_link_libraries(libwatchfish PUBLIC ${LIBMKCAL_LIBRARIES})
if(EXISTS /usr/include/KF5/KCalendarCore/)
pkg_check_modules(KF5CALENDARCORE REQUIRED KF5CalendarCore)
target_include_directories(libwatchfish PUBLIC ${KF5CALENDARCORE_INCLUDE_DIRS})
target_link_libraries(libwatchfish PUBLIC ${KF5CALENDARCORE_LIBRARIES})
add_definitions(-DKF5CALENDARCORE)
endif()
list(APPEND HEADERS
calendarsource.h
calendarsource_p.h
calendarevent.h
)
elseif(FLAVOR STREQUAL "uuitk")
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Organizer)
target_compile_definitions(libwatchfish PUBLIC UUITK_EDITION)
target_link_libraries(libwatchfish PUBLIC Qt${QT_VERSION_MAJOR}::Organizer)
list(APPEND HEADERS
calendarsource.h
calendarevent.h
)
else()
list(APPEND HEADERS
calendarsource.h
calendarevent.h
)
endif()
list(APPEND SOURCES
calendarsource.cpp
calendarevent.cpp
)
endif()
# Feature: voicecall
if(WATCHFISH_FEATURES MATCHES "voicecall")
if(FLAVOR STREQUAL "silica")
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Contacts)
target_compile_definitions(libwatchfish PUBLIC MER_EDITION_SAILFISH)
target_link_libraries(libwatchfish PUBLIC Qt${QT_VERSION_MAJOR}::Contacts)
list(APPEND SOURCES
voicecallcontroller_sailfish.cpp
voicecallcontrollerbase.cpp
)
list(APPEND HEADERS
voicecallcontroller_sailfish.h
voicecallcontroller.h
voicecallcontroller_p.h
voicecallcontrollerbase.h
)
qt_add_dbus_interface(DBUS_INTERFACES_GEN org.nemomobile.voicecall.VoiceCallManager.xml voicecallmanager_interface)
qt_add_dbus_interface(DBUS_INTERFACES_GEN org.nemomobile.voicecall.VoiceCall.xml voicecall_interface)
elseif(FLAVOR STREQUAL "uuitk") # ubuntu touch
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Contacts)
target_compile_definitions(libwatchfish PUBLIC UUITK_EDITION)
target_link_libraries(libwatchfish PUBLIC Qt${QT_VERSION_MAJOR}::Contacts)
list(APPEND SOURCES
voicecallcontroller_ubuntu.cpp
callchannelobserver.cpp
voicecallcontrollerbase.cpp
)
list(APPEND HEADERS
voicecallcontroller.h
voicecallcontroller_ubuntu.h
callchannelobserver.h
voicecallcontrollerbase.h
)
target_include_directories(libwatchfish PUBLIC /usr/include/telepathy-qt${QT_VERSION_MAJOR}/)
target_link_libraries(libwatchfish PUBLIC telepathy-qt${QT_VERSION_MAJOR})
endif()
endif()
# Feature: volume
if(WATCHFISH_FEATURES MATCHES "volume")
list(APPEND SOURCES
volumecontroller.cpp
)
list(APPEND HEADERS
volumecontroller.h
volumecontroller_p.h
)
qt_add_dbus_interface(DBUS_INTERFACES_GEN com.Meego.MainVolume2.xml mainvolume2_interface)
endif()
target_sources(libwatchfish PUBLIC ${HEADERS} PRIVATE ${SOURCES} ${DBUS_INTERFACES_GEN})