Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / third_party / pigweed / repo / pw_protobuf / BUILD.gn
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
15 import("//build_overrides/pigweed.gni")
16
17 import("$dir_pw_build/input_group.gni")
18 import("$dir_pw_build/target_types.gni")
19 import("$dir_pw_docgen/docs.gni")
20 import("$dir_pw_fuzzer/fuzzer.gni")
21 import("$dir_pw_protobuf_compiler/proto.gni")
22 import("$dir_pw_unit_test/test.gni")
23
24 config("default_config") {
25   include_dirs = [ "public" ]
26 }
27
28 pw_source_set("pw_protobuf") {
29   public_configs = [ ":default_config" ]
30   public_deps = [
31     dir_pw_bytes,
32     dir_pw_result,
33     dir_pw_status,
34     dir_pw_varint,
35   ]
36   public = [
37     "public/pw_protobuf/codegen.h",
38     "public/pw_protobuf/decoder.h",
39     "public/pw_protobuf/encoder.h",
40     "public/pw_protobuf/find.h",
41     "public/pw_protobuf/serialized_size.h",
42     "public/pw_protobuf/wire_format.h",
43   ]
44   sources = [
45     "decoder.cc",
46     "encoder.cc",
47     "find.cc",
48   ]
49 }
50
51 pw_doc_group("docs") {
52   sources = [
53     "decoding.rst",
54     "docs.rst",
55   ]
56   report_deps = [
57     "size_report:decoder_full",
58     "size_report:decoder_incremental",
59   ]
60 }
61
62 pw_test_group("tests") {
63   tests = [
64     ":codegen_test",
65     ":decoder_test",
66     ":encoder_test",
67     ":encoder_fuzzer",
68     ":find_test",
69   ]
70 }
71
72 pw_test("decoder_test") {
73   deps = [ ":pw_protobuf" ]
74   sources = [ "decoder_test.cc" ]
75 }
76
77 pw_test("encoder_test") {
78   deps = [ ":pw_protobuf" ]
79   sources = [ "encoder_test.cc" ]
80 }
81
82 pw_test("find_test") {
83   deps = [ ":pw_protobuf" ]
84   sources = [ "find_test.cc" ]
85 }
86
87 pw_test("codegen_test") {
88   deps = [ ":codegen_test_protos.pwpb" ]
89   sources = [ "codegen_test.cc" ]
90 }
91
92 pw_proto_library("common_protos") {
93   sources = [ "pw_protobuf_protos/common.proto" ]
94 }
95
96 pw_proto_library("codegen_test_protos") {
97   sources = [
98     "pw_protobuf_test_protos/full_test.proto",
99     "pw_protobuf_test_protos/imported.proto",
100     "pw_protobuf_test_protos/importer.proto",
101     "pw_protobuf_test_protos/non_pw_package.proto",
102     "pw_protobuf_test_protos/proto2.proto",
103     "pw_protobuf_test_protos/repeated.proto",
104   ]
105   deps = [ ":common_protos" ]
106 }
107
108 pw_fuzzer("encoder_fuzzer") {
109   sources = [ "encoder_fuzzer.cc" ]
110   deps = [ ":pw_protobuf" ]
111 }