forked from rdkcentral/control
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
executable file
·355 lines (307 loc) · 12.2 KB
/
CMakeLists.txt
File metadata and controls
executable file
·355 lines (307 loc) · 12.2 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
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
##########################################################################
# If not stated otherwise in this file or this component's LICENSE
# file the following copyright and licenses apply:
#
# Copyright 2019 RDK Management
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
##########################################################################
# CMAKE OPTIONS
cmake_minimum_required(VERSION 3.16)
if(CMAKE_VERSION GREATER_EQUAL 3.21)
set(CMAKE_C_STANDARD 23)
else()
set(CMAKE_C_STANDARD 11)
endif()
set(CMAKE_VERBOSE_MAKEFILE ON)
set(CMAKE_BUILD_TYPE Release)
set(CMAKE_NO_SYSTEM_FROM_IMPORTED ON)
# PROJECT
project(ctrlm-main VERSION ${CMAKE_PROJECT_VERSION})
# OPTIONS
option(A5000_ENABLE "ES1 A5000 use libse051" OFF)
option(ANSI_CODES_DISABLED "Disable ANSI code logging" OFF)
option(ASSERT_ON_WRONG_THREAD "Assert on wrong thread" OFF)
option(AUTH_ENABLED "Enable AUTH" OFF)
option(BLE_ENABLED "Enable BLE" ON)
option(BLE_SERVICES "Enable BLE Services" OFF)
option(BREAKPAD "Enable BREAKPAD" OFF)
option(BUILD_CTRLM_FACTORY "Build Control Factory Test" OFF)
option(DEEPSLEEP_CLOSE_DB "Deep Sleep Close DB" OFF)
option(ENABLE_NETWORKED_STANDBY_MODE "Enable Networked Standby Mode)" OFF)
option(FACTORY_AUDIO_PLAYBACK "Factory test audio playback" OFF)
option(FACTORY_CUSTOM_AUDIO_ANALYSIS "Factory custom audio analysis" OFF)
option(FDC_ENABLED "Enable FDC" OFF)
option(IP_ENABLED "Enable IP" OFF)
option(LOCAL_MIC "Local Microphone" OFF)
option(LOCAL_MIC_DISABLE_VIA_PRIVACY "Use Privacy to disable microphone" OFF)
option(MEM_DEBUG "Enable memory debugging" OFF)
option(MEMORY_LOCK "Memory Lock" OFF)
option(MIC_TAP "Enable MIC_TAP" OFF)
option(RF4CE_ENABLED "Enable RF4CE" ON)
option(TELEMETRY_SUPPORT "Enable TELEMETRY_SUPPORT" OFF)
option(THUNDER "Enable THUNDER" ON)
option(THUNDER_SECURITY "Enable THUNDER_SECURITY" OFF)
option(USE_SAFEC "Use safec" OFF)
option(USE_IARM_POWER_MANAGER "Use IARM Power Manager" OFF)
option(VOICE_KEYWORD_BEEP "Enable VOICE_KEYWORD_BEEP" OFF)
option(XRSR_HTTP "Enable XRSR_HTTP" OFF)
option(XRSR_SDT "Enable XRSR_SDT" OFF)
option(ENABLE_ASYNC_SRVR_MSG "Enable Asynchronous Server Messaging Feature" OFF)
option(ENABLE_AVS_WITH_SDT "Enable SDT Based AVS Support" OFF)
option(USE_DEPRECATED_HDMI_INPUT_PLUGIN "Use deprecated HDMI Input plugin instead of AV Input plugin" OFF)
# BUILD SYSTEM
set(STAGING_BINDIR_NATIVE, "invalid" CACHE PATH "staging bin dir native")
set(BUILD_SYSTEM "NONE" CACHE STRING "Specify the Build System being used")
set_property(CACHE BUILD_SYSTEM PROPERTY STRINGS "NONE" "YOCTO")
# BUILD VARIABLES
set(BEEP_ON_KWD_FILE "NONE" CACHE STRING "Keyword Beep file name")
# This is required to allow an executable to export symbols to be used by loadable modules (e.g. plugins using dlopen)
set(CMAKE_ENABLE_EXPORTS ON)
# EXECUTABLE(S)
add_executable(controlMgr src/ctrlm_config_default.json ctrlm_version_build.h ctrlm_config_default.h ${CMAKE_CURRENT_SOURCE_DIR}/src/ctrlm_config_default.c)
if(BUILD_CTRLM_FACTORY)
add_library(ctrlm-fta)
add_executable(controlFactory)
endif()
# INCLUDES
include_directories( ${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
include
src
src/asb
src/attributes
src/auth
src/ble/hal/blercu
src/ble/hal
src/ble/hal/utils
src/config
src/shared_memory
src/database
src/network
src/rfc
src/rf4ce/rib
src/irdb
src/irdb/ipc
src/voice
src/voice/endpoints
src/voice/ipc
src/voice/telemetry
src/thunder
src/thunder/helpers
src/thunder/plugins
src/telemetry
src/ipc
src/input_event
${CMAKE_SYSROOT}/usr/include/safeclib
${CMAKE_SYSROOT}/usr/include/libsafec
${CMAKE_SYSROOT}/usr/include/nopoll
${CMAKE_SYSROOT}/usr/include
${CMAKE_SYSROOT}/usr/lib/dbus-1.0/include
${CMAKE_SYSROOT}/usr/include/dbus-1.0
${CMAKE_SYSROOT}/usr/include/glib-2.0
${CMAKE_SYSROOT}/usr/lib/glib-2.0/include
${CMAKE_SYSROOT}/usr/include/gio-unix-2.0
${CMAKE_SYSROOT}/usr/include/rdk/iarmbus
${CMAKE_SYSROOT}/usr/include/nopoll
${CMAKE_SYSROOT}/usr/include/rdk/iarmmgrs-hal
${CMAKE_SYSROOT}/usr/include/wdmp-c
${CMAKE_SYSROOT}/usr/include/rdk/ds
${CMAKE_SYSROOT}/usr/include/rdk/ds-rpc
${CMAKE_SYSROOT}/usr/include/rdk/ds-hal
${CMAKE_SYSROOT}/usr/include/rdk/halif/ds-hal
${CMAKE_SYSROOT}/usr/include/WPEFramework
${CMAKE_SYSROOT}/usr/include/breakpad
)
# SOURCES
add_subdirectory(src)
# COMPILER OPTIONS
target_compile_options(controlMgr PUBLIC -fPIC -rdynamic -Wall -Werror)
add_compile_definitions(_REENTRANT _POSIX_C_SOURCE=200809L _GNU_SOURCE _REENTRANT)
target_link_libraries(
controlMgr
xr-voice-sdk
rdkversion
rt
pthread
stdc++
sqlite3
curl
gio-2.0
gobject-2.0
glib-2.0
z
archive
jansson
dbus-1
uuid
IARMBus
ds
nopoll
ssl
crypto
systemd
dshalcli
rfcapi
secure_wrapper
evdev
${CMAKE_DL_LIBS}
)
install(TARGETS controlMgr RUNTIME DESTINATION bin)
install(FILES ${CMAKE_BINARY_DIR}/ctrlm_config.json.template DESTINATION ${CMAKE_INSTALL_SYSCONFDIR} COMPONENT config )
# DEFINES FROM OPTIONS
if(A5000_ENABLE)
find_library( SE_HAL_PATH SE_HAL ${CMAKE_SYSROOT}/usr/lib/se051)
target_link_libraries(controlMgr ${SE_HAL_PATH})
endif()
if(ANSI_CODES_DISABLED)
add_compile_definitions(ANSI_CODES_DISABLED)
endif()
if(ASSERT_ON_WRONG_THREAD)
add_compile_definitions(ASSERT_ON_WRONG_THREAD)
endif()
if(BLE_ENABLED)
target_link_libraries(controlMgr BTMgr)
if(BLE_SERVICES)
add_compile_definitions(CTRLM_BLE_SERVICES)
target_link_libraries(controlMgr ctrlm-ble-services.a)
endif()
endif()
if(BREAKPAD)
target_link_libraries(controlMgr breakpadwrapper)
add_compile_definitions(BREAKPAD_SUPPORT)
endif()
if(DEEPSLEEP_CLOSE_DB)
add_compile_definitions(DEEPSLEEP_CLOSE_DB)
endif()
if(ENABLE_ASYNC_SRVR_MSG)
add_compile_definitions(SUPPORT_ASYNC_SRVR_MSG)
endif()
if(ENABLE_AVS_WITH_SDT)
add_compile_definitions(SUPPORT_VOICE_DEST_ALSA SUPPORT_ASYNC_SRVR_MSG)
endif()
if(ENABLE_NETWORKED_STANDBY_MODE)
add_compile_definitions(NETWORKED_STANDBY_MODE_ENABLED)
endif()
if(FDC_ENABLED)
add_compile_definitions(FDC_ENABLED)
endif()
if(IP_ENABLED)
add_compile_definitions(CTRLM_NETWORK_IP CTRLM_IP_HAL_LOG_ENABLED)
endif()
if(LOCAL_MIC)
add_compile_definitions(CTRLM_LOCAL_MIC)
if(MIC_TAP)
add_compile_definitions(CTRLM_LOCAL_MIC_TAP)
endif()
if(LOCAL_MIC_DISABLE_VIA_PRIVACY)
add_compile_definitions(CTRLM_LOCAL_MIC_DISABLE_VIA_PRIVACY)
endif()
endif()
if(MEM_DEBUG)
add_compile_definitions(MEM_DEBUG)
endif()
if(MEMORY_LOCK)
add_compile_definitions(MEMORY_LOCK)
target_link_libraries(controLMgr clnl)
endif()
# RF4CE options
if(RF4CE_ENABLED)
# All RF4CE platforms have HAL NVM
add_compile_definitions(CTRLM_NETWORK_HAS_HAL_NVM)
endif()
if(TELEMETRY_SUPPORT)
add_compile_definitions(TELEMETRY_SUPPORT)
target_link_libraries(controlMgr telemetry_msgsender)
endif()
if(THUNDER)
add_compile_definitions(CTRLM_THUNDER)
target_link_libraries(controlMgr WPEFrameworkCore WPEFrameworkPlugins)
if(WPE_FRAMEWORK_COM_SOCKET)
target_link_libraries(controlMgr WPEFrameworkCOM WPEFrameworkWebSocket)
endif()
if(WPE_FRAMEWORK_PROTO_TRACING)
target_link_libraries(controlMgr WPEFrameworkProtocols WPEFrameworkTracing)
endif()
if(THUNDER_SECURITY)
add_compile_definitions(THUNDER_SECURITY)
target_link_libraries(controlMgr WPEFrameworkSecurityUtil)
endif()
if(AUTH_ENABLED)
add_compile_definitions(AUTH_ENABLED)
add_compile_definitions(AUTH_ACCOUNT_ID)
add_compile_definitions(AUTH_DEVICE_ID)
add_compile_definitions(AUTH_PARTNER_ID)
add_compile_definitions(AUTH_SAT_TOKEN)
if(AUTH_ACTIVATION_STATUS)
add_compile_definitions(AUTH_ACTIVATION_STATUS)
endif()
#By default disabled but can be enabled
#add_compile_definitions(AUTH_EXPERIENCE)
target_link_libraries(controlMgr RdkCertSelector)
endif()
endif()
if(USE_IARM_POWER_MANAGER)
add_compile_definitions(USE_IARM_POWER_MANAGER)
endif()
if(USE_SAFEC)
find_package(PkgConfig)
pkg_check_modules(SAFEC REQUIRED libsafec)
if(SAFEC_FOUND)
target_link_libraries(controlMgr ${SAFEC_LIBRARIES})
endif()
else()
add_compile_definitions(SAFEC_DUMMY_API)
endif()
if(VOICE_KEYWORD_BEEP)
add_compile_definitions(BEEP_ON_KWD_ENABLED)
add_definitions(-DBEEP_ON_KWD_FILE=\"${CMAKE_DATADIR}/${BEEP_ON_KWD_FILE}\")
install(FILES ${CMAKE_SOURCE_DIR}/../${BEEP_ON_KWD_FILE} DESTINATION share )
endif()
if(USE_DEPRECATED_HDMI_INPUT_PLUGIN)
add_compile_definitions(USE_DEPRECATED_HDMI_INPUT_PLUGIN)
endif()
install(TARGETS controlMgr RUNTIME DESTINATION bin)
install(FILES ${CMAKE_BINARY_DIR}/ctrlm_config.json.template DESTINATION ${CMAKE_INSTALL_SYSCONFDIR} COMPONENT config )
# GENERATED FILES
add_custom_command( OUTPUT ctrlm_version_build.h
COMMAND echo -n "#define CTRLM_MAIN_BRANCH \"" >> ctrlm_version_build.h
COMMAND git -C ${CMAKE_CURRENT_SOURCE_DIR} branch --all --contains | sed -n -e "s/^\\s*remotes\\/origin\\///" -e "2p" | tr -d "\\n" >> ctrlm_version_build.h
COMMAND echo "\"" >> ctrlm_version_build.h
COMMAND echo -n "#define CTRLM_MAIN_COMMIT_ID " >> ctrlm_version_build.h
COMMAND git -C ${CMAKE_CURRENT_SOURCE_DIR} log --format=\"%H\" -n 1 >> ctrlm_version_build.h
COMMAND echo -n "#define CTRLM_MAIN_VERSION \"${CMAKE_PROJECT_VERSION}" >> ctrlm_version_build.h
COMMAND git -C ${CMAKE_CURRENT_SOURCE_DIR} diff --quiet || echo -n "++" >> ctrlm_version_build.h
COMMAND echo "\"" >> ctrlm_version_build.h
VERBATIM
)
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/ctrlm_config.json.template
COMMAND python3 ${CTRLM_UTILS_JSON_COMBINE} -i ${CMAKE_CURRENT_SOURCE_DIR}/src/ctrlm_config_default.json -a ${CTRLM_CONFIG_JSON_VSDK}:vsdk -a ${CTRLM_CONFIG_JSON_CPC} -s ${CTRLM_CONFIG_JSON_CPC_SUB} -a ${CTRLM_CONFIG_JSON_CPC_ADD} -s ${CTRLM_CONFIG_JSON_OEM_SUB} -a ${CTRLM_CONFIG_JSON_OEM_ADD} -s ${CTRLM_CONFIG_JSON_MAIN_SUB} -a ${CTRLM_CONFIG_JSON_MAIN_ADD} -o ${CMAKE_BINARY_DIR}/ctrlm_config.json.template
DEPENDS src/ctrlm_config_default.json
VERBATIM
)
add_custom_command(
OUTPUT ctrlm_config_default.h ${CMAKE_CURRENT_SOURCE_DIR}/src/ctrlm_config_default.c
COMMAND python3 ${CTRLM_UTILS_JSON_TO_HEADER} -i ${CMAKE_BINARY_DIR}/ctrlm_config.json.template -o ctrlm_config_default.h -c ${CMAKE_CURRENT_SOURCE_DIR}/src/ctrlm_config_default.c -v "ctrlm_global,network_rf4ce,network_ip,network_ble,ir,voice,device_update" -d "network_ble"
DEPENDS ${CMAKE_BINARY_DIR}/ctrlm_config.json.template
VERBATIM
)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/src/voice/ipc/ctrlm_voice_ipc_request_type.c
COMMAND gperf --output-file=${CMAKE_CURRENT_SOURCE_DIR}/src/voice/ipc/ctrlm_voice_ipc_request_type.c ${CMAKE_CURRENT_SOURCE_DIR}/src/voice/ipc/ctrlm_voice_ipc_request_type.hash
VERBATIM
)
add_custom_target( ctrlm_config
DEPENDS ${CMAKE_BINARY_DIR}/ctrlm_config.json.template
)