Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / third_party / pigweed / repo / pw_unit_test / 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/target_types.gni")
18 import("$dir_pw_docgen/docs.gni")
19 import("$dir_pw_protobuf_compiler/proto.gni")
20 import("$dir_pw_unit_test/test.gni")
21
22 config("default_config") {
23   include_dirs = [
24     "public",
25     "public_overrides",
26   ]
27 }
28
29 # pw_unit_test core library.
30 pw_source_set("pw_unit_test") {
31   public_configs = [ ":default_config" ]
32   public_deps = [
33     "$dir_pw_polyfill",
34     "$dir_pw_preprocessor",
35     "$dir_pw_string",
36   ]
37   public = [
38     "public/pw_unit_test/event_handler.h",
39     "public/pw_unit_test/framework.h",
40     "public_overrides/gtest/gtest.h",
41   ]
42   sources = [ "framework.cc" ]
43 }
44
45 # Library providing an event handler which outputs human-readable text.
46 pw_source_set("simple_printing_event_handler") {
47   public_deps = [
48     ":pw_unit_test",
49     "$dir_pw_preprocessor",
50   ]
51   public = [ "public/pw_unit_test/simple_printing_event_handler.h" ]
52   sources = [ "simple_printing_event_handler.cc" ]
53 }
54
55 # Library providing a standard desktop main function for the pw_unit_test
56 # framework. Unit test files can link against this library to build runnable
57 # unit test executables.
58 pw_source_set("simple_printing_main") {
59   public_deps = [ ":pw_unit_test" ]
60   deps = [
61     ":simple_printing_event_handler",
62     "$dir_pw_sys_io",
63   ]
64   sources = [ "simple_printing_main.cc" ]
65 }
66
67 # Library providing an event handler which logs using pw_log.
68 pw_source_set("logging_event_handler") {
69   public_deps = [
70     ":pw_unit_test",
71     "$dir_pw_log",
72     "$dir_pw_preprocessor",
73   ]
74   public = [ "public/pw_unit_test/logging_event_handler.h" ]
75   sources = [ "logging_event_handler.cc" ]
76 }
77
78 pw_source_set("logging_main") {
79   public_deps = [ ":pw_unit_test" ]
80   deps = [
81     ":logging_event_handler",
82     "$dir_pw_sys_io",
83   ]
84   sources = [ "logging_main.cc" ]
85 }
86
87 pw_source_set("rpc_service") {
88   public_configs = [ ":default_config" ]
89   public_deps = [
90     ":pw_unit_test",
91     ":unit_test_proto.pwpb",
92     ":unit_test_proto.raw_rpc",
93   ]
94   deps = [ dir_pw_log ]
95   public = [
96     "public/pw_unit_test/internal/rpc_event_handler.h",
97     "public/pw_unit_test/unit_test_service.h",
98   ]
99   sources = [
100     "rpc_event_handler.cc",
101     "unit_test_service.cc",
102   ]
103 }
104
105 pw_source_set("rpc_main") {
106   public_deps = [ ":pw_unit_test" ]
107   deps = [
108     ":rpc_service",
109     "$dir_pw_rpc/system_server",
110     dir_pw_log,
111   ]
112   sources = [ "rpc_main.cc" ]
113 }
114
115 pw_proto_library("unit_test_proto") {
116   sources = [ "pw_unit_test_proto/unit_test.proto" ]
117 }
118
119 pw_doc_group("docs") {
120   sources = [ "docs.rst" ]
121 }
122
123 pw_test("framework_test") {
124   sources = [ "framework_test.cc" ]
125 }
126
127 pw_test_group("tests") {
128   tests = [ ":framework_test" ]
129 }