Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / third_party / pigweed / repo / pw_hdlc / BUILD.gn
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
15 import("//build_overrides/pigweed.gni")
16
17 import("$dir_pw_build/python.gni")
18 import("$dir_pw_build/target_types.gni")
19 import("$dir_pw_docgen/docs.gni")
20 import("$dir_pw_unit_test/test.gni")
21
22 config("default_config") {
23   include_dirs = [ "public" ]
24 }
25
26 group("pw_hdlc") {
27   public_deps = [
28     ":decoder",
29     ":encoder",
30   ]
31 }
32
33 pw_source_set("decoder") {
34   public_configs = [ ":default_config" ]
35   public = [ "public/pw_hdlc/decoder.h" ]
36   sources = [
37     "decoder.cc",
38     "pw_hdlc_private/protocol.h",
39   ]
40   public_deps = [
41     dir_pw_bytes,
42     dir_pw_checksum,
43     dir_pw_result,
44     dir_pw_status,
45   ]
46   deps = [ dir_pw_log ]
47   friend = [ ":*" ]
48 }
49
50 pw_source_set("encoder") {
51   public_configs = [ ":default_config" ]
52   public = [ "public/pw_hdlc/encoder.h" ]
53   sources = [
54     "encoder.cc",
55     "public/pw_hdlc/internal/encoder.h",
56     "pw_hdlc_private/protocol.h",
57   ]
58   public_deps = [
59     "$dir_pw_stream:sys_io_stream",
60     dir_pw_bytes,
61     dir_pw_checksum,
62     dir_pw_status,
63     dir_pw_stream,
64     dir_pw_sys_io,
65   ]
66   friend = [ ":*" ]
67 }
68
69 pw_source_set("rpc_channel_output") {
70   public_configs = [ ":default_config" ]
71   public = [ "public/pw_hdlc/rpc_channel.h" ]
72   public_deps = [
73     ":pw_hdlc",
74     "$dir_pw_rpc:server",
75   ]
76 }
77
78 pw_source_set("pw_rpc") {
79   public_configs = [ ":default_config" ]
80   public = [ "public/pw_hdlc/rpc_packets.h" ]
81   sources = [ "rpc_packets.cc" ]
82   public_deps = [
83     ":pw_hdlc",
84     "$dir_pw_rpc:server",
85   ]
86 }
87
88 pw_source_set("packet_parser") {
89   public_configs = [ ":default_config" ]
90   public = [ "public/pw_hdlc/wire_packet_parser.h" ]
91   sources = [ "wire_packet_parser.cc" ]
92   public_deps = [
93     ":pw_hdlc",
94     "$dir_pw_router:packet_parser",
95     dir_pw_assert,
96   ]
97   deps = [
98     dir_pw_bytes,
99     dir_pw_checksum,
100   ]
101 }
102
103 pw_test_group("tests") {
104   tests = [
105     ":encoder_test",
106     ":decoder_test",
107     ":rpc_channel_test",
108     ":wire_packet_parser_test",
109   ]
110   group_deps = [
111     "$dir_pw_preprocessor:tests",
112     "$dir_pw_status:tests",
113     "$dir_pw_stream:tests",
114   ]
115 }
116
117 pw_test("encoder_test") {
118   deps = [ ":pw_hdlc" ]
119   sources = [ "encoder_test.cc" ]
120 }
121
122 pw_python_action("generate_decoder_test") {
123   outputs = [ "$target_gen_dir/generated_decoder_test.cc" ]
124   script = "py/decode_test.py"
125   args = [ "--generate-cc-test" ] + rebase_path(outputs)
126   python_deps = [
127     "$dir_pw_build/py",
128     "py",
129   ]
130 }
131
132 pw_test("decoder_test") {
133   deps = [
134     ":generate_decoder_test",
135     ":pw_hdlc",
136   ]
137   sources = [ "decoder_test.cc" ] + get_target_outputs(":generate_decoder_test")
138 }
139
140 pw_test("rpc_channel_test") {
141   deps = [
142     ":pw_hdlc",
143     ":rpc_channel_output",
144   ]
145   sources = [ "rpc_channel_test.cc" ]
146 }
147
148 pw_test("wire_packet_parser_test") {
149   deps = [
150     ":packet_parser",
151     dir_pw_bytes,
152   ]
153   sources = [ "wire_packet_parser_test.cc" ]
154 }
155
156 pw_doc_group("docs") {
157   sources = [
158     "docs.rst",
159     "rpc_example/docs.rst",
160   ]
161   inputs = [
162     "py/pw_hdlc/decode.py",
163     "py/pw_hdlc/encode.py",
164   ]
165 }