-
Notifications
You must be signed in to change notification settings - Fork 294
/
CMakeLists.txt
543 lines (462 loc) · 23.9 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
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
#######
# SPDX license identifier: MPL-2.0
#
# Copyright(C) 2011-2015, BMW AG
#
# This file is part of COVESA Project DLT - Diagnostic Log and Trace.
#
# This Source Code Form is subject to the terms of the
# Mozilla Public License(MPL), v. 2.0.
# If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# For further information see http://www.covesa.org/.
#######
# Set minimum Cmake version and setup policy behavior
cmake_minimum_required(VERSION 3.3)
if(${CMAKE_VERSION} VERSION_GREATER "3.20" OR ${CMAKE_VERSION} VERSION_EQUAL "3.20")
cmake_policy(SET CMP0115 OLD)
endif()
project(automotive-dlt VERSION 2.18.10)
mark_as_advanced(CMAKE_BACKWARDS_COMPATIBILITY)
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE)
include(GNUInstallDirs)
# Set version parameters
set(DLT_VERSION_STATE STABLE)
execute_process(COMMAND git describe --tags WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE DLT_REVISION
ERROR_VARIABLE GIT_ERROR
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_STRIP_TRAILING_WHITESPACE)
if(DLT_REVISION MATCHES "^$")
set(PRINT_REVISION "Git revision unavailable")
else(DLT_REVISION MATCHES "")
string(REPLACE "-" "_" DLT_REVISION ${DLT_REVISION})
set(PRINT_REVISION ${DLT_REVISION})
endif()
# set default build type, if not defined by user
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
"Choose build type: Debug, Release, RelWithDebInfo, MinSizeRel."
FORCE)
message(STATUS "Build type not defined. Using default build type 'RelWithDebInfo'.")
endif()
include(CMakeDependentOption)
# Set of indiviual options
option(BUILD_SHARED_LIBS "Set to OFF to build static libraries" ON)
option(WITH_SYSTEMD "Set to ON to create unit files and systemd check on dlt-daemon startup" OFF)
option(WITH_SYSTEMD_WATCHDOG "Set to ON to use the systemd watchdog in dlt-daemon" OFF)
option(WITH_SYSTEMD_WATCHDOG_ENFORCE_MSG_RX "Set to ON to trigger systemd watchdog of dlt-daemon only
when a message was received since the last trigger" OFF)
option(WITH_SYSTEMD_WATCHDOG_ENFORCE_MSG_RX_DLT_SYSTEM "Set to ON to trigger systemd watchdog of dlt-system
only when a message was received since the last trigger" OFF)
option(WITH_SYSTEMD_JOURNAL "Set to ON to use the systemd journal in dlt-system" OFF)
option(WITH_SYSTEMD_SOCKET_ACTIVATION "Set to ON to use systemd socket activation" OFF)
option(WITH_DOC "Set to ON to build documentation target" OFF)
option(WITH_MAN "Set to ON to build man pages" OFF)
option(WITH_CHECK_CONFIG_FILE "Set to ON to create a configure file of CheckIncludeFiles, CheckFunctionExists" OFF)
option(WITH_TESTSCRIPTS "Set to ON to run CMakeLists.txt in testscripts" OFF)
option(WITH_GPROF "Set -pg to compile flags" OFF)
option(WITH_DLTTEST "Set to ON to build with modifications to test User-Daemon communication with corrupt messages" OFF)
option(WITH_DLT_SHM_ENABLE "EXPERIMENTAL! Set to ON to use shared memory as IPC. EXPERIMENTAL!" OFF)
option(WITH_DLT_ADAPTOR "Set to ON to build src/adaptor binaries" OFF)
option(WITH_DLT_ADAPTOR_STDIN "Set to ON to build src/adaptor/stdin binaries" OFF)
option(WITH_DLT_ADAPTOR_UDP "Set to ON to build src/adaptor/udp binaries" OFF)
option(WITH_DLT_CONSOLE "Set to ON to build src/console binaries" ON)
option(WITH_DLT_CONSOLE_WO_CTRL "Set to ON not to build control commands under src/console" OFF)
option(WITH_DLT_CONSOLE_WO_SBTM "Set to ON not to build dlt-sortbytimestamp under src/console" OFF)
option(WITH_DLT_CONSOLE_RECEIVE "Set to OFF to skip building dlt_receive" ON)
option(WITH_DLT_CONSOLE_CONVERT "Set to OFF to skip building dlt_convert" ON)
option(WITH_DLT_CONSOLE_CONTROL "Set to OFF to skip building dlt_control" ON)
option(WITH_DLT_CONSOLE_PASSIVE_NODE_CTRL "Set to OFF to skip building dlt_passive_node_ctrl" ON)
option(WITH_DLT_EXAMPLES "Set to ON to build src/examples binaries" ON)
option(WITH_DLT_FILETRANSFER "Set to ON to build dlt-system with filetransfer support" OFF)
option(WITH_DLT_SYSTEM "Set to ON to build src/system binaries" OFF)
option(WITH_DLT_DBUS "Set to ON to build src/dbus binaries" OFF)
option(WITH_DLT_TESTS "Set to ON to build src/test binaries" ON)
option(WITH_DLT_UNIT_TESTS "Set to ON to build gtest framework and tests/binaries" OFF)
cmake_dependent_option(WITH_DLT_INSTALLED_TESTS "Set to ON to install tests/binaries" OFF WITH_DLT_UNIT_TESTS OFF)
option(WITH_DLT_COVERAGE "Set to ON to generate coverage report for dlt-daemon source code" OFF)
option(BUILD_GMOCK "Set to ON to enable gmock build" OFF)
option(WITH_GIT_SUBMODULE "Set to ON to update submodules during build" OFF)
option(WITH_DLT_QNX_SYSTEM "Set to ON to build QNX system binary dlt-qnx-system" OFF)
option(WITH_DLT_FILE_LOGGING_SYSLOG_FALLBACK "Set to ON to enable fallback to syslog if dlt logging to file fails" OFF)
option(WITH_DLT_NETWORK_TRACE "Set to ON to enable network trace (if message queue is supported)" ON)
option(WITH_DLT_LOG_LEVEL_APP_CONFIG "Set to ON to enable default log levels based on application ids" OFF)
option(WITH_DLT_TRACE_LOAD_CTRL "Set to ON to enable trace load control in libdlt and dlt-daemon" OFF)
set(DLT_IPC "FIFO"
CACHE STRING "UNIX_SOCKET,FIFO")
set(DLT_USER "covesa"
CACHE STRING "Set user for process not run as root")
set(DLT_QNX_SLOG_ADAPTER_WAIT_BUFFER_TIMEOUT_MS "100"
CACHE STRING "Timeout in milliseconds to wait before messages are dropped when input buffer is full")
option(WITH_DLT_PKGCONFIG "Set to ON to generate pkgconfig .pc files" ON)
option(WITH_DLT_CXX11_EXT "Set to ON to build C++11 extensions" OFF)
option(WITH_DLT_COREDUMPHANDLER "EXPERIMENTAL! Set to ON to build src/core_dump_handler binaries. EXPERIMENTAL" OFF)
option(WITH_DLT_LOGSTORAGE_CTRL_UDEV "PROTOTYPE! Set to ON to build logstorage control with udev support" OFF)
option(WITH_DLT_LOGSTORAGE_GZIP "Set to ON to build logstorage control with gzip compression support" OFF)
option(WITH_DLT_USE_IPv6 "Set to ON for IPv6 support" ON)
option(WITH_DLT_KPI "Set to ON to build src/kpi binaries" OFF)
option(WITH_DLT_FATAL_LOG_TRAP "Set to ON to enable DLT_LOG_FATAL trap(trigger segv inside dlt-user library)" OFF)
option(WITH_UDP_CONNECTION "Set to ON to enable dlt UDP multicast SUPPORT" OFF)
option(WITH_LIB_SHORT_VERSION "Set to ON to build library with only major number in version" OFF)
option(WITH_DLT_DISABLE_MACRO "Set to ON to build code without Macro interface support" OFF)
option(WITH_LEGACY_INCLUDE_PATH "Set to ON to add <prefix>/dlt to include paths
for the CMake config file, in addition to only <prefix>" ON)
option(WITH_EXTENDED_FILTERING "Set to OFF to build without extended filtering.
Json filter only supports Linux based system with json-c and QNX" OFF)
option(WITH_DLT_DAEMON_VSOCK_IPC "Set to ON to enable VSOCK support in daemon" OFF)
option(WITH_DLT_LIB_VSOCK_IPC "Set to ON to enable VSOCK support in library (DLT_IPC is not used in library)" OFF)
set(DLT_VSOCK_PORT "13490"
CACHE STRING "VSOCK port number for logging traffic.")
set(DLT_WRITEV_TIMEOUT_SEC "1"
CACHE STRING "Set sec timeout for writev to prevent blocking indefinitely")
set(DLT_WRITEV_TIMEOUT_USEC "0"
CACHE STRING "Set usec timeout for writev to prevent blocking indefinitely")
# RPM settings
set(COVESA_RPM_RELEASE "1") # ${DLT_REVISION}
set(LICENSE "Mozilla Public License Version 2.0")
# Build, project and include settings
find_package(Threads REQUIRED)
if(WITH_DLT_LOGSTORAGE_GZIP)
find_package(ZLIB 1.2.9 REQUIRED)
set(ZLIB_LIBRARY "ZLIB::ZLIB")
elseif(WITH_DLT_COREDUMPHANDLER OR WITH_DLT_FILETRANSFER)
find_package(ZLIB REQUIRED)
set(ZLIB_LIBRARY "ZLIB::ZLIB")
else()
set(ZLIB_LIBRARY "")
endif()
if(WITH_DLT_DBUS)
find_package(PkgConfig REQUIRED)
pkg_check_modules(DBUS REQUIRED dbus-1)
endif()
include_directories(
${PROJECT_SOURCE_DIR}
${PROJECT_BINARY_DIR}/include/dlt
${PROJECT_SOURCE_DIR}/include/dlt
${PROJECT_SOURCE_DIR}/src/shared
${PROJECT_SOURCE_DIR}/src/core_dump_handler
${PROJECT_SOURCE_DIR}/src/offlinelogstorage
${PROJECT_SOURCE_DIR}/src/lib
${PROJECT_SOURCE_DIR}/src/daemon
${PROJECT_SOURCE_DIR}/src/console
${PROJECT_SOURCE_DIR}/src/gateway
${PROJECT_SOURCE_DIR}/systemd/3rdparty
)
add_definitions(-D_GNU_SOURCE)
add_definitions(-DDLT_WRITEV_TIMEOUT_SEC=${DLT_WRITEV_TIMEOUT_SEC})
add_definitions(-DDLT_WRITEV_TIMEOUT_USEC=${DLT_WRITEV_TIMEOUT_USEC})
add_definitions(-DDLT_QNX_SLOG_ADAPTER_WAIT_BUFFER_TIMEOUT_MS=${DLT_QNX_SLOG_ADAPTER_WAIT_BUFFER_TIMEOUT_MS})
if(NOT DLT_IPC STREQUAL "UNIX_SOCKET" AND NOT DLT_IPC STREQUAL "FIFO")
message(FATAL_ERROR "${DLT_IPC} is not a valid value for DLT_IPC")
endif()
add_definitions(-DDLT_DAEMON_USE_${DLT_IPC}_IPC)
if(WITH_DLT_DAEMON_VSOCK_IPC)
add_definitions(-DDLT_DAEMON_VSOCK_IPC_ENABLE)
endif()
if(NOT WITH_DLT_LIB_VSOCK_IPC)
add_definitions(-DDLT_LIB_USE_${DLT_IPC}_IPC)
else()
add_definitions(-DDLT_LIB_USE_VSOCK_IPC)
endif()
if(WITH_DLT_DAEMON_VSOCK_IPC OR WITH_DLT_LIB_VSOCK_IPC)
add_definitions(-DDLT_VSOCK_PORT=${DLT_VSOCK_PORT})
endif()
if(NOT DLT_USER_IPC_PATH)
set(DLT_USER_IPC_PATH "/tmp")
endif()
add_definitions(-DDLT_USER_IPC_PATH="${DLT_USER_IPC_PATH}")
if(WITH_DLTTEST)
add_definitions(-DDLT_TEST_ENABLE)
endif()
if(WITH_DLT_UNIT_TESTS)
add_definitions(-DDLT_UNIT_TESTS)
endif()
if(WITH_DLT_SHM_ENABLE)
add_definitions(-DDLT_SHM_ENABLE)
endif()
if(WITH_DLT_USE_IPv6)
add_definitions(-DDLT_USE_IPv6)
endif()
if(WITH_DLT_QNX_SYSTEM AND NOT "${CMAKE_C_COMPILER}" MATCHES "nto-qnx|qcc|ntoaarch64-gcc|ntox86_64-gcc")
message(FATAL_ERROR "Can only compile for QNX with a QNX compiler, but found '${CMAKE_C_COMPILER}'.")
endif()
if(WITH_DLT_FILE_LOGGING_SYSLOG_FALLBACK)
add_definitions(-DWITH_DLT_FILE_LOGGING_SYSLOG_FALLBACK)
endif()
if(WITH_DLT_LOGSTORAGE_GZIP)
add_definitions(-DDLT_LOGSTORAGE_USE_GZIP)
endif()
if(WITH_GPROF)
add_compile_options(-pg)
endif()
if(WITH_DLT_COVERAGE)
add_definitions(-DWITH_DLT_COVERAGE)
set(WITH_DLT_UNIT_TESTS ON)
if(WITH_DLT_UNIT_TESTS)
add_definitions(-DDLT_UNIT_TESTS)
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage")
endif()
add_compile_options(
$<$<COMPILE_LANGUAGE:C>:-std=gnu99>
$<$<COMPILE_LANGUAGE:CXX>:-std=gnu++14>
-Wall
-Wextra
# -pedantic
-Wno-variadic-macros
-Wno-strict-aliasing
)
if(WITH_DOC STREQUAL "OFF")
set(PACKAGE_DOC "#")
else()
set(PACKAGE_DOC "")
endif()
if(BUILD_SHARED_LIBS)
set(CMAKE_STATIC_LIB_PATH "")
else()
set(CMAKE_STATIC_LIB_PATH "-L\$\{libdir\}/static")
endif()
if(WITH_DLT_PKGCONFIG)
configure_file(${PROJECT_SOURCE_DIR}/${PROJECT_NAME}.spec.in ${PROJECT_BINARY_DIR}/${PROJECT_NAME}.spec)
configure_file(${PROJECT_SOURCE_DIR}/${PROJECT_NAME}.pc.in ${PROJECT_BINARY_DIR}/${PROJECT_NAME}.pc @ONLY)
install(FILES ${PROJECT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig COMPONENT devel)
endif()
if(WITH_DLT_CXX11_EXT AND WITH_DLT_PKGCONFIG)
configure_file(${PROJECT_SOURCE_DIR}/${PROJECT_NAME}-c++.pc.in ${PROJECT_BINARY_DIR}/${PROJECT_NAME}-c++.pc @ONLY)
install(FILES ${PROJECT_BINARY_DIR}/${PROJECT_NAME}-c++.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig COMPONENT devel)
endif()
set(CONFIGURATION_FILES_DIR ${CMAKE_INSTALL_SYSCONFDIR})
add_definitions(-DCONFIGURATION_FILES_DIR="${CMAKE_INSTALL_PREFIX}/${CONFIGURATION_FILES_DIR}")
add_subdirectory(cmake)
if(WITH_DLT_NETWORK_TRACE)
# Message queue
if(HAVE_MQUEUE_H AND HAVE_FUNC_MQOPEN AND HAVE_FUNC_MQCLOSE AND
HAVE_FUNC_MQUNLINK AND HAVE_FUNC_MQSEND AND HAVE_FUNC_MQRECEIVE)
add_definitions(-DDLT_NETWORK_TRACE_ENABLE)
set(DLT_NETWORK_TRACE_ENABLE 1)
else()
message(STATUS "Disable network trace interface since message queue is not supported")
endif()
else()
message(STATUS "Network trace interface disabled")
endif()
if(WITH_SYSTEMD
OR WITH_SYSTEMD_WATCHDOG
OR WITH_SYSTEMD_WATCHDOG_ENFORCE_MSG_RX
OR WITH_SYSTEMD_WATCHDOG_ENFORCE_MSG_RX_DLT_SYSTEM
OR WITH_SYSTEMD_JOURNAL
OR WITH_SYSTEMD_SOCKET_ACTIVATION)
find_package(PkgConfig REQUIRED)
execute_process(COMMAND pkg-config --modversion systemd OUTPUT_VARIABLE SYSTEMD_VERSION)
string(REPLACE "\n" "" SYSTEMD_VERSION ${SYSTEMD_VERSION})
if(WITH_SYSTEMD)
add_definitions(-DDLT_SYSTEMD_ENABLE)
endif()
if(WITH_SYSTEMD_WATCHDOG)
add_definitions(-DDLT_SYSTEMD_WATCHDOG_ENABLE)
endif()
if(WITH_SYSTEMD_JOURNAL)
add_definitions(-DDLT_SYSTEMD_JOURNAL_ENABLE)
endif()
if(WITH_SYSTEMD_WATCHDOG_ENFORCE_MSG_RX)
add_definitions(-DDLT_SYSTEMD_WATCHDOG_ENFORCE_MSG_RX_ENABLE)
endif()
if(WITH_SYSTEMD_WATCHDOG_ENFORCE_MSG_RX_DLT_SYSTEM)
add_definitions(-DDLT_SYSTEMD_WATCHDOG_ENFORCE_MSG_RX_ENABLE_DLT_SYTSTEM)
endif()
if(WITH_SYSTEMD_SOCKET_ACTIVATION)
if(NOT DLT_IPC STREQUAL "UNIX_SOCKET")
message(FATAL_ERROR "WITH_SYSTEMD_SOCKET_ACTIVATION is only supported for UNIX_SOCKET")
endif()
add_definitions(-DDLT_SYSTEM_SOCKET_ACTIVATION_ENABLE)
endif()
set(systemd_SRCS ${PROJECT_SOURCE_DIR}/systemd/3rdparty/sd-daemon.c)
set(SYSTEMD_UNITDIR "${CMAKE_INSTALL_PREFIX}/lib/systemd/system" CACHE PATH
"Set directory to install systemd unit files")
add_subdirectory(systemd)
else()
set(systemd_SRCS "")
endif()
if(WITH_DLT_LOGSTORAGE_CTRL_UDEV)
add_definitions(-DDLT_LOGSTORAGE_CTRL_UDEV_ENABLE)
endif()
if(WITH_DLT_FATAL_LOG_TRAP)
add_definitions(-DDLT_FATAL_LOG_RESET_ENABLE)
endif()
if(WITH_DLT_FILTER_BACKEND_PROP)
add_definitions(-DHAS_PROPRIETARY_FILTER_BACKEND)
endif()
if(WITH_EXTENDED_FILTERING)
if(("${CMAKE_SYSTEM_NAME}" MATCHES "Linux") OR ("${CMAKE_SYSTEM_NAME}" MATCHES "Android"))
find_package(PkgConfig REQUIRED)
pkg_check_modules(JSON REQUIRED json-c)
set(DLT_JSON_LIBRARY ${JSON_LIBRARIES})
elseif("${CMAKE_SYSTEM_NAME}" MATCHES "QNX")
set(DLT_JSON_LIBRARY json)
else()
message(FATAL_ERROR "OS does not support extended filtering.
Please build without cmake option '-DWITH_EXTENDED_FILTERING=OFF'")
endif()
add_definitions(-DEXTENDED_FILTERING)
else()
set(DLT_JSON_LIBRARY "")
endif()
if(WITH_DLT_LOG_LEVEL_APP_CONFIG)
add_definitions(-DDLT_LOG_LEVEL_APP_CONFIG)
endif()
if(WITH_DLT_TRACE_LOAD_CTRL)
add_definitions(-DDLT_TRACE_LOAD_CTRL_ENABLE)
# Configure limits for client
if(NOT TRACE_LOAD_USER_SOFT_LIMIT)
set(TRACE_LOAD_USER_SOFT_LIMIT 83333)
endif()
if(NOT TRACE_LOAD_USER_HARD_LIMIT)
set(TRACE_LOAD_USER_HARD_LIMIT 100000)
endif()
if (TRACE_LOAD_USER_SOFT_LIMIT GREATER TRACE_LOAD_USER_HARD_LIMIT)
message(FATAL_ERROR "TRACE_LOAD_USER_SOFT_LIMIT must be less or equal than TRACE_LOAD_USER_HARD_LIMIT")
endif()
add_definitions(-DDLT_TRACE_LOAD_CLIENT_HARD_LIMIT_DEFAULT=${TRACE_LOAD_USER_HARD_LIMIT})
add_definitions(-DDLT_TRACE_LOAD_CLIENT_SOFT_LIMIT_DEFAULT=${TRACE_LOAD_USER_SOFT_LIMIT})
# Configure limits for daemon
if(NOT TRACE_LOAD_DAEMON_SOFT_LIMIT)
if (WITH_DLT_UNIT_TESTS)
set(TRACE_LOAD_DAEMON_SOFT_LIMIT 83333)
else()
set(TRACE_LOAD_DAEMON_SOFT_LIMIT 0)
endif()
endif()
if(NOT TRACE_LOAD_DAEMON_HARD_LIMIT)
if (WITH_DLT_UNIT_TESTS)
set(TRACE_LOAD_DAEMON_HARD_LIMIT 100000)
else()
set(TRACE_LOAD_DAEMON_HARD_LIMIT 0)
endif()
endif()
if (TRACE_LOAD_DAEMON_SOFT_LIMIT GREATER TRACE_LOAD_DAEMON_HARD_LIMIT)
message(FATAL_ERROR "TRACE_LOAD_DAEMON_SOFT_LIMIT must be less or equal than TRACE_LOAD_DAEMON_HARD_LIMIT")
endif()
add_definitions(-DDLT_TRACE_LOAD_DAEMON_HARD_LIMIT_DEFAULT=${TRACE_LOAD_DAEMON_HARD_LIMIT})
add_definitions(-DDLT_TRACE_LOAD_DAEMON_SOFT_LIMIT_DEFAULT=${TRACE_LOAD_DAEMON_SOFT_LIMIT})
endif(WITH_DLT_TRACE_LOAD_CTRL)
add_subdirectory(doc)
add_subdirectory(src)
add_subdirectory(include)
add_subdirectory(testscripts)
if(WITH_GIT_SUBMODULE)
add_definitions(-DWITH_GIT_SUBMODULE)
endif()
if(WITH_DLT_UNIT_TESTS)
find_package(GTest)
if(GTEST_FOUND)
find_package(PkgConfig REQUIRED)
execute_process(COMMAND pkg-config --modversion gtest OUTPUT_VARIABLE GTEST_VERSION)
string(REPLACE "\n" "" GTEST_VERSION ${GTEST_VERSION})
if(${GTEST_VERSION} VERSION_LESS 1.7.0)
message(WARNING "Please use Gtest version greater or equal to 1.7.0,
or use option 'WITH_GIT_SUBMODULE' for latest version")
endif()
else()
message(STATUS "No Gtest package found, preparing submodule ...")
set(WITH_GIT_SUBMODULE ON)
endif()
if(WITH_GIT_SUBMODULE)
find_package(Git QUIET)
if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
message(STATUS "Submodule updating ...")
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE GIT_SUBMOD_RESULT)
if(NOT GIT_SUBMOD_RESULT EQUAL "0")
message(FATAL_ERROR "git submodule update --init --recursive failed with ${GIT_SUBMOD_RESULT}.
Please checkout submodule")
endif()
endif()
if(NOT EXISTS "${PROJECT_SOURCE_DIR}/googletest/CMakeLists.txt")
message(FATAL_ERROR "The submodule preparation failed. Please update submodule and try again!")
else()
add_subdirectory(googletest)
if(NOT BUILD_GMOCK)
add_definitions(-DBUILD_GMOCK)
endif()
endif()
endif()
enable_testing()
add_subdirectory(tests)
endif()
message(STATUS)
message(STATUS "-------------------------------------------------------------------------------")
message(STATUS "Build for Version ${PROJECT_VERSION} build ${DLT_REVISION} version state ${DLT_VERSION_STATE}")
message(STATUS "WITH_SYSTEMD = ${WITH_SYSTEMD}")
message(STATUS "WITH_SYSTEMD_WATCHDOG = ${WITH_SYSTEMD_WATCHDOG}")
message(STATUS "WITH_SYSTEMD_JOURNAL = ${WITH_SYSTEMD_JOURNAL}")
message(STATUS "WITH_DOC = ${WITH_DOC}")
message(STATUS "WITH_MAN = ${WITH_MAN}")
message(STATUS "WITH_DLT_ADAPTOR = ${WITH_DLT_ADAPTOR}")
message(STATUS "WITH_DLT_ADAPTOR_UDP = ${WITH_DLT_ADAPTOR_UDP}")
message(STATUS "WITH_DLT_CONSOLE = ${WITH_DLT_CONSOLE}")
message(STATUS "WITH_DLT_CONSOLE_WO_CTRL = ${WITH_DLT_CONSOLE_WO_CTRL}")
message(STATUS "WITH_DLT_CONSOLE_WO_SBTM = ${WITH_DLT_CONSOLE_WO_SBTM}")
message(STATUS "WITH_DLT_EXAMPLES = ${WITH_DLT_EXAMPLES}")
message(STATUS "WITH_DLT_SYSTEM = ${WITH_DLT_SYSTEM}")
message(STATUS "WITH_DLT_FILETRANSFER = ${WITH_DLT_FILETRANSFER}")
message(STATUS "WITH_DLT_DBUS = ${WITH_DLT_DBUS}")
message(STATUS "WITH_DLT_TESTS = ${WITH_DLT_TESTS}")
message(STATUS "WITH_DLT_UNIT_TESTS = ${WITH_DLT_UNIT_TESTS}")
if(WITH_DLT_UNIT_TESTS)
message(STATUS "WITH_DLT_INSTALLED_TESTS = ${WITH_DLT_INSTALLED_TESTS}")
endif(WITH_DLT_UNIT_TESTS)
if(GTEST_FOUND)
message(STATUS "GTEST_VERSION = ${GTEST_VERSION}")
endif()
message(STATUS "WITH_DLT_COVERAGE = ${WITH_DLT_COVERAGE}")
message(STATUS "WITH_DLT_SHM_ENABLE = ${WITH_DLT_SHM_ENABLE}")
message(STATUS "WITH_DLTTEST = ${WITH_DLTTEST}")
message(STATUS "BUILD_GMOCK = ${BUILD_GMOCK}")
message(STATUS "WITH_GIT_SUBMODULE = ${WITH_GIT_SUBMODULE}")
message(STATUS "WITH_DLT_PKGCONFIG = ${WITH_DLT_PKGCONFIG}")
message(STATUS "WITH_DLT_CXX11_EXT = ${WITH_DLT_CXX11_EXT}")
message(STATUS "WITH_DLT_COREDUMPHANDLER = ${WITH_DLT_COREDUMPHANDLER}")
message(STATUS "WITH_DLT_KPI = ${WITH_DLT_KPI}")
message(STATUS "WITH_DLT_FATAL_LOG_TRAP = ${WITH_DLT_FATAL_LOG_TRAP}")
message(STATUS "WITH_CHECK_CONFIG_FILE = ${WITH_CHECK_CONFIG_FILE}")
message(STATUS "WITH_TESTSCRIPTS = ${WITH_TESTSCRIPTS}")
message(STATUS "WITH_GPROF = ${WITH_GPROF}")
message(STATUS "WITH_DLT_USE_IPv6 = ${WITH_DLT_USE_IPv6}")
message(STATUS "DLT_USER = ${DLT_USER}")
message(STATUS "BUILD_SHARED_LIBS = ${BUILD_SHARED_LIBS}")
message(STATUS "TARGET_CPU_NAME = ${TARGET_CPU_NAME}")
if(WITH_SYSTEMD OR WITH_SYSTEMD_WATCHDOG OR WITH_SYSTEMD_JOURNAL)
message(STATUS "SYSTEMD_VERSION = ${SYSTEMD_VERSION}")
message(STATUS "SYSTEMD_UNITDIR = ${SYSTEMD_UNITDIR}")
message(STATUS "WITH_SYSTEMD_WATCHDOG_ENFORCE_MSG_RX = ${WITH_SYSTEMD_WATCHDOG_ENFORCE_MSG_RX}")
message(STATUS "WITH_SYSTEMD_WATCHDOG_ENFORCE_MSG_RX_DLT_SYSTEM = ${WITH_SYSTEMD_WATCHDOG_ENFORCE_MSG_RX_DLT_SYSTEM}")
endif()
message(STATUS "CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}")
message(STATUS "CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}")
message(STATUS "CMAKE_HOST_SYSTEM_PROCESSOR = ${CMAKE_HOST_SYSTEM_PROCESSOR}")
message(STATUS "CMAKE_SYSTEM_PROCESSOR = ${CMAKE_SYSTEM_PROCESSOR}")
message(STATUS "WITH_DLT_LOGSTORAGE_CTRL_UDEV = ${WITH_DLT_LOGSTORAGE_CTRL_UDEV}")
message(STATUS "WITH_DLT_LOGSTORAGE_GZIP = ${WITH_DLT_LOGSTORAGE_GZIP}")
message(STATUS "DLT_IPC = ${DLT_IPC}(Path: ${DLT_USER_IPC_PATH})")
message(STATUS "WITH_DLT_DAEMON_VSOCK_IPC = ${WITH_DLT_DAEMON_VSOCK_IPC}")
message(STATUS "WITH_DLT_LIB_VSOCK_IPC = ${WITH_DLT_LIB_VSOCK_IPC}")
message(STATUS "DLT_VSOCK_PORT = ${DLT_VSOCK_PORT}")
message(STATUS "WITH_UDP_CONNECTION = ${WITH_UDP_CONNECTION}")
message(STATUS "WITH_DLT_QNX_SYSTEM = ${WITH_DLT_QNX_SYSTEM}")
message(STATUS "WITH_DLT_NETWORK_TRACE = ${WITH_DLT_NETWORK_TRACE}")
message(STATUS "WITH_LIB_NO_VERSION = ${WITH_LIB_NO_VERSION}")
message(STATUS "WITH_LIB_SHORT_VERSION = ${WITH_LIB_SHORT_VERSION}")
message(STATUS "WITH_LEGACY_INCLUDE_PATH = ${WITH_LEGACY_INCLUDE_PATH}")
message(STATUS "WITH_EXTENDED_FILTERING = ${WITH_EXTENDED_FILTERING}")
message(STATUS "WITH_DLT_DISABLE_MACRO = ${WITH_DLT_DISABLE_MACRO}")
message(STATUS "WITH_DLT_FILE_LOGGING_SYSLOG_FALLBACK = ${WITH_DLT_FILE_LOGGING_SYSLOG_FALLBACK}")
message(STATUS "WITH_DLT_LOG_LEVEL_APP_CONFIG = ${WITH_DLT_LOG_LEVEL_APP_CONFIG}")
message(STATUS "WITH_DLT_TRACE_LOAD_CTRL = ${WITH_DLT_TRACE_LOAD_CTRL}" )
message(STATUS "Change a value with: cmake -D<Variable>=<Value>")
message(STATUS "-------------------------------------------------------------------------------")
message(STATUS)