xref: /aosp_15_r20/external/pigweed/pw_protobuf/CMakeLists.txt (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1*61c4878aSAndroid Build Coastguard Worker# Copyright 2020 The Pigweed Authors
2*61c4878aSAndroid Build Coastguard Worker#
3*61c4878aSAndroid Build Coastguard Worker# Licensed under the Apache License, Version 2.0 (the "License"); you may not
4*61c4878aSAndroid Build Coastguard Worker# use this file except in compliance with the License. You may obtain a copy of
5*61c4878aSAndroid Build Coastguard Worker# the License at
6*61c4878aSAndroid Build Coastguard Worker#
7*61c4878aSAndroid Build Coastguard Worker#     https://www.apache.org/licenses/LICENSE-2.0
8*61c4878aSAndroid Build Coastguard Worker#
9*61c4878aSAndroid Build Coastguard Worker# Unless required by applicable law or agreed to in writing, software
10*61c4878aSAndroid Build Coastguard Worker# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11*61c4878aSAndroid Build Coastguard Worker# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12*61c4878aSAndroid Build Coastguard Worker# License for the specific language governing permissions and limitations under
13*61c4878aSAndroid Build Coastguard Worker# the License.
14*61c4878aSAndroid Build Coastguard Worker
15*61c4878aSAndroid Build Coastguard Workerinclude($ENV{PW_ROOT}/pw_build/pigweed.cmake)
16*61c4878aSAndroid Build Coastguard Workerinclude($ENV{PW_ROOT}/pw_protobuf_compiler/proto.cmake)
17*61c4878aSAndroid Build Coastguard Worker
18*61c4878aSAndroid Build Coastguard Workerpw_add_module_config(pw_protobuf_CONFIG)
19*61c4878aSAndroid Build Coastguard Worker
20*61c4878aSAndroid Build Coastguard Workerpw_add_library(pw_protobuf.config INTERFACE
21*61c4878aSAndroid Build Coastguard Worker  HEADERS
22*61c4878aSAndroid Build Coastguard Worker    public/pw_protobuf/config.h
23*61c4878aSAndroid Build Coastguard Worker  PUBLIC_INCLUDES
24*61c4878aSAndroid Build Coastguard Worker    public
25*61c4878aSAndroid Build Coastguard Worker  PUBLIC_DEPS
26*61c4878aSAndroid Build Coastguard Worker    ${pw_protobuf_CONFIG}
27*61c4878aSAndroid Build Coastguard Worker)
28*61c4878aSAndroid Build Coastguard Worker
29*61c4878aSAndroid Build Coastguard Workerpw_add_library(pw_protobuf STATIC
30*61c4878aSAndroid Build Coastguard Worker  HEADERS
31*61c4878aSAndroid Build Coastguard Worker    public/pw_protobuf/decoder.h
32*61c4878aSAndroid Build Coastguard Worker    public/pw_protobuf/encoder.h
33*61c4878aSAndroid Build Coastguard Worker    public/pw_protobuf/find.h
34*61c4878aSAndroid Build Coastguard Worker    public/pw_protobuf/internal/codegen.h
35*61c4878aSAndroid Build Coastguard Worker    public/pw_protobuf/internal/proto_integer_base.h
36*61c4878aSAndroid Build Coastguard Worker    public/pw_protobuf/map_utils.h
37*61c4878aSAndroid Build Coastguard Worker    public/pw_protobuf/message.h
38*61c4878aSAndroid Build Coastguard Worker    public/pw_protobuf/serialized_size.h
39*61c4878aSAndroid Build Coastguard Worker    public/pw_protobuf/stream_decoder.h
40*61c4878aSAndroid Build Coastguard Worker    public/pw_protobuf/wire_format.h
41*61c4878aSAndroid Build Coastguard Worker  PUBLIC_INCLUDES
42*61c4878aSAndroid Build Coastguard Worker    public
43*61c4878aSAndroid Build Coastguard Worker  PUBLIC_DEPS
44*61c4878aSAndroid Build Coastguard Worker    pw_assert
45*61c4878aSAndroid Build Coastguard Worker    pw_bytes
46*61c4878aSAndroid Build Coastguard Worker    pw_bytes.bit
47*61c4878aSAndroid Build Coastguard Worker    pw_containers.vector
48*61c4878aSAndroid Build Coastguard Worker    pw_function
49*61c4878aSAndroid Build Coastguard Worker    pw_preprocessor
50*61c4878aSAndroid Build Coastguard Worker    pw_protobuf.config
51*61c4878aSAndroid Build Coastguard Worker    pw_result
52*61c4878aSAndroid Build Coastguard Worker    pw_span
53*61c4878aSAndroid Build Coastguard Worker    pw_status
54*61c4878aSAndroid Build Coastguard Worker    pw_stream
55*61c4878aSAndroid Build Coastguard Worker    pw_stream.interval_reader
56*61c4878aSAndroid Build Coastguard Worker    pw_string.string
57*61c4878aSAndroid Build Coastguard Worker    pw_varint
58*61c4878aSAndroid Build Coastguard Worker    pw_varint.stream
59*61c4878aSAndroid Build Coastguard Worker  SOURCES
60*61c4878aSAndroid Build Coastguard Worker    decoder.cc
61*61c4878aSAndroid Build Coastguard Worker    encoder.cc
62*61c4878aSAndroid Build Coastguard Worker    find.cc
63*61c4878aSAndroid Build Coastguard Worker    map_utils.cc
64*61c4878aSAndroid Build Coastguard Worker    message.cc
65*61c4878aSAndroid Build Coastguard Worker    stream_decoder.cc
66*61c4878aSAndroid Build Coastguard Worker)
67*61c4878aSAndroid Build Coastguard Worker
68*61c4878aSAndroid Build Coastguard Workerpw_add_library(pw_protobuf.bytes_utils INTERFACE
69*61c4878aSAndroid Build Coastguard Worker  HEADERS
70*61c4878aSAndroid Build Coastguard Worker    public/pw_protobuf/bytes_utils.h
71*61c4878aSAndroid Build Coastguard Worker  PUBLIC_INCLUDES
72*61c4878aSAndroid Build Coastguard Worker    public
73*61c4878aSAndroid Build Coastguard Worker  PUBLIC_DEPS
74*61c4878aSAndroid Build Coastguard Worker    pw_protobuf
75*61c4878aSAndroid Build Coastguard Worker    pw_bytes
76*61c4878aSAndroid Build Coastguard Worker    pw_result
77*61c4878aSAndroid Build Coastguard Worker    pw_status
78*61c4878aSAndroid Build Coastguard Worker)
79*61c4878aSAndroid Build Coastguard Worker
80*61c4878aSAndroid Build Coastguard Workerpw_add_test(pw_protobuf.decoder_test
81*61c4878aSAndroid Build Coastguard Worker  SOURCES
82*61c4878aSAndroid Build Coastguard Worker    decoder_test.cc
83*61c4878aSAndroid Build Coastguard Worker  PRIVATE_DEPS
84*61c4878aSAndroid Build Coastguard Worker    pw_protobuf
85*61c4878aSAndroid Build Coastguard Worker  GROUPS
86*61c4878aSAndroid Build Coastguard Worker    modules
87*61c4878aSAndroid Build Coastguard Worker    pw_protobuf
88*61c4878aSAndroid Build Coastguard Worker)
89*61c4878aSAndroid Build Coastguard Worker
90*61c4878aSAndroid Build Coastguard Workerpw_add_test(pw_protobuf.encoder_test
91*61c4878aSAndroid Build Coastguard Worker  SOURCES
92*61c4878aSAndroid Build Coastguard Worker    encoder_test.cc
93*61c4878aSAndroid Build Coastguard Worker  PRIVATE_DEPS
94*61c4878aSAndroid Build Coastguard Worker    pw_protobuf
95*61c4878aSAndroid Build Coastguard Worker  GROUPS
96*61c4878aSAndroid Build Coastguard Worker    modules
97*61c4878aSAndroid Build Coastguard Worker    pw_protobuf
98*61c4878aSAndroid Build Coastguard Worker)
99*61c4878aSAndroid Build Coastguard Worker
100*61c4878aSAndroid Build Coastguard Workerpw_add_test(pw_protobuf.find_test
101*61c4878aSAndroid Build Coastguard Worker  SOURCES
102*61c4878aSAndroid Build Coastguard Worker    find_test.cc
103*61c4878aSAndroid Build Coastguard Worker  PRIVATE_DEPS
104*61c4878aSAndroid Build Coastguard Worker    pw_protobuf
105*61c4878aSAndroid Build Coastguard Worker  GROUPS
106*61c4878aSAndroid Build Coastguard Worker    modules
107*61c4878aSAndroid Build Coastguard Worker    pw_protobuf
108*61c4878aSAndroid Build Coastguard Worker)
109*61c4878aSAndroid Build Coastguard Worker
110*61c4878aSAndroid Build Coastguard Workerpw_add_test(pw_protobuf.codegen_decoder_test
111*61c4878aSAndroid Build Coastguard Worker  SOURCES
112*61c4878aSAndroid Build Coastguard Worker    codegen_decoder_test.cc
113*61c4878aSAndroid Build Coastguard Worker  PRIVATE_DEPS
114*61c4878aSAndroid Build Coastguard Worker    pw_protobuf
115*61c4878aSAndroid Build Coastguard Worker    pw_protobuf.codegen_test_protos.pwpb
116*61c4878aSAndroid Build Coastguard Worker  GROUPS
117*61c4878aSAndroid Build Coastguard Worker    modules
118*61c4878aSAndroid Build Coastguard Worker    pw_protobuf
119*61c4878aSAndroid Build Coastguard Worker)
120*61c4878aSAndroid Build Coastguard Worker
121*61c4878aSAndroid Build Coastguard Workerpw_add_test(pw_protobuf.codegen_encoder_test
122*61c4878aSAndroid Build Coastguard Worker  SOURCES
123*61c4878aSAndroid Build Coastguard Worker    codegen_encoder_test.cc
124*61c4878aSAndroid Build Coastguard Worker  PRIVATE_DEPS
125*61c4878aSAndroid Build Coastguard Worker    pw_bytes
126*61c4878aSAndroid Build Coastguard Worker    pw_protobuf
127*61c4878aSAndroid Build Coastguard Worker    pw_protobuf.codegen_test_protos.pwpb
128*61c4878aSAndroid Build Coastguard Worker  GROUPS
129*61c4878aSAndroid Build Coastguard Worker    modules
130*61c4878aSAndroid Build Coastguard Worker    pw_protobuf
131*61c4878aSAndroid Build Coastguard Worker)
132*61c4878aSAndroid Build Coastguard Worker
133*61c4878aSAndroid Build Coastguard Workerpw_add_test(pw_protobuf.codegen_message_test
134*61c4878aSAndroid Build Coastguard Worker  SOURCES
135*61c4878aSAndroid Build Coastguard Worker    codegen_message_test.cc
136*61c4878aSAndroid Build Coastguard Worker  PRIVATE_DEPS
137*61c4878aSAndroid Build Coastguard Worker    pw_protobuf
138*61c4878aSAndroid Build Coastguard Worker    pw_protobuf.codegen_test_protos.pwpb
139*61c4878aSAndroid Build Coastguard Worker    pw_string
140*61c4878aSAndroid Build Coastguard Worker  GROUPS
141*61c4878aSAndroid Build Coastguard Worker    modules
142*61c4878aSAndroid Build Coastguard Worker    pw_protobuf
143*61c4878aSAndroid Build Coastguard Worker)
144*61c4878aSAndroid Build Coastguard Worker
145*61c4878aSAndroid Build Coastguard Workerpw_add_test(pw_protobuf.serialized_size_test
146*61c4878aSAndroid Build Coastguard Worker  SOURCES
147*61c4878aSAndroid Build Coastguard Worker    serialized_size_test.cc
148*61c4878aSAndroid Build Coastguard Worker  PRIVATE_DEPS
149*61c4878aSAndroid Build Coastguard Worker    pw_protobuf
150*61c4878aSAndroid Build Coastguard Worker  GROUPS
151*61c4878aSAndroid Build Coastguard Worker    modules
152*61c4878aSAndroid Build Coastguard Worker    pw_protobuf
153*61c4878aSAndroid Build Coastguard Worker)
154*61c4878aSAndroid Build Coastguard Worker
155*61c4878aSAndroid Build Coastguard Workerpw_add_test(pw_protobuf.stream_decoder_test
156*61c4878aSAndroid Build Coastguard Worker  SOURCES
157*61c4878aSAndroid Build Coastguard Worker    stream_decoder_test.cc
158*61c4878aSAndroid Build Coastguard Worker  PRIVATE_DEPS
159*61c4878aSAndroid Build Coastguard Worker    pw_protobuf
160*61c4878aSAndroid Build Coastguard Worker  GROUPS
161*61c4878aSAndroid Build Coastguard Worker    modules
162*61c4878aSAndroid Build Coastguard Worker    pw_protobuf
163*61c4878aSAndroid Build Coastguard Worker)
164*61c4878aSAndroid Build Coastguard Worker
165*61c4878aSAndroid Build Coastguard Workerpw_add_test(pw_protobuf.map_utils_test
166*61c4878aSAndroid Build Coastguard Worker  SOURCES
167*61c4878aSAndroid Build Coastguard Worker    map_utils_test.cc
168*61c4878aSAndroid Build Coastguard Worker  PRIVATE_DEPS
169*61c4878aSAndroid Build Coastguard Worker    pw_protobuf
170*61c4878aSAndroid Build Coastguard Worker  GROUPS
171*61c4878aSAndroid Build Coastguard Worker    modules
172*61c4878aSAndroid Build Coastguard Worker    pw_protobuf
173*61c4878aSAndroid Build Coastguard Worker)
174*61c4878aSAndroid Build Coastguard Worker
175*61c4878aSAndroid Build Coastguard Workerpw_add_test(pw_protobuf.message_test
176*61c4878aSAndroid Build Coastguard Worker  SOURCES
177*61c4878aSAndroid Build Coastguard Worker    message_test.cc
178*61c4878aSAndroid Build Coastguard Worker  PRIVATE_DEPS
179*61c4878aSAndroid Build Coastguard Worker    pw_protobuf
180*61c4878aSAndroid Build Coastguard Worker  GROUPS
181*61c4878aSAndroid Build Coastguard Worker    modules
182*61c4878aSAndroid Build Coastguard Worker    pw_protobuf
183*61c4878aSAndroid Build Coastguard Worker)
184*61c4878aSAndroid Build Coastguard Worker
185*61c4878aSAndroid Build Coastguard Workerpw_proto_library(pw_protobuf.common_proto
186*61c4878aSAndroid Build Coastguard Worker  SOURCES
187*61c4878aSAndroid Build Coastguard Worker    pw_protobuf_protos/common.proto
188*61c4878aSAndroid Build Coastguard Worker)
189*61c4878aSAndroid Build Coastguard Worker
190*61c4878aSAndroid Build Coastguard Workerpw_proto_library(pw_protobuf.status_proto
191*61c4878aSAndroid Build Coastguard Worker  SOURCES
192*61c4878aSAndroid Build Coastguard Worker    pw_protobuf_protos/status.proto
193*61c4878aSAndroid Build Coastguard Worker)
194*61c4878aSAndroid Build Coastguard Worker
195*61c4878aSAndroid Build Coastguard Workerpw_proto_library(pw_protobuf.field_options_proto
196*61c4878aSAndroid Build Coastguard Worker  SOURCES
197*61c4878aSAndroid Build Coastguard Worker    pw_protobuf_protos/field_options.proto
198*61c4878aSAndroid Build Coastguard Worker)
199*61c4878aSAndroid Build Coastguard Worker
200*61c4878aSAndroid Build Coastguard Workerpw_proto_library(pw_protobuf.codegen_protos
201*61c4878aSAndroid Build Coastguard Worker  SOURCES
202*61c4878aSAndroid Build Coastguard Worker    pw_protobuf_codegen_protos/codegen_options.proto
203*61c4878aSAndroid Build Coastguard Worker)
204*61c4878aSAndroid Build Coastguard Worker
205*61c4878aSAndroid Build Coastguard Workerpw_proto_library(pw_protobuf.codegen_test_deps_protos
206*61c4878aSAndroid Build Coastguard Worker  SOURCES
207*61c4878aSAndroid Build Coastguard Worker    pw_protobuf_test_deps_protos/imported.proto
208*61c4878aSAndroid Build Coastguard Worker  INPUTS
209*61c4878aSAndroid Build Coastguard Worker    pw_protobuf_test_deps_protos/imported.pwpb_options
210*61c4878aSAndroid Build Coastguard Worker)
211*61c4878aSAndroid Build Coastguard Worker
212*61c4878aSAndroid Build Coastguard Workerpw_proto_library(pw_protobuf.codegen_test_deps_protos_prefix
213*61c4878aSAndroid Build Coastguard Worker  SOURCES
214*61c4878aSAndroid Build Coastguard Worker    pw_protobuf_test_deps_protos/test_prefix_imported.proto
215*61c4878aSAndroid Build Coastguard Worker  INPUTS
216*61c4878aSAndroid Build Coastguard Worker    pw_protobuf_test_deps_protos/test_prefix_imported.pwpb_options
217*61c4878aSAndroid Build Coastguard Worker  STRIP_PREFIX
218*61c4878aSAndroid Build Coastguard Worker    pw_protobuf_test_deps_protos
219*61c4878aSAndroid Build Coastguard Worker  PREFIX
220*61c4878aSAndroid Build Coastguard Worker    test_prefix
221*61c4878aSAndroid Build Coastguard Worker)
222*61c4878aSAndroid Build Coastguard Worker
223*61c4878aSAndroid Build Coastguard Workerpw_proto_library(pw_protobuf.codegen_test_protos
224*61c4878aSAndroid Build Coastguard Worker  SOURCES
225*61c4878aSAndroid Build Coastguard Worker    pw_protobuf_test_protos/full_test.proto
226*61c4878aSAndroid Build Coastguard Worker    pw_protobuf_test_protos/imported.proto
227*61c4878aSAndroid Build Coastguard Worker    pw_protobuf_test_protos/importer.proto
228*61c4878aSAndroid Build Coastguard Worker    pw_protobuf_test_protos/non_pw_package.proto
229*61c4878aSAndroid Build Coastguard Worker    pw_protobuf_test_protos/optional.proto
230*61c4878aSAndroid Build Coastguard Worker    pw_protobuf_test_protos/proto2.proto
231*61c4878aSAndroid Build Coastguard Worker    pw_protobuf_test_protos/repeated.proto
232*61c4878aSAndroid Build Coastguard Worker  INPUTS
233*61c4878aSAndroid Build Coastguard Worker    pw_protobuf_test_protos/full_test.pwpb_options
234*61c4878aSAndroid Build Coastguard Worker    pw_protobuf_test_protos/imported.pwpb_options
235*61c4878aSAndroid Build Coastguard Worker    pw_protobuf_test_protos/optional.pwpb_options
236*61c4878aSAndroid Build Coastguard Worker    pw_protobuf_test_protos/repeated.pwpb_options
237*61c4878aSAndroid Build Coastguard Worker  DEPS
238*61c4878aSAndroid Build Coastguard Worker    pw_protobuf.common_proto
239*61c4878aSAndroid Build Coastguard Worker    pw_protobuf.status_proto
240*61c4878aSAndroid Build Coastguard Worker    pw_protobuf.codegen_test_deps_protos
241*61c4878aSAndroid Build Coastguard Worker    pw_protobuf.codegen_test_deps_protos_prefix
242*61c4878aSAndroid Build Coastguard Worker)
243