xref: /aosp_15_r20/external/pigweed/pw_log_zephyr/CMakeLists.txt (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1# Copyright 2021 The Pigweed Authors
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may not
4# use this file except in compliance with the License. You may obtain a copy of
5# the License at
6#
7#     https://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations under
13# the License.
14
15include($ENV{PW_ROOT}/pw_build/pigweed.cmake)
16
17pw_add_library(pw_log_zephyr STATIC
18  HEADERS
19    public/pw_log_zephyr/log_zephyr.h
20    public/pw_log_zephyr/config.h
21    public_overrides/pw_log_backend/log_backend.h
22  PUBLIC_INCLUDES
23    public
24    public_overrides
25  PUBLIC_DEPS
26    pw_log.facade
27  SOURCES
28    log_zephyr.cc
29  PRIVATE_DEPS
30    pw_preprocessor
31)
32pw_zephyrize_libraries_ifdef(CONFIG_PIGWEED_LOG_ZEPHYR
33    pw_log.facade
34    pw_log_zephyr
35)
36
37pw_add_library(pw_log_zephyr.tokenized_lib INTERFACE
38  HEADERS
39    zephyr_public_overrides/zephyr_custom_log.h
40    zephyr_public_overrides/zephyr_custom_shell.h
41  PUBLIC_INCLUDES
42    zephyr_public_overrides
43  PUBLIC_DEPS
44    pw_log.facade
45    pw_log_tokenized
46    pw_log_tokenized.base64
47    pw_tokenizer
48)
49
50pw_add_library(pw_log_zephyr.tokenized_handler STATIC
51  SOURCES
52    pw_log_zephyr_tokenized_handler.cc
53  PUBLIC_DEPS
54    pw_log_tokenized.handler
55    pw_log_zephyr.tokenized_lib
56)
57
58pw_zephyrize_libraries_ifdef(CONFIG_PIGWEED_LOG_TOKENIZED
59    pw_log.facade
60    pw_log_tokenized
61    pw_log_zephyr.tokenized_handler
62)
63if(CONFIG_PIGWEED_LOG_TOKENIZED)
64  zephyr_include_directories(zephyr_public_overrides)
65endif()
66
67pw_add_library(pw_log_zephyr.tokenized_rpc_handler INTERFACE
68  PUBLIC_DEPS
69    pw_checksum
70    pw_sys_io
71    pw_system.init
72    pw_metric.global
73    pw_system.log_backend
74  HEADERS
75    zephyr_public_overrides/zephyr_custom_log.h
76    zephyr_public_overrides/zephyr_custom_shell.h
77)
78
79pw_zephyrize_libraries_ifdef(CONFIG_PIGWEED_LOG_TOKENIZED_RPC
80    pw_log.facade
81    pw_log_tokenized
82    pw_log_zephyr.tokenized_rpc_handler
83)
84if(CONFIG_PIGWEED_LOG_TOKENIZED_RPC)
85  zephyr_include_directories(zephyr_public_overrides)
86endif()
87
88# Map tokenized configuration options
89pw_set_config_from_zephyr(CONFIG_PIGWEED_LOG_TOKENIZED_LEVEL_BITS PW_LOG_TOKENIZED_LEVEL_BITS)
90pw_set_config_from_zephyr(CONFIG_PIGWEED_LOG_TOKENIZED_LINE_BITS PW_LOG_TOKENIZED_LINE_BITS)
91pw_set_config_from_zephyr(CONFIG_PIGWEED_LOG_TOKENIZED_FLAG_BITS PW_LOG_TOKENIZED_FLAG_BITS)
92pw_set_config_from_zephyr(CONFIG_PIGWEED_LOG_TOKENIZED_MODULE_BITS PW_LOG_TOKENIZED_MODULE_BITS)