Debian Codegraph @

LspCpp/third_party/uri/deps/BUILD.bazel

raw
1 # Copyright 2017 Google Inc.
2 # All Rights Reserved.
3 #
4 #
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions are
7 # met:
8 #
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
14 # distribution.
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.
18 #
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.
30 #
31 # Bazel Build for Google C++ Testing Framework(Google Test)
32
33 package(default_visibility = ["//visibility:public"])
34
35 licenses(["notice"])
36
37 exports_files(["LICENSE"])
38
39 config_setting(
40 name = "qnx",
41 constraint_values = ["@platforms//os:qnx"],
42 )
43
44 config_setting(
45 name = "windows",
46 constraint_values = ["@platforms//os:windows"],
47 )
48
49 config_setting(
50 name = "freebsd",
51 constraint_values = ["@platforms//os:freebsd"],
52 )
53
54 config_setting(
55 name = "openbsd",
56 constraint_values = ["@platforms//os:openbsd"],
57 )
58
59 config_setting(
60 name = "msvc_compiler",
61 flag_values = {
62 "@bazel_tools//tools/cpp:compiler": "msvc-cl",
63 },
64 visibility = [":__subpackages__"],
65 )
66
67 config_setting(
68 name = "has_absl",
69 values = {"define": "absl=1"},
70 )
71
72 # Library that defines the FRIEND_TEST macro.
73 cc_library(
74 name = "gtest_prod",
75 hdrs = ["googletest/include/gtest/gtest_prod.h"],
76 includes = ["googletest/include"],
77 )
78
79 # Google Test including Google Mock
80 cc_library(
81 name = "gtest",
82 srcs = glob(
83 include = [
84 "googletest/src/*.cc",
85 "googletest/src/*.h",
86 "googletest/include/gtest/**/*.h",
87 "googlemock/src/*.cc",
88 "googlemock/include/gmock/**/*.h",
89 ],
90 exclude = [
91 "googletest/src/gtest-all.cc",
92 "googletest/src/gtest_main.cc",
93 "googlemock/src/gmock-all.cc",
94 "googlemock/src/gmock_main.cc",
95 ],
96 ),
97 hdrs = glob([
98 "googletest/include/gtest/*.h",
99 "googlemock/include/gmock/*.h",
100 ]),
101 copts = select({
102 ":qnx": [],
103 ":windows": [],
104 "//conditions:default": ["-pthread"],
105 }),
106 defines = select({
107 ":has_absl": ["GTEST_HAS_ABSL=1"],
108 "//conditions:default": [],
109 }),
110 features = select({
111 ":windows": ["windows_export_all_symbols"],
112 "//conditions:default": [],
113 }),
114 includes = [
115 "googlemock",
116 "googlemock/include",
117 "googletest",
118 "googletest/include",
119 ],
120 linkopts = select({
121 ":qnx": ["-lregex"],
122 ":windows": [],
123 ":freebsd": ["-lm", "-pthread"],
124 ":openbsd": ["-lm", "-pthread"],
125 "//conditions:default": ["-pthread"],
126 }),
127 deps = select({
128 ":has_absl": [
129 "@com_google_absl//absl/debugging:failure_signal_handler",
130 "@com_google_absl//absl/debugging:stacktrace",
131 "@com_google_absl//absl/debugging:symbolize",
132 "@com_google_absl//absl/strings",
133 "@com_google_absl//absl/types:any",
134 "@com_google_absl//absl/types:optional",
135 "@com_google_absl//absl/types:variant",
136 ],
137 "//conditions:default": [],
138 }),
139 )
140
141 cc_library(
142 name = "gtest_main",
143 srcs = ["googlemock/src/gmock_main.cc"],
144 features = select({
145 ":windows": ["windows_export_all_symbols"],
146 "//conditions:default": [],
147 }),
148 deps = [":gtest"],
149 )
150
151 # The following rules build samples of how to use gTest.
152 cc_library(
153 name = "gtest_sample_lib",
154 srcs = [
155 "googletest/samples/sample1.cc",
156 "googletest/samples/sample2.cc",
157 "googletest/samples/sample4.cc",
158 ],
159 hdrs = [
160 "googletest/samples/prime_tables.h",
161 "googletest/samples/sample1.h",
162 "googletest/samples/sample2.h",
163 "googletest/samples/sample3-inl.h",
164 "googletest/samples/sample4.h",
165 ],
166 features = select({
167 ":windows": ["windows_export_all_symbols"],
168 "//conditions:default": [],
169 }),
170 )
171
172 cc_test(
173 name = "gtest_samples",
174 size = "small",
175 # All Samples except:
176 # sample9 (main)
177 # sample10 (main and takes a command line option and needs to be separate)
178 srcs = [
179 "googletest/samples/sample1_unittest.cc",
180 "googletest/samples/sample2_unittest.cc",
181 "googletest/samples/sample3_unittest.cc",
182 "googletest/samples/sample4_unittest.cc",
183 "googletest/samples/sample5_unittest.cc",
184 "googletest/samples/sample6_unittest.cc",
185 "googletest/samples/sample7_unittest.cc",
186 "googletest/samples/sample8_unittest.cc",
187 ],
188 linkstatic = 0,
189 deps = [
190 "gtest_sample_lib",
191 ":gtest_main",
192 ],
193 )
194
195 cc_test(
196 name = "sample9_unittest",
197 size = "small",
198 srcs = ["googletest/samples/sample9_unittest.cc"],
199 deps = [":gtest"],
200 )
201
202 cc_test(
203 name = "sample10_unittest",
204 size = "small",
205 srcs = ["googletest/samples/sample10_unittest.cc"],
206 deps = [":gtest"],
207 )