forked from dresden-elektronik/deconz-rest-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
365 lines (330 loc) · 8.78 KB
/
CMakeLists.txt
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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
cmake_minimum_required(VERSION 3.13)
project(de_rest_plugin VERSION 2.27.04 LANGUAGES C;CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(Qt5 COMPONENTS Core Widgets Network WebSockets REQUIRED)
find_package(Git REQUIRED)
if (UNIX)
include(FindPkgConfig)
pkg_check_modules (OPENSSL openssl)
else()
find_package(OpenSSL REQUIRED)
endif()
if (NOT DECONZ_FULL_BUILD)
# standalone build
add_subdirectory(sqlite3)
#--- deCONZ library ---------------------------------------------------
include(FetchContent)
FetchContent_Declare(
deconzlib
GIT_REPOSITORY https://github.com/dresden-elektronik/deconz-lib.git
GIT_TAG main
)
# FetchContent_MakeAvailable(deconzlib)
# FetchContent_MakeAvailable requires CMake 3.14, but Debian Buster has only 3.13
FetchContent_GetProperties(deconzlib)
if (NOT deconzlib_POPULATED)
FetchContent_Populate(deconzlib)
add_subdirectory(${deconzlib_SOURCE_DIR} ${deconzlib_BINARY_DIR})
endif()
endif()
#----------------------------------------------------------------------
set(PLUGIN_INCLUDE_FILES
air_quality.h
alarm_system.h
alarm_system_device_table.h
alarm_system_event_handler.h
aps_controller_wrapper.h
backup.h
bindings.h
button_maps.h
colorspace.h
crypto/mmohash.h
crypto/password.h
crypto/random.h
crypto/scrypt.h
database.h
daylight.h
de_web_plugin.h
de_web_plugin_private.h
de_web_widget.h
device.h
device_access_fn.h
device_compat.h
device_ddf_bundle.h
device_ddf_init.h
device_descriptions.h
device_tick.h
device_js/device_js.h
event.h
event_emitter.h
fan_control.h
gateway.h
gateway_scanner.h
green_power.h
group.h
group_info.h
ias_ace.h
ias_zone.h
json.h
light_node.h
poll_control.h
poll_manager.h
product_match.h
read_files.h
resource.h
resourcelinks.h
rest_alarmsystems.h
rest_api.h
rest_ddf.h
rest_devices.h
rest_node_base.h
rule.h
scene.h
sensor.h
simple_metering.h
state_change.h
thermostat.h
thermostat_ui_configuration.h
tuya.h
ui/ddf_bindingeditor.h
ui/ddf_editor.h
ui/ddf_itemeditor.h
ui/ddf_itemlist.h
ui/ddf_treeview.h
ui/device_widget.h
ui/text_lineedit.h
utils/ArduinoJson.h
utils/ArduinoJson-v6.19.4.h
utils/bufstring.h
utils/scratchmem.h
utils/stringcache.h
utils/utils.h
websocket_server.h
xiaomi.h
zcl/zcl.h
zdp/zdp.h
zdp/zdp_handlers.h
)
add_library(${PROJECT_NAME} SHARED
${PLUGIN_INCLUDE_FILES}
de_web_widget.ui
ui/ddf_editor.ui
ui/device_widget.ui
air_quality.cpp
alarm_system.cpp
alarm_system_device_table.cpp
alarm_system_event_handler.cpp
appliances.cpp
aps_controller_wrapper.cpp
authorisation.cpp
backup.cpp
basic.cpp
bindings.cpp
button_maps.cpp
change_channel.cpp
colorspace.cpp
crypto/mmohash.cpp
crypto/password.cpp
crypto/random.cpp
crypto/scrypt.cpp
cj/cj_all.c
database.cpp
daylight.cpp
de_otau.cpp
device_access_fn.cpp
device_compat.cpp
device.cpp
device_ddf_bundle.cpp
device_ddf_init.cpp
device_descriptions.cpp
device_js/duktape.c
device_js/device_js_duktape.cpp
device_tick.cpp
de_web_plugin.cpp
de_web_widget.cpp
discovery.cpp
electrical_measurement.cpp
event.cpp
event_emitter.cpp
event_queue.cpp
fan_control.cpp
firmware_update.cpp
gateway.cpp
gateway_scanner.cpp
green_power.cpp
group.cpp
group_info.cpp
gw_uuid.cpp
hue.cpp
ias_ace.cpp
ias_zone.cpp
identify.cpp
json.cpp
light_node.cpp
occupancy_sensing.cpp
permitJoin.cpp
poll_control.cpp
poll_manager.cpp
power_configuration.cpp
product_match.cpp
read_files.cpp
reset_device.cpp
resource.cpp
resourcelinks.cpp
rest_alarmsystems.cpp
rest_api.cpp
rest_capabilities.cpp
rest_configuration.cpp
rest_ddf.cpp
rest_devices.cpp
rest_gateways.cpp
rest_groups.cpp
rest_info.cpp
rest_lights.cpp
rest_node_base.cpp
rest_resourcelinks.cpp
rest_rules.cpp
rest_scenes.cpp
rest_schedules.cpp
rest_sensors.cpp
rest_touchlink.cpp
rest_userparameter.cpp
rule.cpp
scene.cpp
sensor.cpp
simple_metering.cpp
state_change.cpp
thermostat.cpp
thermostat_ui_configuration.cpp
time.cpp
tuya.cpp
ui/ddf_bindingeditor.cpp
ui/ddf_editor.cpp
ui/ddf_itemeditor.cpp
ui/ddf_itemlist.cpp
ui/ddf_treeview.cpp
ui/device_widget.cpp
ui/text_lineedit.cpp
upnp.cpp
utils/bufstring.cpp
utils/scratchmem.cpp
utils/stringcache.cpp
utils/utils.cpp
websocket_server.cpp
window_covering.cpp
xiaomi.cpp
xmas.cpp
zcl_tasks.cpp
zcl/zcl.cpp
zdp/zdp.cpp
zdp/zdp_handlers.cpp
)
if (Git_FOUND)
execute_process(
COMMAND ${GIT_EXECUTABLE} log -1 --format=%at
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
OUTPUT_VARIABLE GIT_DATE
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-list HEAD --max-count=1
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
OUTPUT_VARIABLE SRC_GIT_COMMIT
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif()
target_compile_definitions(${PROJECT_NAME}
PRIVATE
USE_WEBSOCKETS=1
USE_DUKTAPE_JS_ENGINE=1
USE_ULIB_SHARED=1
GW_SW_VERSION="\"\"${PROJECT_VERSION}\"\""
GW_SW_DATE=${GIT_DATE}
GW_API_VERSION="\"\"1.16.0\"\""
GIT_COMMMIT="\"\"${SRC_GIT_COMMIT}\"\""
# Minimum version of the RaspBee firmware
# which shall be used in order to support all features for this software release (case sensitive)
GW_AUTO_UPDATE_AVR_FW_VERSION=0x260b0500
GW_AUTO_UPDATE_R21_FW_VERSION=0x26420700
GW_MIN_AVR_FW_VERSION=0x26400500
GW_MIN_R21_FW_VERSION=0x26720700
# Minimum version of the deRFusb23E0X firmware
# which shall be used in order to support all features for this software release
GW_MIN_DERFUSB23E0X_FW_VERSION=0x22030300
GW_DEFAULT_NAME="\"\"Phoscon-GW\"\""
)
target_include_directories(${PROJECT_NAME} PRIVATE cj)
if (OPENSSL_FOUND)
target_compile_definitions(${PROJECT_NAME} PRIVATE HAS_OPENSSL=1)
if (APPLE)
target_include_directories(${PROJECT_NAME} PRIVATE ${OPENSSL_INCLUDE_DIRS})
else()
target_include_directories(${PROJECT_NAME} PRIVATE ${OPENSSL_INCLUDE_DIR})
endif()
endif()
if (Qt5Core_VERSION_STRING VERSION_LESS "5.15.0")
target_compile_definitions(${PROJECT_NAME} PRIVATE SKIP_EMPTY_PARTS=QString::SkipEmptyParts )
else()
target_compile_definitions(${PROJECT_NAME} PRIVATE SKIP_EMPTY_PARTS=Qt::SkipEmptyParts )
endif()
target_link_libraries(${PROJECT_NAME}
PRIVATE Qt5::Core
PRIVATE Qt5::Gui
PRIVATE Qt5::Widgets
PRIVATE Qt5::Network
PRIVATE Qt5::WebSockets
PRIVATE SQLite::SQLite3
PRIVATE deCONZLib
)
#--------------------------------------------------------------
include(GNUInstallDirs)
if (UNIX)
if (APPLE)
set_target_properties(${PROJECT_NAME} PROPERTIES
INSTALL_RPATH @loader_path)
else()
set_target_properties(${PROJECT_NAME} PROPERTIES
INSTALL_RPATH "${CMAKE_INSTALL_FULL_LIBDIR}")
endif()
endif()
if (${CMAKE_HOST_SYSTEM_NAME} MATCHES "Linux")
install(TARGETS ${PROJECT_NAME}
LIBRARY DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/deCONZ/plugins"
)
# following applies only when build as part of deCONZ package
if (DECONZ_FULL_BUILD)
install(FILES "general.xml" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/deCONZ/zcl")
install(DIRECTORY devices DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/deCONZ")
install(FILES "button_maps.json" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/deCONZ/devices")
install(DIRECTORY "linux/deCONZ/lib/systemd" DESTINATION "/lib")
install(
DIRECTORY "linux/deCONZ/usr/bin/"
DESTINATION ${CMAKE_INSTALL_BINDIR}
FILES_MATCHING
PATTERN "*.sh"
)
endif()
endif()
#add_library(deconz_common INTERFACE)
#target_include_directories(deconz_common INTERFACE ${DECONZ_INCLUDE_DIR})
#target_link_directories(deconz_common INTERFACE /usr/local/lib)
#target_link_libraries(deconz_common
# INTERFACE Qt${QT_VERSION_MAJOR}::Core
# INTERFACE Qt${QT_VERSION_MAJOR}::Gui
# INTERFACE Qt${QT_VERSION_MAJOR}::Widgets
# INTERFACE Qt${QT_VERSION_MAJOR}::Qml
# deCONZ.so
#)
#add_subdirectory (resource)
#add_subdirectory (device_js)
#add_subdirectory (device)
#add_subdirectory (utils)
#add_subdirectory (zcl)
#add_subdirectory (zdp)
#enable_testing()
#add_subdirectory (tests)