1#
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#    https://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
17find_library(LIBRT rt)
18
19# Internal-only target, do not depend on directly.
20absl_cc_library(
21  NAME
22    atomic_hook
23  HDRS
24    "internal/atomic_hook.h"
25  DEPS
26    absl::config
27    absl::core_headers
28  COPTS
29    ${ABSL_DEFAULT_COPTS}
30)
31
32# Internal-only target, do not depend on directly.
33absl_cc_library(
34  NAME
35    errno_saver
36  HDRS
37    "internal/errno_saver.h"
38  DEPS
39    absl::config
40  COPTS
41    ${ABSL_DEFAULT_COPTS}
42)
43
44absl_cc_library(
45  NAME
46    log_severity
47  HDRS
48    "log_severity.h"
49  SRCS
50    "log_severity.cc"
51  DEPS
52    absl::core_headers
53  COPTS
54    ${ABSL_DEFAULT_COPTS}
55)
56
57# Internal-only target, do not depend on directly.
58absl_cc_library(
59  NAME
60    raw_logging_internal
61  HDRS
62    "internal/raw_logging.h"
63  SRCS
64    "internal/raw_logging.cc"
65  DEPS
66    absl::atomic_hook
67    absl::config
68    absl::core_headers
69    absl::errno_saver
70    absl::log_severity
71  COPTS
72    ${ABSL_DEFAULT_COPTS}
73)
74
75# Internal-only target, do not depend on directly.
76absl_cc_library(
77  NAME
78    spinlock_wait
79  HDRS
80    "internal/spinlock_wait.h"
81  SRCS
82    "internal/spinlock_akaros.inc"
83    "internal/spinlock_linux.inc"
84    "internal/spinlock_posix.inc"
85    "internal/spinlock_wait.cc"
86    "internal/spinlock_win32.inc"
87  COPTS
88    ${ABSL_DEFAULT_COPTS}
89  DEPS
90    absl::base_internal
91    absl::core_headers
92    absl::errno_saver
93)
94
95absl_cc_library(
96  NAME
97    config
98  HDRS
99    "config.h"
100    "options.h"
101    "policy_checks.h"
102  COPTS
103    ${ABSL_DEFAULT_COPTS}
104  PUBLIC
105)
106
107absl_cc_library(
108  NAME
109    dynamic_annotations
110  HDRS
111    "dynamic_annotations.h"
112  SRCS
113    "internal/dynamic_annotations.h"
114  COPTS
115    ${ABSL_DEFAULT_COPTS}
116  DEPS
117    absl::config
118  PUBLIC
119)
120
121absl_cc_library(
122  NAME
123    core_headers
124  HDRS
125    "attributes.h"
126    "const_init.h"
127    "macros.h"
128    "optimization.h"
129    "port.h"
130    "thread_annotations.h"
131    "internal/thread_annotations.h"
132  COPTS
133    ${ABSL_DEFAULT_COPTS}
134  DEPS
135    absl::config
136  PUBLIC
137)
138
139# Internal-only target, do not depend on directly.
140absl_cc_library(
141  NAME
142    malloc_internal
143  HDRS
144    "internal/direct_mmap.h"
145    "internal/low_level_alloc.h"
146  SRCS
147    "internal/low_level_alloc.cc"
148  COPTS
149    ${ABSL_DEFAULT_COPTS}
150  DEPS
151    absl::base
152    absl::base_internal
153    absl::config
154    absl::core_headers
155    absl::dynamic_annotations
156    absl::raw_logging_internal
157    Threads::Threads
158)
159
160# Internal-only target, do not depend on directly.
161absl_cc_library(
162  NAME
163    base_internal
164  HDRS
165    "internal/hide_ptr.h"
166    "internal/identity.h"
167    "internal/inline_variable.h"
168    "internal/invoke.h"
169    "internal/scheduling_mode.h"
170  COPTS
171    ${ABSL_DEFAULT_COPTS}
172  DEPS
173    absl::config
174    absl::type_traits
175)
176
177absl_cc_library(
178  NAME
179    base
180  HDRS
181    "call_once.h"
182    "casts.h"
183    "internal/cycleclock.h"
184    "internal/cycleclock_config.h"
185    "internal/low_level_scheduling.h"
186    "internal/per_thread_tls.h"
187    "internal/spinlock.h"
188    "internal/sysinfo.h"
189    "internal/thread_identity.h"
190    "internal/tsan_mutex_interface.h"
191    "internal/unscaledcycleclock.h"
192    "internal/unscaledcycleclock_config.h"
193  SRCS
194    "internal/cycleclock.cc"
195    "internal/spinlock.cc"
196    "internal/sysinfo.cc"
197    "internal/thread_identity.cc"
198    "internal/unscaledcycleclock.cc"
199  COPTS
200    ${ABSL_DEFAULT_COPTS}
201  LINKOPTS
202    ${ABSL_DEFAULT_LINKOPTS}
203    $<$<BOOL:${LIBRT}>:-lrt>
204    $<$<BOOL:${MINGW}>:-ladvapi32>
205  DEPS
206    absl::atomic_hook
207    absl::base_internal
208    absl::config
209    absl::core_headers
210    absl::dynamic_annotations
211    absl::log_severity
212    absl::raw_logging_internal
213    absl::spinlock_wait
214    absl::type_traits
215    Threads::Threads
216  PUBLIC
217)
218
219# Internal-only target, do not depend on directly.
220absl_cc_library(
221  NAME
222    throw_delegate
223  HDRS
224    "internal/throw_delegate.h"
225  SRCS
226    "internal/throw_delegate.cc"
227  COPTS
228    ${ABSL_DEFAULT_COPTS}
229  DEPS
230    absl::config
231    absl::raw_logging_internal
232)
233
234# Internal-only target, do not depend on directly.
235absl_cc_library(
236  NAME
237    exception_testing
238  HDRS
239    "internal/exception_testing.h"
240  COPTS
241    ${ABSL_DEFAULT_COPTS}
242  DEPS
243    absl::config
244    GTest::gtest
245  TESTONLY
246)
247
248# Internal-only target, do not depend on directly.
249absl_cc_library(
250  NAME
251    pretty_function
252  HDRS
253    "internal/pretty_function.h"
254  COPTS
255    ${ABSL_DEFAULT_COPTS}
256)
257
258# Internal-only target, do not depend on directly.
259absl_cc_library(
260  NAME
261    exception_safety_testing
262  HDRS
263    "internal/exception_safety_testing.h"
264  SRCS
265    "internal/exception_safety_testing.cc"
266  COPTS
267    ${ABSL_TEST_COPTS}
268  DEPS
269    absl::config
270    absl::pretty_function
271    absl::memory
272    absl::meta
273    absl::strings
274    absl::utility
275    GTest::gtest
276  TESTONLY
277)
278
279absl_cc_test(
280  NAME
281    absl_exception_safety_testing_test
282  SRCS
283    "exception_safety_testing_test.cc"
284  COPTS
285    ${ABSL_TEST_COPTS}
286  DEPS
287    absl::exception_safety_testing
288    absl::memory
289    GTest::gtest_main
290)
291
292# Internal-only target, do not depend on directly.
293absl_cc_library(
294  NAME
295    atomic_hook_test_helper
296  SRCS
297    "internal/atomic_hook_test_helper.cc"
298  COPTS
299    ${ABSL_TEST_COPTS}
300  DEPS
301    absl::atomic_hook
302    absl::core_headers
303  TESTONLY
304)
305
306absl_cc_test(
307  NAME
308    atomic_hook_test
309  SRCS
310    "internal/atomic_hook_test.cc"
311  COPTS
312    ${ABSL_TEST_COPTS}
313  DEPS
314    absl::atomic_hook_test_helper
315    absl::atomic_hook
316    absl::core_headers
317    GTest::gmock
318    GTest::gtest_main
319)
320
321absl_cc_test(
322  NAME
323    bit_cast_test
324  SRCS
325    "bit_cast_test.cc"
326  COPTS
327    ${ABSL_TEST_COPTS}
328  DEPS
329    absl::base
330    absl::core_headers
331    GTest::gtest_main
332)
333
334absl_cc_test(
335  NAME
336    errno_saver_test
337  SRCS
338    "internal/errno_saver_test.cc"
339  COPTS
340    ${ABSL_TEST_COPTS}
341  DEPS
342    absl::errno_saver
343    absl::strerror
344    GTest::gmock
345    GTest::gtest_main
346)
347
348absl_cc_test(
349  NAME
350    throw_delegate_test
351  SRCS
352    "throw_delegate_test.cc"
353  COPTS
354    ${ABSL_TEST_COPTS}
355  DEPS
356    absl::base
357    absl::config
358    absl::throw_delegate
359    GTest::gtest_main
360)
361
362absl_cc_test(
363  NAME
364    inline_variable_test
365  SRCS
366    "internal/inline_variable_testing.h"
367    "inline_variable_test.cc"
368    "inline_variable_test_a.cc"
369    "inline_variable_test_b.cc"
370  COPTS
371    ${ABSL_TEST_COPTS}
372  DEPS
373    absl::base_internal
374    GTest::gtest_main
375)
376
377absl_cc_test(
378  NAME
379    invoke_test
380  SRCS
381    "invoke_test.cc"
382  COPTS
383    ${ABSL_TEST_COPTS}
384  DEPS
385    absl::base_internal
386    absl::memory
387    absl::strings
388    GTest::gmock
389    GTest::gtest_main
390)
391
392# Internal-only target, do not depend on directly.
393absl_cc_library(
394  NAME
395    spinlock_test_common
396  SRCS
397    "spinlock_test_common.cc"
398  COPTS
399    ${ABSL_TEST_COPTS}
400  DEPS
401    absl::base
402    absl::config
403    absl::base_internal
404    absl::core_headers
405    absl::synchronization
406    GTest::gtest
407  TESTONLY
408)
409
410# On bazel BUILD this target use "alwayslink = 1" which is not implemented here
411absl_cc_test(
412  NAME
413    spinlock_test
414  SRCS
415    "spinlock_test_common.cc"
416  COPTS
417    ${ABSL_TEST_COPTS}
418  DEPS
419    absl::base
420    absl::base_internal
421    absl::config
422    absl::core_headers
423    absl::synchronization
424    GTest::gtest_main
425)
426
427# Internal-only target, do not depend on directly.
428absl_cc_library(
429  NAME
430    endian
431  HDRS
432    "internal/endian.h"
433    "internal/unaligned_access.h"
434  COPTS
435    ${ABSL_DEFAULT_COPTS}
436  DEPS
437    absl::base
438    absl::config
439    absl::core_headers
440  PUBLIC
441)
442
443absl_cc_test(
444  NAME
445    endian_test
446  SRCS
447    "internal/endian_test.cc"
448  COPTS
449    ${ABSL_TEST_COPTS}
450  DEPS
451    absl::base
452    absl::config
453    absl::endian
454    GTest::gtest_main
455)
456
457absl_cc_test(
458  NAME
459    config_test
460  SRCS
461    "config_test.cc"
462  COPTS
463    ${ABSL_TEST_COPTS}
464  DEPS
465    absl::config
466    absl::synchronization
467    GTest::gtest_main
468)
469
470absl_cc_test(
471  NAME
472    call_once_test
473  SRCS
474    "call_once_test.cc"
475  COPTS
476    ${ABSL_TEST_COPTS}
477  DEPS
478    absl::base
479    absl::core_headers
480    absl::synchronization
481    GTest::gtest_main
482)
483
484absl_cc_test(
485  NAME
486    raw_logging_test
487  SRCS
488    "raw_logging_test.cc"
489  COPTS
490    ${ABSL_TEST_COPTS}
491  DEPS
492    absl::raw_logging_internal
493    absl::strings
494    GTest::gtest_main
495)
496
497absl_cc_test(
498  NAME
499    sysinfo_test
500  SRCS
501    "internal/sysinfo_test.cc"
502  COPTS
503    ${ABSL_TEST_COPTS}
504  DEPS
505    absl::base
506    absl::synchronization
507    GTest::gtest_main
508)
509
510absl_cc_test(
511  NAME
512    low_level_alloc_test
513  SRCS
514    "internal/low_level_alloc_test.cc"
515  COPTS
516    ${ABSL_TEST_COPTS}
517  DEPS
518    absl::malloc_internal
519    absl::node_hash_map
520    Threads::Threads
521)
522
523absl_cc_test(
524  NAME
525    thread_identity_test
526  SRCS
527    "internal/thread_identity_test.cc"
528  COPTS
529    ${ABSL_TEST_COPTS}
530  DEPS
531    absl::base
532    absl::core_headers
533    absl::synchronization
534    Threads::Threads
535    GTest::gtest_main
536)
537
538# Internal-only target, do not depend on directly.
539absl_cc_library(
540  NAME
541    scoped_set_env
542  SRCS
543    "internal/scoped_set_env.cc"
544  HDRS
545    "internal/scoped_set_env.h"
546  COPTS
547    ${ABSL_DEFAULT_COPTS}
548  DEPS
549    absl::config
550    absl::raw_logging_internal
551)
552
553absl_cc_test(
554  NAME
555    scoped_set_env_test
556  SRCS
557    "internal/scoped_set_env_test.cc"
558  COPTS
559    ${ABSL_TEST_COPTS}
560  DEPS
561    absl::scoped_set_env
562    GTest::gtest_main
563)
564
565absl_cc_test(
566  NAME
567    cmake_thread_test
568  SRCS
569    "internal/cmake_thread_test.cc"
570  COPTS
571    ${ABSL_TEST_COPTS}
572  DEPS
573    absl::base
574)
575
576absl_cc_test(
577  NAME
578    log_severity_test
579  SRCS
580    "log_severity_test.cc"
581  DEPS
582    absl::flags_internal
583    absl::flags_marshalling
584    absl::log_severity
585    absl::strings
586    GTest::gmock
587    GTest::gtest_main
588)
589
590# Internal-only target, do not depend on directly.
591absl_cc_library(
592  NAME
593    strerror
594  SRCS
595    "internal/strerror.cc"
596  HDRS
597    "internal/strerror.h"
598  COPTS
599    ${ABSL_DEFAULT_COPTS}
600  LINKOPTS
601    ${ABSL_DEFAULT_LINKOPTS}
602  DEPS
603    absl::config
604    absl::core_headers
605    absl::errno_saver
606)
607
608absl_cc_test(
609  NAME
610    strerror_test
611  SRCS
612    "internal/strerror_test.cc"
613  COPTS
614    ${ABSL_TEST_COPTS}
615  DEPS
616    absl::strerror
617    absl::strings
618    GTest::gmock
619    GTest::gtest_main
620)
621
622# Internal-only target, do not depend on directly.
623absl_cc_library(
624  NAME
625    fast_type_id
626  HDRS
627    "internal/fast_type_id.h"
628  COPTS
629    ${ABSL_DEFAULT_COPTS}
630  LINKOPTS
631    ${ABSL_DEFAULT_LINKOPTS}
632  DEPS
633    absl::config
634)
635
636absl_cc_test(
637  NAME
638    fast_type_id_test
639  SRCS
640    "internal/fast_type_id_test.cc"
641  COPTS
642    ${ABSL_TEST_COPTS}
643  DEPS
644    absl::fast_type_id
645    GTest::gtest_main
646)
647
648# Internal-only target, do not depend on directly.
649absl_cc_library(
650  NAME
651    prefetch
652  HDRS
653    "internal/prefetch.h"
654  COPTS
655    ${ABSL_DEFAULT_COPTS}
656  LINKOPTS
657    ${ABSL_DEFAULT_LINKOPTS}
658  DEPS
659    absl::config
660)
661
662absl_cc_test(
663  NAME
664    prefetch_test
665  SRCS
666    "internal/prefetch_test.cc"
667  COPTS
668    ${ABSL_TEST_COPTS}
669  DEPS
670    absl::prefetch
671    GTest::gtest_main
672)
673
674absl_cc_test(
675  NAME
676    optimization_test
677  SRCS
678    "optimization_test.cc"
679  COPTS
680    ${ABSL_TEST_COPTS}
681  DEPS
682    absl::core_headers
683    absl::optional
684    GTest::gtest_main
685)
686