xref: /llvm-project/libc/src/time/CMakeLists.txt (revision f9c2377fb68e5051b3061186c507f7b87db2a8b2)
1if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS})
2  add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS})
3endif()
4
5add_header_library(
6  time_constants
7  HDRS
8    time_constants.h
9  DEPENDS
10    libc.include.time
11    libc.src.__support.CPP.array
12    libc.src.__support.CPP.string_view
13    libc.hdr.types.time_t
14)
15
16add_object_library(
17  time_utils
18  SRCS
19    time_utils.cpp
20  HDRS
21    time_utils.h
22  DEPENDS
23    libc.include.time
24    libc.src.__support.CPP.limits
25    libc.src.errno.errno
26    .time_constants
27    libc.hdr.types.time_t
28    libc.hdr.types.size_t
29    libc.hdr.types.struct_tm
30)
31
32add_entrypoint_object(
33  asctime
34  SRCS
35    asctime.cpp
36  HDRS
37    asctime.h
38  DEPENDS
39    .time_utils
40    .time_constants
41    libc.include.time
42    libc.hdr.types.struct_tm
43)
44
45add_entrypoint_object(
46  asctime_r
47  SRCS
48    asctime_r.cpp
49  HDRS
50    asctime_r.h
51  DEPENDS
52    .time_utils
53    .time_constants
54    libc.include.time
55    libc.hdr.types.struct_tm
56)
57
58add_entrypoint_object(
59  ctime
60  SRCS
61    ctime.cpp
62  HDRS
63    ctime.h
64  DEPENDS
65    .time_utils
66    .time_constants
67    libc.hdr.types.time_t
68    libc.include.time
69)
70
71add_entrypoint_object(
72  ctime_r
73  SRCS
74    ctime_r.cpp
75  HDRS
76    ctime_r.h
77  DEPENDS
78    .time_utils
79    .time_constants
80    libc.hdr.types.time_t
81    libc.include.time
82)
83
84add_entrypoint_object(
85  difftime
86  SRCS
87    difftime.cpp
88  HDRS
89    difftime.h
90  DEPENDS
91    libc.include.time
92    libc.hdr.types.time_t
93)
94
95add_entrypoint_object(
96  gmtime
97  SRCS
98    gmtime.cpp
99  HDRS
100    gmtime.h
101  DEPENDS
102    .time_utils
103    libc.include.time
104    libc.hdr.types.time_t
105    libc.hdr.types.struct_tm
106)
107
108add_entrypoint_object(
109  gmtime_r
110  SRCS
111    gmtime_r.cpp
112  HDRS
113    gmtime_r.h
114  DEPENDS
115    .time_utils
116    libc.include.time
117    libc.hdr.types.time_t
118    libc.hdr.types.struct_tm
119)
120
121add_entrypoint_object(
122  mktime
123  SRCS
124    mktime.cpp
125  HDRS
126    mktime.h
127  DEPENDS
128    .time_utils
129    .time_constants
130    libc.include.time
131    libc.src.errno.errno
132    libc.hdr.types.time_t
133    libc.hdr.types.struct_tm
134)
135
136add_entrypoint_object(
137  time
138  SRCS
139    time.cpp
140  HDRS
141    time_func.h
142  DEPENDS
143    libc.hdr.time_macros
144    libc.hdr.types.time_t
145    libc.src.__support.time.clock_gettime
146    libc.src.errno.errno
147    libc.hdr.types.struct_tm
148)
149
150add_entrypoint_object(
151  timespec_get
152  ALIAS
153  DEPENDS
154    .${LIBC_TARGET_OS}.timespec_get
155)
156
157add_entrypoint_object(
158  clock
159  ALIAS
160  DEPENDS
161    .${LIBC_TARGET_OS}.clock
162)
163
164add_entrypoint_object(
165  nanosleep
166  ALIAS
167  DEPENDS
168    .${LIBC_TARGET_OS}.nanosleep
169)
170
171add_entrypoint_object(
172  clock_gettime
173  ALIAS
174  DEPENDS
175    .${LIBC_TARGET_OS}.clock_gettime
176)
177
178add_entrypoint_object(
179  gettimeofday
180  ALIAS
181  DEPENDS
182    .${LIBC_TARGET_OS}.gettimeofday
183)
184
185add_entrypoint_object(
186  clock_getres
187  ALIAS
188  DEPENDS
189    .${LIBC_TARGET_OS}.clock_getres
190)
191