1# Copyright (c) Huawei Technologies Co., Ltd. 2023. All rights reserved.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14config("gtest_private_config") {
15  visibility = [ ":*" ]
16  include_dirs = [ "googletest" ]
17}
18
19config("gtest_config") {
20  include_dirs = [ "googletest/include" ]
21}
22
23static_library("gtest") {
24  testonly = true
25  public = [
26    "googletest/include/gtest/gtest-spi.h",
27    "googletest/include/gtest/gtest.h",
28  ]
29
30  cflags = [
31    "-Wno-inconsistent-missing-override",
32    "-fprofile-arcs",
33    "-ftest-coverage",
34    "-Wno-unused-command-line-argument",
35    "-Wno-format",
36    "-Wno-unused-const-variable",
37    "-Wno-unused-variable",
38    "-Wno-used-but-marked-unused",
39    "-Wno-exit-time-destructors",
40    "-Wno-missing-noreturn",
41    "-Wno-missing-noreturn",
42  ]
43  sources = [
44    "googletest/include/gtest/gtest-assertion-result.h",
45    "googletest/include/gtest/gtest-death-test.h",
46    "googletest/include/gtest/gtest-message.h",
47    "googletest/include/gtest/gtest-param-test.h",
48    "googletest/include/gtest/gtest-printers.h",
49    "googletest/include/gtest/gtest-test-part.h",
50    "googletest/include/gtest/gtest-typed-test.h",
51    "googletest/include/gtest/gtest_pred_impl.h",
52    "googletest/include/gtest/gtest_prod.h",
53    "googletest/include/gtest/hwext/gtest-ext.h",
54    "googletest/include/gtest/hwext/gtest-filter.h",
55    "googletest/include/gtest/hwext/gtest-tag.h",
56    "googletest/include/gtest/hwext/utils.h",
57    "googletest/include/gtest/internal/custom/gtest-port.h",
58    "googletest/include/gtest/internal/custom/gtest-printers.h",
59    "googletest/include/gtest/internal/custom/gtest.h",
60    "googletest/include/gtest/internal/gtest-death-test-internal.h",
61    "googletest/include/gtest/internal/gtest-filepath.h",
62    "googletest/include/gtest/internal/gtest-internal.h",
63    "googletest/include/gtest/internal/gtest-linked_ptr.h",
64    "googletest/include/gtest/internal/gtest-param-util-generated.h",
65    "googletest/include/gtest/internal/gtest-param-util.h",
66    "googletest/include/gtest/internal/gtest-port-arch.h",
67    "googletest/include/gtest/internal/gtest-port.h",
68    "googletest/include/gtest/internal/gtest-string.h",
69    "googletest/include/gtest/internal/gtest-tuple.h",
70    "googletest/include/gtest/internal/gtest-type-util.h",
71    "googletest/src/gtest-all.cc",
72    "googletest/src/gtest-assertion-result.cc",
73    "googletest/src/gtest-death-test.cc",
74    "googletest/src/gtest-filepath.cc",
75    "googletest/src/gtest-internal-inl.h",
76    "googletest/src/gtest-port.cc",
77    "googletest/src/gtest-printers.cc",
78    "googletest/src/gtest-test-part.cc",
79    "googletest/src/gtest-typed-test.cc",
80    "googletest/src/gtest.cc",
81    "googletest/src/hwext/gtest-ext.cc",
82    "googletest/src/hwext/gtest-filter.cc",
83    "googletest/src/hwext/gtest-tag.cc",
84    "googletest/src/hwext/gtest-utils.cc",
85  ]
86  sources -= [ "googletest/src/gtest-all.cc" ]
87  public_configs = [ ":gtest_config" ]
88  configs += [ ":gtest_private_config" ]
89}
90
91static_library("gtest_main") {
92  testonly = true
93  sources = [ "googletest/src/gtest_main.cc" ]
94
95  cflags = [
96    "-Wno-inconsistent-missing-override",
97    "-fprofile-arcs",
98    "-ftest-coverage",
99    "-Wno-unused-command-line-argument",
100    "-Wno-format",
101    "-Wno-unused-const-variable",
102    "-Wno-unused-variable",
103    "-Wno-used-but-marked-unused",
104    "-Wno-exit-time-destructors",
105    "-Wno-missing-noreturn",
106  ]
107  public_deps = [ ":gtest" ]
108}
109
110config("gmock_private_config") {
111  visibility = [ ":*" ]
112  include_dirs = [ "googlemock" ]
113}
114
115config("gmock_config") {
116  include_dirs = [ "googlemock/include" ]
117
118  cflags_cc = [
119    # The MOCK_METHODn() macros do not specify "override", which triggers this
120    # warning in users: "error: 'Method' overrides a member function but is not
121    # marked 'override' [-Werror,-Winconsistent-missing-override]". Suppress
122    # these warnings until https://github.com/google/googletest/issues/533 is
123    # fixed.
124    "-Wno-inconsistent-missing-override",
125  ]
126  cflags = [
127    "-Wno-inconsistent-missing-override",
128
129    "-fprofile-arcs",
130    "-ftest-coverage",
131    "-Wno-unused-command-line-argument",
132    "-Wno-format",
133    "-Wno-unused-const-variable",
134    "-Wno-unused-variable",
135    "-Wno-used-but-marked-unused",
136    "-Wno-exit-time-destructors",
137    "-Wno-missing-noreturn",
138  ]
139}
140
141static_library("gmock") {
142  testonly = true
143  public = [ "googlemock/include/gmock/gmock.h" ]
144  cflags = [
145    "-Wno-inconsistent-missing-override",
146
147    "-fprofile-arcs",
148    "-ftest-coverage",
149    "-Wno-unused-command-line-argument",
150    "-Wno-format",
151    "-Wno-unused-const-variable",
152    "-Wno-unused-variable",
153    "-Wno-used-but-marked-unused",
154    "-Wno-exit-time-destructors",
155    "-Wno-missing-noreturn",
156  ]
157  sources = [
158    "googlemock/include/gmock/gmock-actions.h",
159    "googlemock/include/gmock/gmock-cardinalities.h",
160    "googlemock/include/gmock/gmock-generated-actions.h",
161    "googlemock/include/gmock/gmock-generated-function-mockers.h",
162    "googlemock/include/gmock/gmock-generated-matchers.h",
163    "googlemock/include/gmock/gmock-generated-nice-strict.h",
164    "googlemock/include/gmock/gmock-matchers.h",
165    "googlemock/include/gmock/gmock-more-actions.h",
166    "googlemock/include/gmock/gmock-more-matchers.h",
167    "googlemock/include/gmock/gmock-spec-builders.h",
168    "googlemock/include/gmock/internal/custom/gmock-generated-actions.h",
169    "googlemock/include/gmock/internal/custom/gmock-matchers.h",
170    "googlemock/include/gmock/internal/custom/gmock-port.h",
171    "googlemock/include/gmock/internal/gmock-generated-internal-utils.h",
172    "googlemock/include/gmock/internal/gmock-internal-utils.h",
173    "googlemock/include/gmock/internal/gmock-port.h",
174    "googlemock/src/gmock-all.cc",
175    "googlemock/src/gmock-cardinalities.cc",
176    "googlemock/src/gmock-internal-utils.cc",
177    "googlemock/src/gmock-matchers.cc",
178    "googlemock/src/gmock-spec-builders.cc",
179    "googlemock/src/gmock.cc",
180  ]
181  sources -= [ "googlemock/src/gmock-all.cc" ]
182  public_configs = [ ":gmock_config" ]
183  configs += [ ":gmock_private_config" ]
184  deps = [ ":gtest" ]
185}
186
187static_library("gmock_main") {
188  testonly = true
189
190  cflags = [
191    "-Wno-inconsistent-missing-override",
192    "-fprofile-arcs",
193    "-ftest-coverage",
194    "-Wno-unused-command-line-argument",
195    "-Wno-format",
196    "-Wno-unused-const-variable",
197    "-Wno-unused-variable",
198    "-Wno-used-but-marked-unused",
199    "-Wno-exit-time-destructors",
200    "-Wno-missing-noreturn",
201  ]
202  sources = [ "googlemock/src/gmock_main.cc" ]
203  public_deps = [
204    ":gmock",
205    ":gtest",
206  ]
207}
208