1 # Copyright 2017 Google Inc.
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions are
9 # * Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer.
11 # * Redistributions in binary form must reproduce the above
12 # copyright notice, this list of conditions and the following disclaimer
13 # in the documentation and/or other materials provided with the
15 # * Neither the name of Google Inc. nor the names of its
16 # contributors may be used to endorse or promote products derived from
17 # this software without specific prior written permission.
19 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 # Bazel Build for Google C++ Testing Framework(Google Test)
33 package(default_visibility = ["//visibility:public"])
37 exports_files(["LICENSE"])
41 constraint_values = ["@platforms//os:qnx"],
46 constraint_values = ["@platforms//os:windows"],
51 constraint_values = ["@platforms//os:freebsd"],
56 constraint_values = ["@platforms//os:openbsd"],
60 name = "msvc_compiler",
62 "@bazel_tools//tools/cpp:compiler": "msvc-cl",
64 visibility = [":__subpackages__"],
69 values = {"define": "absl=1"},
72 # Library that defines the FRIEND_TEST macro.
75 hdrs = ["googletest/include/gtest/gtest_prod.h"],
76 includes = ["googletest/include"],
79 # Google Test including Google Mock
84 "googletest/src/*.cc",
86 "googletest/include/gtest/**/*.h",
87 "googlemock/src/*.cc",
88 "googlemock/include/gmock/**/*.h",
91 "googletest/src/gtest-all.cc",
92 "googletest/src/gtest_main.cc",
93 "googlemock/src/gmock-all.cc",
94 "googlemock/src/gmock_main.cc",
98 "googletest/include/gtest/*.h",
99 "googlemock/include/gmock/*.h",
104 "//conditions:default": ["-pthread"],
107 ":has_absl": ["GTEST_HAS_ABSL=1"],
108 "//conditions:default": [],
111 ":windows": ["windows_export_all_symbols"],
112 "//conditions:default": [],
116 "googlemock/include",
118 "googletest/include",
131 "//conditions:default": ["-pthread"],
135 "@com_google_absl//absl/container:flat_hash_set",
136 "@com_google_absl//absl/debugging:failure_signal_handler",
137 "@com_google_absl//absl/debugging:stacktrace",
138 "@com_google_absl//absl/debugging:symbolize",
139 "@com_google_absl//absl/flags:flag",
140 "@com_google_absl//absl/flags:parse",
141 "@com_google_absl//absl/flags:reflection",
142 "@com_google_absl//absl/flags:usage",
143 "@com_google_absl//absl/strings",
144 "@com_google_absl//absl/types:any",
145 "@com_google_absl//absl/types:optional",
146 "@com_google_absl//absl/types:variant",
147 "@com_googlesource_code_re2//:re2",
149 "//conditions:default": [],
155 srcs = ["googlemock/src/gmock_main.cc"],
157 ":windows": ["windows_export_all_symbols"],
158 "//conditions:default": [],
163 # The following rules build samples of how to use gTest.
165 name = "gtest_sample_lib",
167 "googletest/samples/sample1.cc",
168 "googletest/samples/sample2.cc",
169 "googletest/samples/sample4.cc",
172 "googletest/samples/prime_tables.h",
173 "googletest/samples/sample1.h",
174 "googletest/samples/sample2.h",
175 "googletest/samples/sample3-inl.h",
176 "googletest/samples/sample4.h",
179 ":windows": ["windows_export_all_symbols"],
180 "//conditions:default": [],
185 name = "gtest_samples",
187 # All Samples except:
189 # sample10 (main and takes a command line option and needs to be separate)
191 "googletest/samples/sample1_unittest.cc",
192 "googletest/samples/sample2_unittest.cc",
193 "googletest/samples/sample3_unittest.cc",
194 "googletest/samples/sample4_unittest.cc",
195 "googletest/samples/sample5_unittest.cc",
196 "googletest/samples/sample6_unittest.cc",
197 "googletest/samples/sample7_unittest.cc",
198 "googletest/samples/sample8_unittest.cc",
208 name = "sample9_unittest",
210 srcs = ["googletest/samples/sample9_unittest.cc"],
215 name = "sample10_unittest",
217 srcs = ["googletest/samples/sample10_unittest.cc"],