1# SPDX-License-Identifier: Apache-2.0
2
3if(NOT CONFIG_LOG_MODE_MINIMAL)
4  zephyr_sources_ifdef(
5    CONFIG_LOG
6    log_core.c
7    log_mgmt.c
8    log_cache.c
9    log_msg.c
10    log_cache.c
11  )
12
13  zephyr_sources_ifdef(
14    CONFIG_LOG_OUTPUT
15    log_output.c
16  )
17
18  # Determine if __auto_type is supported. If not then runtime approach must always
19  # be used.
20  # Supported by:
21  # - C++ (auto)
22  # - GCC 4.9.0 https://gcc.gnu.org/gcc-4.9/changes.html
23  # - Clang 3.8
24  if (NOT CONFIG_LOG_ALWAYS_RUNTIME)
25    if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
26      if(CMAKE_C_COMPILER_VERSION VERSION_LESS "3.8.0")
27        message(WARNING "Compiler version requires CONFIG_LOG_ALWAYS_RUNTIME to be set")
28      endif()
29    endif()
30    if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
31      if(CMAKE_C_COMPILER_VERSION VERSION_LESS "4.9.0")
32        message(WARNING "Compiler version requires CONFIG_LOG_ALWAYS_RUNTIME to be set")
33      endif()
34    endif()
35  endif()
36
37  zephyr_sources_ifdef(
38    CONFIG_LOG_CMDS
39    log_cmds.c
40  )
41
42  zephyr_sources_ifdef(
43    CONFIG_LOG_FRONTEND_DICT_UART
44    log_frontend_dict_uart.c
45  )
46
47  zephyr_sources_ifdef(
48    CONFIG_LOG_DICTIONARY_SUPPORT
49    log_output_dict.c
50  )
51
52  add_subdirectory(backends)
53
54  # For some reason, running sys-t with catalog message on
55  # Cortex-M0 would result in hard fault in mipi_catalog_formatter()
56  # if this is complied before the backends (only with SIZE
57  # optimization). Workaround the issue by placing it here instead
58  # as this is causing CI failures. Actual root-cause is TBD.
59  zephyr_sources_ifdef(
60    CONFIG_LOG_MIPI_SYST_ENABLE
61    log_output_syst.c
62  )
63
64  if(CONFIG_LOG_CUSTOM_FORMAT_SUPPORT OR CONFIG_LOG_OUTPUT_FORMAT_CUSTOM_TIMESTAMP)
65    zephyr_sources(log_output_custom.c)
66  endif()
67
68  zephyr_sources_ifdef(
69    CONFIG_LOG_MULTIDOMAIN_LINK
70    log_multidomain_link.c
71  )
72
73  zephyr_sources_ifdef(
74    CONFIG_LOG_LINK_IPC_SERVICE
75    log_link_ipc_service.c
76  )
77
78
79else()
80  zephyr_sources(log_minimal.c)
81endif()
82