blob: 49ae1824ffcb33641537d8148f82a3ca3021e2c6 [file] [log] [blame]
mistergc2e75482017-09-19 16:54:40 -04001#
2# Copyright 2017 The Abseil Authors.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17load(
Abseil Team284378a2018-12-05 12:37:41 -080018 "//absl:copts/configure_copts.bzl",
mistergc2e75482017-09-19 16:54:40 -040019 "ABSL_DEFAULT_COPTS",
20 "ABSL_TEST_COPTS",
21 "ABSL_EXCEPTIONS_FLAG",
Abseil Teamf0f15c22018-08-09 11:32:15 -070022 "ABSL_EXCEPTIONS_FLAG_LINKOPTS",
mistergc2e75482017-09-19 16:54:40 -040023)
mistergc2e75482017-09-19 16:54:40 -040024
25package(default_visibility = ["//visibility:public"])
26
27licenses(["notice"]) # Apache 2.0
28
mistergc2e75482017-09-19 16:54:40 -040029cc_library(
30 name = "spinlock_wait",
31 srcs = [
Abseil Teamdedb4ee2017-10-24 10:37:49 -070032 "internal/spinlock_akaros.inc",
Abseil Teamd8cfe9f2018-08-20 08:18:32 -070033 "internal/spinlock_linux.inc",
mistergc2e75482017-09-19 16:54:40 -040034 "internal/spinlock_posix.inc",
35 "internal/spinlock_wait.cc",
36 "internal/spinlock_win32.inc",
37 ],
38 hdrs = [
39 "internal/scheduling_mode.h",
40 "internal/spinlock_wait.h",
41 ],
42 copts = ABSL_DEFAULT_COPTS,
Abseil Team6de53812017-10-13 10:21:40 -070043 visibility = [
44 "//absl/base:__pkg__",
45 ],
mistergc2e75482017-09-19 16:54:40 -040046 deps = [":core_headers"],
47)
48
49cc_library(
50 name = "config",
51 hdrs = [
52 "config.h",
53 "policy_checks.h",
54 ],
55 copts = ABSL_DEFAULT_COPTS,
56)
57
58cc_library(
59 name = "dynamic_annotations",
60 srcs = ["dynamic_annotations.cc"],
61 hdrs = ["dynamic_annotations.h"],
62 copts = ABSL_DEFAULT_COPTS,
63 defines = ["__CLANG_SUPPORT_DYN_ANNOTATION__"],
64)
65
66cc_library(
67 name = "core_headers",
68 hdrs = [
69 "attributes.h",
Abseil Team389ec3f2018-12-13 10:30:03 -080070 "const_init.h",
mistergc2e75482017-09-19 16:54:40 -040071 "macros.h",
72 "optimization.h",
73 "port.h",
74 "thread_annotations.h",
75 ],
76 copts = ABSL_DEFAULT_COPTS,
77 deps = [
78 ":config",
mistergc2e75482017-09-19 16:54:40 -040079 ],
80)
81
82cc_library(
mistergc2e75482017-09-19 16:54:40 -040083 name = "malloc_internal",
84 srcs = [
85 "internal/low_level_alloc.cc",
mistergc2e75482017-09-19 16:54:40 -040086 ],
87 hdrs = [
Abseil Teama7e522d2018-04-11 09:52:42 -070088 "internal/direct_mmap.h",
mistergc2e75482017-09-19 16:54:40 -040089 "internal/low_level_alloc.h",
mistergc2e75482017-09-19 16:54:40 -040090 ],
91 copts = ABSL_DEFAULT_COPTS,
Abseil Teamb16aeb62019-01-07 09:01:16 -080092 linkopts = select({
93 "//absl:windows": [],
94 "//conditions:default": ["-pthread"],
95 }),
Abseil Team6de53812017-10-13 10:21:40 -070096 visibility = [
97 "//absl:__subpackages__",
98 ],
mistergc2e75482017-09-19 16:54:40 -040099 deps = [
100 ":base",
101 ":config",
102 ":core_headers",
103 ":dynamic_annotations",
Abseil Team53c239d2017-09-19 17:15:26 -0700104 ":spinlock_wait",
mistergc2e75482017-09-19 16:54:40 -0400105 ],
106)
107
108cc_library(
109 name = "base_internal",
110 hdrs = [
Abseil Team014f02a2018-05-22 16:34:47 -0700111 "internal/hide_ptr.h",
mistergc2e75482017-09-19 16:54:40 -0400112 "internal/identity.h",
Abseil Teamcf1db732018-01-24 11:58:42 -0800113 "internal/inline_variable.h",
mistergc2e75482017-09-19 16:54:40 -0400114 "internal/invoke.h",
Abseil Team44b0faf2018-12-04 11:01:12 -0800115 "internal/scheduling_mode.h",
mistergc2e75482017-09-19 16:54:40 -0400116 ],
117 copts = ABSL_DEFAULT_COPTS,
Abseil Team6de53812017-10-13 10:21:40 -0700118 visibility = [
119 "//absl:__subpackages__",
120 ],
mistergc2e75482017-09-19 16:54:40 -0400121)
122
123cc_library(
124 name = "base",
125 srcs = [
126 "internal/cycleclock.cc",
127 "internal/raw_logging.cc",
128 "internal/spinlock.cc",
129 "internal/sysinfo.cc",
130 "internal/thread_identity.cc",
131 "internal/unscaledcycleclock.cc",
132 ],
133 hdrs = [
134 "call_once.h",
135 "casts.h",
136 "internal/atomic_hook.h",
137 "internal/cycleclock.h",
mistergc2e75482017-09-19 16:54:40 -0400138 "internal/low_level_scheduling.h",
139 "internal/per_thread_tls.h",
140 "internal/raw_logging.h",
141 "internal/spinlock.h",
142 "internal/sysinfo.h",
143 "internal/thread_identity.h",
144 "internal/tsan_mutex_interface.h",
145 "internal/unscaledcycleclock.h",
Abseil Team5a8de8a2018-01-17 09:53:47 -0800146 "log_severity.h",
mistergc2e75482017-09-19 16:54:40 -0400147 ],
148 copts = ABSL_DEFAULT_COPTS,
Abseil Teamb16aeb62019-01-07 09:01:16 -0800149 linkopts = select({
150 "//absl:windows": [],
151 "//conditions:default": ["-pthread"],
152 }),
mistergc2e75482017-09-19 16:54:40 -0400153 deps = [
154 ":base_internal",
155 ":config",
156 ":core_headers",
157 ":dynamic_annotations",
158 ":spinlock_wait",
159 ],
160)
161
162cc_test(
Abseil Team26b789f2018-05-04 09:58:56 -0700163 name = "atomic_hook_test",
164 size = "small",
165 srcs = ["internal/atomic_hook_test.cc"],
166 copts = ABSL_TEST_COPTS,
167 deps = [
168 ":base",
169 ":core_headers",
170 "@com_google_googletest//:gtest_main",
171 ],
172)
173
174cc_test(
mistergc2e75482017-09-19 16:54:40 -0400175 name = "bit_cast_test",
176 size = "small",
177 srcs = [
178 "bit_cast_test.cc",
179 ],
180 copts = ABSL_TEST_COPTS,
181 deps = [
182 ":base",
183 ":core_headers",
Abseil Team2a62fbd2017-09-25 15:35:12 -0700184 "@com_google_googletest//:gtest_main",
185 ],
mistergc2e75482017-09-19 16:54:40 -0400186)
187
188cc_library(
189 name = "throw_delegate",
190 srcs = ["internal/throw_delegate.cc"],
191 hdrs = ["internal/throw_delegate.h"],
192 copts = ABSL_DEFAULT_COPTS + ABSL_EXCEPTIONS_FLAG,
Abseil Teamf0f15c22018-08-09 11:32:15 -0700193 linkopts = ABSL_EXCEPTIONS_FLAG_LINKOPTS,
Abseil Team6de53812017-10-13 10:21:40 -0700194 visibility = [
195 "//absl:__subpackages__",
196 ],
mistergc2e75482017-09-19 16:54:40 -0400197 deps = [
198 ":base",
199 ":config",
200 ],
201)
202
203cc_test(
204 name = "throw_delegate_test",
205 srcs = ["throw_delegate_test.cc"],
206 copts = ABSL_TEST_COPTS + ABSL_EXCEPTIONS_FLAG,
Abseil Teamf0f15c22018-08-09 11:32:15 -0700207 linkopts = ABSL_EXCEPTIONS_FLAG_LINKOPTS,
mistergc2e75482017-09-19 16:54:40 -0400208 deps = [
209 ":throw_delegate",
Abseil Team2a62fbd2017-09-25 15:35:12 -0700210 "@com_google_googletest//:gtest_main",
211 ],
mistergc2e75482017-09-19 16:54:40 -0400212)
213
214cc_library(
215 name = "exception_testing",
216 testonly = 1,
217 hdrs = ["internal/exception_testing.h"],
218 copts = ABSL_TEST_COPTS,
Abseil Team7b3c38a2018-03-30 13:35:58 -0700219 visibility = [
220 "//absl:__subpackages__",
221 ],
mistergc2e75482017-09-19 16:54:40 -0400222 deps = [
223 ":config",
224 "@com_google_googletest//:gtest",
225 ],
226)
227
Abseil Team8db6cfd2017-10-30 15:55:37 -0700228cc_library(
229 name = "pretty_function",
230 hdrs = ["internal/pretty_function.h"],
Abseil Team02f833c2017-11-13 16:26:03 -0800231 visibility = ["//absl:__subpackages__"],
Abseil Team8db6cfd2017-10-30 15:55:37 -0700232)
233
234cc_library(
235 name = "exception_safety_testing",
236 testonly = 1,
237 srcs = ["internal/exception_safety_testing.cc"],
238 hdrs = ["internal/exception_safety_testing.h"],
239 copts = ABSL_TEST_COPTS + ABSL_EXCEPTIONS_FLAG,
Abseil Teamf0f15c22018-08-09 11:32:15 -0700240 linkopts = ABSL_EXCEPTIONS_FLAG_LINKOPTS,
Abseil Team8db6cfd2017-10-30 15:55:37 -0700241 deps = [
242 ":config",
243 ":pretty_function",
Abseil Teamae0cef32017-11-22 07:42:54 -0800244 "//absl/memory",
Abseil Team8db6cfd2017-10-30 15:55:37 -0700245 "//absl/meta:type_traits",
246 "//absl/strings",
Abseil Team7990fd42018-11-06 13:01:25 -0800247 "//absl/utility",
Abseil Team8db6cfd2017-10-30 15:55:37 -0700248 "@com_google_googletest//:gtest",
249 ],
250)
251
252cc_test(
253 name = "exception_safety_testing_test",
254 srcs = ["exception_safety_testing_test.cc"],
255 copts = ABSL_TEST_COPTS + ABSL_EXCEPTIONS_FLAG,
Abseil Teamf0f15c22018-08-09 11:32:15 -0700256 linkopts = ABSL_EXCEPTIONS_FLAG_LINKOPTS,
Abseil Team8db6cfd2017-10-30 15:55:37 -0700257 deps = [
258 ":exception_safety_testing",
259 "//absl/memory",
260 "@com_google_googletest//:gtest_main",
261 ],
262)
263
mistergc2e75482017-09-19 16:54:40 -0400264cc_test(
Abseil Teamcf1db732018-01-24 11:58:42 -0800265 name = "inline_variable_test",
266 size = "small",
267 srcs = [
268 "inline_variable_test.cc",
269 "inline_variable_test_a.cc",
270 "inline_variable_test_b.cc",
271 "internal/inline_variable_testing.h",
272 ],
273 copts = ABSL_TEST_COPTS,
274 deps = [
275 ":base_internal",
276 "@com_google_googletest//:gtest_main",
277 ],
278)
279
280cc_test(
mistergc2e75482017-09-19 16:54:40 -0400281 name = "invoke_test",
282 size = "small",
283 srcs = ["invoke_test.cc"],
284 copts = ABSL_TEST_COPTS,
285 deps = [
286 ":base_internal",
mistergc2e75482017-09-19 16:54:40 -0400287 "//absl/memory",
Abseil Team2a62fbd2017-09-25 15:35:12 -0700288 "//absl/strings",
289 "@com_google_googletest//:gtest_main",
290 ],
mistergc2e75482017-09-19 16:54:40 -0400291)
292
293# Common test library made available for use in non-absl code that overrides
294# AbslInternalSpinLockDelay and AbslInternalSpinLockWake.
295cc_library(
296 name = "spinlock_test_common",
297 testonly = 1,
298 srcs = ["spinlock_test_common.cc"],
299 copts = ABSL_TEST_COPTS,
300 deps = [
301 ":base",
Abseil Team53c239d2017-09-19 17:15:26 -0700302 ":core_headers",
303 ":spinlock_wait",
mistergc2e75482017-09-19 16:54:40 -0400304 "//absl/synchronization",
305 "@com_google_googletest//:gtest",
306 ],
307 alwayslink = 1,
308)
309
310cc_test(
311 name = "spinlock_test",
312 size = "medium",
313 srcs = ["spinlock_test_common.cc"],
314 copts = ABSL_TEST_COPTS,
Abseil Teamf21d1872018-10-02 12:09:18 -0700315 tags = ["no_test_wasm"],
mistergc2e75482017-09-19 16:54:40 -0400316 deps = [
317 ":base",
Abseil Team53c239d2017-09-19 17:15:26 -0700318 ":core_headers",
319 ":spinlock_wait",
mistergc2e75482017-09-19 16:54:40 -0400320 "//absl/synchronization",
321 "@com_google_googletest//:gtest_main",
322 ],
323)
324
325cc_library(
Abseil Team44b0faf2018-12-04 11:01:12 -0800326 name = "spinlock_benchmark_common",
327 testonly = 1,
328 srcs = ["internal/spinlock_benchmark.cc"],
329 copts = ABSL_DEFAULT_COPTS,
330 visibility = [
331 "//absl/base:__pkg__",
332 ],
333 deps = [
334 ":base",
335 ":base_internal",
336 "//absl/synchronization",
337 "@com_github_google_benchmark//:benchmark_main",
338 ],
339 alwayslink = 1,
340)
341
342cc_binary(
343 name = "spinlock_benchmark",
344 testonly = 1,
345 copts = ABSL_DEFAULT_COPTS,
346 visibility = ["//visibility:private"],
347 deps = [
348 ":spinlock_benchmark_common",
349 ],
350)
351
352cc_library(
mistergc2e75482017-09-19 16:54:40 -0400353 name = "endian",
354 hdrs = [
355 "internal/endian.h",
356 "internal/unaligned_access.h",
357 ],
358 copts = ABSL_DEFAULT_COPTS,
359 deps = [
360 ":config",
361 ":core_headers",
362 ],
363)
364
365cc_test(
366 name = "endian_test",
367 srcs = ["internal/endian_test.cc"],
368 copts = ABSL_TEST_COPTS,
369 deps = [
370 ":base",
371 ":config",
372 ":endian",
Abseil Team2a62fbd2017-09-25 15:35:12 -0700373 "@com_google_googletest//:gtest_main",
374 ],
mistergc2e75482017-09-19 16:54:40 -0400375)
376
377cc_test(
378 name = "config_test",
379 srcs = ["config_test.cc"],
380 copts = ABSL_TEST_COPTS,
Abseil Teamf21d1872018-10-02 12:09:18 -0700381 tags = [
382 "no_test_wasm",
383 ],
mistergc2e75482017-09-19 16:54:40 -0400384 deps = [
385 ":config",
Abseil Team8d8dcb02017-09-29 08:44:28 -0700386 "//absl/synchronization:thread_pool",
Abseil Team2a62fbd2017-09-25 15:35:12 -0700387 "@com_google_googletest//:gtest_main",
388 ],
mistergc2e75482017-09-19 16:54:40 -0400389)
390
391cc_test(
392 name = "call_once_test",
393 srcs = ["call_once_test.cc"],
394 copts = ABSL_TEST_COPTS,
Abseil Teamf21d1872018-10-02 12:09:18 -0700395 tags = [
396 "no_test_wasm",
397 ],
mistergc2e75482017-09-19 16:54:40 -0400398 deps = [
399 ":base",
400 ":core_headers",
401 "//absl/synchronization",
Abseil Team2a62fbd2017-09-25 15:35:12 -0700402 "@com_google_googletest//:gtest_main",
403 ],
mistergc2e75482017-09-19 16:54:40 -0400404)
405
406cc_test(
407 name = "raw_logging_test",
408 srcs = ["raw_logging_test.cc"],
409 copts = ABSL_TEST_COPTS,
410 deps = [
411 ":base",
Abseil Team02687952018-07-12 10:34:29 -0700412 "//absl/strings",
mistergc2e75482017-09-19 16:54:40 -0400413 "@com_google_googletest//:gtest_main",
414 ],
415)
416
417cc_test(
418 name = "sysinfo_test",
419 size = "small",
420 srcs = ["internal/sysinfo_test.cc"],
421 copts = ABSL_TEST_COPTS,
422 deps = [
423 ":base",
424 "//absl/synchronization",
Abseil Team2a62fbd2017-09-25 15:35:12 -0700425 "@com_google_googletest//:gtest_main",
426 ],
mistergc2e75482017-09-19 16:54:40 -0400427)
428
429cc_test(
430 name = "low_level_alloc_test",
431 size = "small",
432 srcs = ["internal/low_level_alloc_test.cc"],
433 copts = ABSL_TEST_COPTS,
Abseil Team7efd8dc2018-06-26 10:45:35 -0700434 tags = ["no_test_ios_x86_64"],
mistergc2e75482017-09-19 16:54:40 -0400435 deps = [":malloc_internal"],
436)
437
438cc_test(
439 name = "thread_identity_test",
440 size = "small",
441 srcs = ["internal/thread_identity_test.cc"],
442 copts = ABSL_TEST_COPTS,
Abseil Teamf21d1872018-10-02 12:09:18 -0700443 tags = [
444 "no_test_wasm",
445 ],
mistergc2e75482017-09-19 16:54:40 -0400446 deps = [
447 ":base",
Abseil Team53c239d2017-09-19 17:15:26 -0700448 ":core_headers",
mistergc2e75482017-09-19 16:54:40 -0400449 "//absl/synchronization",
Abseil Team2a62fbd2017-09-25 15:35:12 -0700450 "@com_google_googletest//:gtest_main",
451 ],
mistergc2e75482017-09-19 16:54:40 -0400452)
Abseil Team26b789f2018-05-04 09:58:56 -0700453
Abseil Team30de2042018-05-17 09:05:57 -0700454cc_test(
Abseil Team26b789f2018-05-04 09:58:56 -0700455 name = "thread_identity_benchmark",
Abseil Team26b789f2018-05-04 09:58:56 -0700456 srcs = ["internal/thread_identity_benchmark.cc"],
457 copts = ABSL_TEST_COPTS,
Abseil Team30de2042018-05-17 09:05:57 -0700458 tags = ["benchmark"],
Abseil Team26b789f2018-05-04 09:58:56 -0700459 visibility = ["//visibility:private"],
460 deps = [
461 ":base",
462 "//absl/synchronization",
Abseil Team7aacab82018-05-31 12:26:35 -0700463 "@com_github_google_benchmark//:benchmark_main",
Abseil Team26b789f2018-05-04 09:58:56 -0700464 ],
465)
Abseil Team5e7d4592018-08-23 10:41:14 -0700466
467cc_library(
468 name = "bits",
469 hdrs = ["internal/bits.h"],
470 visibility = [
471 "//absl:__subpackages__",
472 ],
473 deps = [":core_headers"],
474)
475
476cc_test(
477 name = "bits_test",
478 size = "small",
479 srcs = ["internal/bits_test.cc"],
480 copts = ABSL_TEST_COPTS,
481 deps = [
482 ":bits",
483 "@com_google_googletest//:gtest_main",
484 ],
485)