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
17absl_cc_library(
18  NAME
19    time
20  HDRS
21    "civil_time.h"
22    "clock.h"
23    "time.h"
24  SRCS
25    "civil_time.cc"
26    "clock.cc"
27    "duration.cc"
28    "format.cc"
29    "internal/get_current_time_chrono.inc"
30    "internal/get_current_time_posix.inc"
31    "time.cc"
32  COPTS
33    ${ABSL_DEFAULT_COPTS}
34  DEPS
35    absl::base
36    absl::civil_time
37    absl::core_headers
38    absl::int128
39    absl::raw_logging_internal
40    absl::strings
41    absl::time_zone
42  PUBLIC
43)
44
45absl_cc_library(
46  NAME
47    civil_time
48  HDRS
49    "internal/cctz/include/cctz/civil_time.h"
50    "internal/cctz/include/cctz/civil_time_detail.h"
51  SRCS
52  "internal/cctz/src/civil_time_detail.cc"
53  COPTS
54    ${ABSL_DEFAULT_COPTS}
55)
56
57if(APPLE)
58  find_library(CoreFoundation CoreFoundation)
59endif()
60
61absl_cc_library(
62  NAME
63    time_zone
64  HDRS
65    "internal/cctz/include/cctz/time_zone.h"
66    "internal/cctz/include/cctz/zone_info_source.h"
67  SRCS
68    "internal/cctz/src/time_zone_fixed.cc"
69    "internal/cctz/src/time_zone_fixed.h"
70    "internal/cctz/src/time_zone_format.cc"
71    "internal/cctz/src/time_zone_if.cc"
72    "internal/cctz/src/time_zone_if.h"
73    "internal/cctz/src/time_zone_impl.cc"
74    "internal/cctz/src/time_zone_impl.h"
75    "internal/cctz/src/time_zone_info.cc"
76    "internal/cctz/src/time_zone_info.h"
77    "internal/cctz/src/time_zone_libc.cc"
78    "internal/cctz/src/time_zone_libc.h"
79    "internal/cctz/src/time_zone_lookup.cc"
80    "internal/cctz/src/time_zone_posix.cc"
81    "internal/cctz/src/time_zone_posix.h"
82    "internal/cctz/src/tzfile.h"
83    "internal/cctz/src/zone_info_source.cc"
84  COPTS
85    ${ABSL_DEFAULT_COPTS}
86  DEPS
87    $<$<PLATFORM_ID:Darwin>:${CoreFoundation}>
88)
89
90# Internal-only target, do not depend on directly.
91absl_cc_library(
92  NAME
93    time_internal_test_util
94  HDRS
95    "internal/test_util.h"
96  SRCS
97    "internal/test_util.cc"
98  COPTS
99    ${ABSL_DEFAULT_COPTS}
100  DEPS
101    absl::time
102    absl::config
103    absl::raw_logging_internal
104    absl::time_zone
105  TESTONLY
106)
107
108absl_cc_test(
109  NAME
110    time_test
111  SRCS
112    "civil_time_test.cc"
113    "clock_test.cc"
114    "duration_test.cc"
115    "format_test.cc"
116    "time_test.cc"
117    "time_zone_test.cc"
118  COPTS
119    ${ABSL_TEST_COPTS}
120  DEPS
121    absl::time_internal_test_util
122    absl::time
123    absl::config
124    absl::core_headers
125    absl::time_zone
126    GTest::gmock_main
127)
128
129absl_cc_test(
130  NAME
131    flag_test
132  SRCS
133    "flag_test.cc"
134  COPTS
135    ${ABSL_TEST_COPTS}
136  DEPS
137    absl::flags
138    absl::flags_reflection
139    GTest::gmock_main
140)
141