• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2020 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)
16include($ENV{PW_ROOT}/pw_log/backend.cmake)
17include($ENV{PW_ROOT}/pw_protobuf_compiler/proto.cmake)
18
19pw_add_module_config(pw_log_CONFIG)
20
21pw_add_module_config(pw_log_GLOG_ADAPTER_CONFIG)
22
23pw_add_library(pw_log.config INTERFACE
24  HEADERS
25    public/pw_log/config.h
26  PUBLIC_INCLUDES
27    public
28  PUBLIC_DEPS
29    ${pw_log_CONFIG}
30)
31
32pw_add_facade(pw_log INTERFACE
33  BACKEND
34    pw_log_BACKEND
35  HEADERS
36    public/pw_log/levels.h
37    public/pw_log/log.h
38    public/pw_log/options.h
39    public/pw_log/short.h
40    public/pw_log/shorter.h
41  PUBLIC_INCLUDES
42    public
43  PUBLIC_DEPS
44    pw_log.config
45)
46
47pw_add_library(pw_log.glog_adapter INTERFACE
48  HEADERS
49    public/pw_log/glog_adapter.h
50    public/pw_log/glog_adapter_config.h
51    public/pw_log/internal/glog_adapter.h
52  PUBLIC_INCLUDES
53    public
54  PUBLIC_DEPS
55    pw_assert
56    pw_log
57    pw_log.config
58    pw_preprocessor
59    pw_string
60    ${pw_log_GLOG_ADAPTER_CONFIG}
61)
62
63pw_add_library(pw_log.proto_utils STATIC
64  HEADERS
65    public/pw_log/proto_utils.h
66  PUBLIC_INCLUDES
67    public
68  PUBLIC_DEPS
69    pw_log.facade
70    pw_bytes
71    pw_log.protos.pwpb
72    pw_log_tokenized.metadata
73    pw_result
74  PRIVATE_DEPS
75    pw_protobuf
76  SOURCES
77    proto_utils.cc
78)
79
80pw_proto_library(pw_log.protos
81  SOURCES
82    log.proto
83  PREFIX
84    pw_log/proto
85  DEPS
86    pw_protobuf.common_proto
87    pw_tokenizer.proto
88)
89
90if(NOT "${pw_log_BACKEND}" STREQUAL "")
91  pw_add_test(pw_log.basic_log_test
92    SOURCES
93      basic_log_test.cc
94      basic_log_test_plain_c.c
95    PRIVATE_DEPS
96      pw_log
97      pw_preprocessor
98    GROUPS
99      modules
100      pw_log
101  )
102
103  pw_add_test(pw_log.glog_adapter_test
104    SOURCES
105      glog_adapter_test.cc
106    PRIVATE_DEPS
107      pw_log.glog_adapter
108    GROUPS
109      modules
110      pw_log
111  )
112
113  pw_add_test(pw_log.proto_utils_test
114    SOURCES
115      proto_utils_test.cc
116    PRIVATE_DEPS
117      pw_log
118      pw_log.proto_utils
119      pw_log.protos.pwpb
120      pw_preprocessor
121      pw_protobuf
122      pw_protobuf.bytes_utils
123      pw_containers
124    GROUPS
125      modules
126      pw_log
127  )
128endif()
129