[MemProf] Templatize CallStackRadixTreeBuilder (NFC) (#117014)
[llvm-project.git] / libc / src / __support / threads / linux / CMakeLists.txt
blobfa11458f99b6c9c43d261bee417b4fd07299d6d3
1 add_header_library(
2   futex_word_type
3   HDRS
4     futex_word.h
7 if(NOT TARGET libc.src.__support.OSUtil.osutil)
8   return()
9 endif()
11 add_header_library(
12   futex_utils
13   HDRS
14     futex_utils.h
15   DEPENDS
16     .futex_word_type
17     libc.include.sys_syscall
18     libc.src.__support.OSUtil.osutil
19     libc.src.__support.CPP.atomic
20     libc.src.__support.CPP.limits
21     libc.src.__support.CPP.optional
22     libc.src.__support.time.linux.abs_timeout
25 set(monotonicity_flags)
26 if (LIBC_CONF_TIMEOUT_ENSURE_MONOTONICITY)
27   set(monotonicity_flags -DLIBC_COPT_TIMEOUT_ENSURE_MONOTONICITY=1)
28 else()
29   set(monotonicity_flags -DLIBC_COPT_TIMEOUT_ENSURE_MONOTONICITY=0)
30 endif()
32 add_header_library(
33   raw_mutex
34   HDRS
35     mutex.h
36   DEPENDS
37     .futex_utils
38     libc.src.__support.threads.sleep
39     libc.src.__support.time.linux.abs_timeout
40     libc.src.__support.time.linux.monotonicity
41     libc.src.__support.CPP.optional
42     libc.hdr.types.pid_t
43   COMPILE_OPTIONS
44     -DLIBC_COPT_RAW_MUTEX_DEFAULT_SPIN_COUNT=${LIBC_CONF_RAW_MUTEX_DEFAULT_SPIN_COUNT}
45     ${monotonicity_flags}
48 add_header_library(
49   rwlock
50   HDRS
51     rwlock.h
52   DEPENDS
53     .futex_utils
54     .raw_mutex
55     libc.src.__support.common
56     libc.src.__support.OSUtil.osutil
57     libc.src.__support.CPP.limits
58     libc.src.__support.threads.identifier
59   COMPILE_OPTIONS
60     -DLIBC_COPT_RWLOCK_DEFAULT_SPIN_COUNT=${LIBC_CONF_RWLOCK_DEFAULT_SPIN_COUNT}
61     ${monotonicity_flags}
64 add_header_library(
65   mutex
66   HDRS
67     mutex.h
68   DEPENDS
69     .futex_utils
70     .raw_mutex
71     libc.src.__support.threads.mutex_common
74 add_object_library(
75   thread
76   SRCS
77     thread.cpp
78   DEPENDS
79     .futex_utils
80     libc.config.app_h
81     libc.include.sys_syscall
82     libc.hdr.fcntl_macros  
83     libc.src.errno.errno
84     libc.src.__support.CPP.atomic
85     libc.src.__support.CPP.stringstream
86     libc.src.__support.CPP.string_view
87     libc.src.__support.common
88     libc.src.__support.error_or
89     libc.src.__support.threads.thread_common
90   COMPILE_OPTIONS
91     -O3
92     -fno-omit-frame-pointer # This allows us to sniff out the thread args from
93                             # the new thread's stack reliably.
94     -Wno-frame-address      # Yes, calling __builtin_return_address with a
95                             # value other than 0 is dangerous. We know.
98 add_object_library(
99   callonce
100   SRCS
101     callonce.cpp
102   HDRS
103     ../callonce.h
104     callonce.h
105   DEPENDS
106     .futex_utils
107     libc.src.__support.macros.optimization
110 add_object_library(
111   CndVar
112   SRCS
113     CndVar.cpp
114   HDRS
115     ../CndVar.h
116   DEPENDS
117     libc.include.sys_syscall
118     libc.src.__support.OSUtil.osutil
119     libc.src.__support.threads.linux.futex_word_type
120     libc.src.__support.threads.mutex
121     libc.src.__support.threads.linux.raw_mutex
122     libc.src.__support.CPP.mutex