[libc++][Android] Allow testing libc++ with clang-r536225 (#116149)
[llvm-project.git] / libc / src / __support / threads / CMakeLists.txt
blobbd49bbb5ad2fe73b000ed78d5189b543e0a1898c
1 add_header_library(
2   mutex_common
3   HDRS
4     mutex_common.h
7 add_header_library(
8   sleep
9   HDRS
10     sleep.h
13 add_header_library(
14   spin_lock
15   HDRS
16     spin_lock.h
17   DEPENDS
18     .sleep
19     libc.src.__support.CPP.atomic
22 if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS})
23   add_subdirectory(${LIBC_TARGET_OS})
24 endif()
26 if(TARGET libc.src.__support.threads.${LIBC_TARGET_OS}.mutex)
27   add_header_library(
28     mutex
29     HDRS
30       mutex.h
31     DEPENDS
32       .${LIBC_TARGET_OS}.mutex
33   )
35   add_object_library(
36     fork_callbacks
37     SRCS
38       fork_callbacks.cpp
39     HDRS
40       fork_callbacks.h
41     DEPENDS
42       .mutex
43       libc.src.__support.CPP.mutex
44   )
45 endif()
47 add_header_library(
48   thread_common
49   HDRS
50     thread.h
51   DEPENDS
52     libc.src.__support.common
53     libc.src.__support.CPP.atomic
54     libc.src.__support.CPP.optional
55     libc.src.__support.CPP.string_view
56     libc.src.__support.CPP.stringstream
59 if(TARGET libc.src.__support.threads.${LIBC_TARGET_OS}.thread)
60   add_object_library(
61     thread
62     SRCS
63       thread.cpp
64     DEPENDS
65       .mutex
66       .${LIBC_TARGET_OS}.thread
67       libc.src.__support.common
68       libc.src.__support.fixedvector
69       libc.src.__support.CPP.array
70       libc.src.__support.CPP.mutex
71       libc.src.__support.CPP.optional
72   )
73 endif()
75 if(TARGET libc.src.__support.threads.${LIBC_TARGET_OS}.callonce)
76   add_object_library(
77     callonce
78     ALIAS
79     DEPENDS
80       .${LIBC_TARGET_OS}.callonce
81   )
82 endif()
84 if(TARGET libc.src.__support.threads.${LIBC_TARGET_OS}.CndVar)
85   add_object_library(
86     CndVar
87     ALIAS
88     DEPENDS
89     .${LIBC_TARGET_OS}.CndVar
90   )
91 endif()
93 if (LLVM_LIBC_FULL_BUILD)
94   set(identifier_dependency_on_thread libc.src.__support.threads.thread)
95 endif()
97 add_header_library(
98   identifier
99   HDRS
100     identifier.h
101   DEPENDS
102     libc.src.__support.OSUtil.osutil
103     libc.src.__support.common
104     libc.include.sys_syscall
105     libc.hdr.types.pid_t
106     ${identifier_dependency_on_thread}