• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2018. Huawei Technologies Co., Ltd. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5config("gtest_private_config") {
6  visibility = [ ":*" ]
7  include_dirs = [ "googletest" ]
8}
9
10config("gtest_private_config_rtti") {
11  visibility = [ ":*" ]
12  include_dirs = [ "googletest" ]
13  cflags = [ "-frtti" ]
14  cflags_objcc = [ "-frtti" ]
15  cflags_cc = [ "-frtti" ]
16}
17
18config("gtest_config") {
19  include_dirs = [ "googletest/include" ]
20  cflags_cc = [
21    "-std=c++17",
22    "-Wno-float-equal",
23    "-Wno-sign-compare",
24    "-Wno-reorder-init-list",
25  ]
26  if (is_mingw) {
27    cflags_cc += [
28      "-Wno-unused-const-variable",
29      "-Wno-unused-private-field",
30    ]
31  }
32}
33
34sources_files = [
35  "googletest/include/gtest/gtest-death-test.h",
36  "googletest/include/gtest/gtest-matchers.h",
37  "googletest/include/gtest/gtest-message.h",
38  "googletest/include/gtest/gtest-param-test.h",
39  "googletest/include/gtest/gtest-printers.h",
40  "googletest/include/gtest/gtest-test-part.h",
41  "googletest/include/gtest/gtest-typed-test.h",
42  "googletest/include/gtest/gtest_pred_impl.h",
43  "googletest/include/gtest/gtest_prod.h",
44  "googletest/include/gtest/hwext/gtest-ext.h",
45  "googletest/include/gtest/hwext/gtest-filter.h",
46  "googletest/include/gtest/hwext/gtest-multithread.h",
47  "googletest/include/gtest/hwext/gtest-tag.h",
48  "googletest/include/gtest/hwext/utils.h",
49  "googletest/include/gtest/internal/custom/gtest-port.h",
50  "googletest/include/gtest/internal/custom/gtest-printers.h",
51  "googletest/include/gtest/internal/custom/gtest.h",
52  "googletest/include/gtest/internal/gtest-death-test-internal.h",
53  "googletest/include/gtest/internal/gtest-filepath.h",
54  "googletest/include/gtest/internal/gtest-internal.h",
55  "googletest/include/gtest/internal/gtest-param-util.h",
56  "googletest/include/gtest/internal/gtest-port-arch.h",
57  "googletest/include/gtest/internal/gtest-port.h",
58  "googletest/include/gtest/internal/gtest-string.h",
59  "googletest/include/gtest/internal/gtest-type-util.h",
60  "googletest/src/gtest-all.cc",
61  "googletest/src/gtest-assertion-result.cc",
62  "googletest/src/gtest-death-test.cc",
63  "googletest/src/gtest-filepath.cc",
64  "googletest/src/gtest-internal-inl.h",
65  "googletest/src/gtest-matchers.cc",
66  "googletest/src/gtest-port.cc",
67  "googletest/src/gtest-printers.cc",
68  "googletest/src/gtest-test-part.cc",
69  "googletest/src/gtest-typed-test.cc",
70  "googletest/src/gtest.cc",
71  "googletest/src/hwext/gtest-ext.cc",
72  "googletest/src/hwext/gtest-filter.cc",
73  "googletest/src/hwext/gtest-multithread.cpp",
74  "googletest/src/hwext/gtest-tag.cc",
75  "googletest/src/hwext/gtest-utils.cc",
76]
77
78static_library("gtest") {
79  testonly = true
80  public = [
81    "googletest/include/gtest/gtest-spi.h",
82    "googletest/include/gtest/gtest.h",
83  ]
84  sources = sources_files
85  sources -= [ "googletest/src/gtest-all.cc" ]
86  public_configs = [ ":gtest_config" ]
87  configs += [ ":gtest_private_config" ]
88  configs -= [ "//build/config/coverage:default_coverage" ]
89}
90
91static_library("gtest_rtti") {
92  testonly = true
93  public = [
94    "googletest/include/gtest/gtest-spi.h",
95    "googletest/include/gtest/gtest.h",
96  ]
97  sources = sources_files
98  sources -= [ "googletest/src/gtest-all.cc" ]
99  public_configs = [ ":gtest_config" ]
100  configs += [ ":gtest_private_config_rtti" ]
101  configs -= [ "//build/config/coverage:default_coverage" ]
102}
103static_library("gtest_rtti_main") {  #Add gtest entry with RTTI compilation
104                                     # option
105  testonly = true
106  sources = [ "googletest/src/gtest_main.cc" ]
107  public_deps = [ ":gtest_rtti" ]
108  configs -= [ "//build/config/coverage:default_coverage" ]
109}
110
111static_library("gtest_main") {
112  testonly = true
113  sources = [ "googletest/src/gtest_main.cc" ]
114  public_deps = [ ":gtest" ]
115  configs -= [ "//build/config/coverage:default_coverage" ]
116}
117
118config("gmock_private_config") {
119  visibility = [ ":*" ]
120  include_dirs = [ "googlemock" ]
121}
122
123config("gmock_private_config_rtti") {
124  visibility = [ ":*" ]
125  include_dirs = [ "googlemock/include" ]
126  cflags = [ "-frtti" ]
127  cflags_objcc = [ "-frtti" ]
128  cflags_cc = [ "-frtti" ]
129}
130
131config("gmock_config") {
132  include_dirs = [ "googlemock/include" ]
133
134  cflags_cc = [
135    # The MOCK_METHODn() macros do not specify "override", which triggers this
136    # warning in users: "error: 'Method' overrides a member function but is not
137    # marked 'override' [-Werror,-Winconsistent-missing-override]". Suppress
138    # these warnings until https://github.com/google/googletest/issues/533 is
139    # fixed.
140    "-Wno-inconsistent-missing-override",
141  ]
142}
143
144gmock_sources_files = [
145  "googlemock/include/gmock/gmock-actions.h",
146  "googlemock/include/gmock/gmock-cardinalities.h",
147  "googlemock/include/gmock/gmock-function-mocker.h",
148  "googlemock/include/gmock/gmock-matchers.h",
149  "googlemock/include/gmock/gmock-more-actions.h",
150  "googlemock/include/gmock/gmock-more-matchers.h",
151  "googlemock/include/gmock/gmock-nice-strict.h",
152  "googlemock/include/gmock/gmock-spec-builders.h",
153  "googlemock/include/gmock/internal/custom/gmock-generated-actions.h",
154  "googlemock/include/gmock/internal/custom/gmock-matchers.h",
155  "googlemock/include/gmock/internal/custom/gmock-port.h",
156  "googlemock/include/gmock/internal/gmock-internal-utils.h",
157  "googlemock/include/gmock/internal/gmock-port.h",
158  "googlemock/include/gmock/internal/gmock-pp.h",
159  "googlemock/src/gmock-all.cc",
160  "googlemock/src/gmock-cardinalities.cc",
161  "googlemock/src/gmock-internal-utils.cc",
162  "googlemock/src/gmock-matchers.cc",
163  "googlemock/src/gmock-spec-builders.cc",
164  "googlemock/src/gmock.cc",
165]
166
167static_library("gmock") {
168  testonly = true
169  public = [ "googlemock/include/gmock/gmock.h" ]
170  sources = gmock_sources_files
171  sources -= [ "googlemock/src/gmock-all.cc" ]
172  public_configs = [ ":gmock_config" ]
173  configs += [ ":gmock_private_config" ]
174  configs -= [ "//build/config/coverage:default_coverage" ]
175  deps = [ ":gtest" ]
176}
177
178static_library("gmock_rtti") {
179  testonly = true
180  public = [ "googlemock/include/gmock/gmock.h" ]
181  sources = gmock_sources_files
182  sources -= [ "googlemock/src/gmock-all.cc" ]
183  public_configs = [ ":gmock_config" ]
184  configs += [ ":gmock_private_config_rtti" ]
185  configs -= [ "//build/config/coverage:default_coverage" ]
186  deps = [ ":gtest_rtti" ]
187}
188
189static_library("gmock_main") {
190  testonly = true
191  sources = [ "googlemock/src/gmock_main.cc" ]
192  public_deps = [
193    ":gmock",
194    ":gtest",
195  ]
196  configs -= [ "//build/config/coverage:default_coverage" ]
197}
198