| 1 |
# Copyright 2016 Google Inc. All Rights Reserved. |
| 2 |
# |
| 3 |
# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 |
# you may not use this file except in compliance with the License. |
| 5 |
# You may obtain a copy of the License at |
| 6 |
# |
| 7 |
# https://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
# |
| 9 |
# Unless required by applicable law or agreed to in writing, software |
| 10 |
# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 |
# See the License for the specific language governing permissions and |
| 13 |
# limitations under the License. |
| 14 |
|
| 15 |
package( |
| 16 |
features = [ |
| 17 |
"header_modules", |
| 18 |
"layering_check", |
| 19 |
"parse_headers", |
| 20 |
], |
| 21 |
) |
| 22 |
|
| 23 |
licenses(["notice"]) |
| 24 |
|
| 25 |
### libraries |
| 26 |
|
| 27 |
cc_library( |
| 28 |
name = "civil_time", |
| 29 |
srcs = ["src/civil_time_detail.cc"], |
| 30 |
hdrs = [ |
| 31 |
"include/cctz/civil_time.h", |
| 32 |
], |
| 33 |
includes = ["include"], |
| 34 |
textual_hdrs = ["include/cctz/civil_time_detail.h"], |
| 35 |
visibility = ["//visibility:public"], |
| 36 |
) |
| 37 |
|
| 38 |
cc_library( |
| 39 |
name = "time_zone", |
| 40 |
srcs = [ |
| 41 |
"src/time_zone_fixed.cc", |
| 42 |
"src/time_zone_fixed.h", |
| 43 |
"src/time_zone_format.cc", |
| 44 |
"src/time_zone_if.cc", |
| 45 |
"src/time_zone_if.h", |
| 46 |
"src/time_zone_impl.cc", |
| 47 |
"src/time_zone_impl.h", |
| 48 |
"src/time_zone_info.cc", |
| 49 |
"src/time_zone_info.h", |
| 50 |
"src/time_zone_libc.cc", |
| 51 |
"src/time_zone_libc.h", |
| 52 |
"src/time_zone_lookup.cc", |
| 53 |
"src/time_zone_posix.cc", |
| 54 |
"src/time_zone_posix.h", |
| 55 |
"src/tzfile.h", |
| 56 |
"src/zone_info_source.cc", |
| 57 |
], |
| 58 |
hdrs = [ |
| 59 |
"include/cctz/time_zone.h", |
| 60 |
"include/cctz/zone_info_source.h", |
| 61 |
], |
| 62 |
includes = ["include"], |
| 63 |
linkopts = select({ |
| 64 |
"@platforms//os:osx": ["-Wl,-framework,CoreFoundation"], |
| 65 |
"@platforms//os:ios": ["-Wl,-framework,CoreFoundation"], |
| 66 |
"//conditions:default": [], |
| 67 |
}), |
| 68 |
visibility = ["//visibility:public"], |
| 69 |
deps = [":civil_time"], |
| 70 |
) |
| 71 |
|
| 72 |
### tests |
| 73 |
|
| 74 |
test_suite( |
| 75 |
name = "all_tests", |
| 76 |
visibility = ["//visibility:public"], |
| 77 |
) |
| 78 |
|
| 79 |
cc_test( |
| 80 |
name = "civil_time_test", |
| 81 |
size = "small", |
| 82 |
srcs = ["src/civil_time_test.cc"], |
| 83 |
deps = [ |
| 84 |
":civil_time", |
| 85 |
"@com_google_googletest//:gtest", |
| 86 |
"@com_google_googletest//:gtest_main", |
| 87 |
], |
| 88 |
) |
| 89 |
|
| 90 |
cc_test( |
| 91 |
name = "time_zone_format_test", |
| 92 |
size = "small", |
| 93 |
srcs = ["src/time_zone_format_test.cc"], |
| 94 |
deps = [ |
| 95 |
":civil_time", |
| 96 |
":time_zone", |
| 97 |
"@com_google_googletest//:gtest", |
| 98 |
"@com_google_googletest//:gtest_main", |
| 99 |
], |
| 100 |
) |
| 101 |
|
| 102 |
cc_test( |
| 103 |
name = "time_zone_lookup_test", |
| 104 |
size = "small", |
| 105 |
srcs = ["src/time_zone_lookup_test.cc"], |
| 106 |
deps = [ |
| 107 |
":civil_time", |
| 108 |
":time_zone", |
| 109 |
"@com_google_googletest//:gtest", |
| 110 |
"@com_google_googletest//:gtest_main", |
| 111 |
], |
| 112 |
) |
| 113 |
|
| 114 |
### benchmarks |
| 115 |
|
| 116 |
cc_test( |
| 117 |
name = "cctz_benchmark", |
| 118 |
srcs = [ |
| 119 |
"src/cctz_benchmark.cc", |
| 120 |
"src/time_zone_if.h", |
| 121 |
"src/time_zone_impl.h", |
| 122 |
"src/time_zone_info.h", |
| 123 |
"src/tzfile.h", |
| 124 |
], |
| 125 |
linkstatic = 1, |
| 126 |
tags = ["benchmark"], |
| 127 |
deps = [ |
| 128 |
":civil_time", |
| 129 |
":time_zone", |
| 130 |
"@com_github_google_benchmark//:benchmark_main", |
| 131 |
], |
| 132 |
) |
| 133 |
|
| 134 |
### examples |
| 135 |
|
| 136 |
cc_binary( |
| 137 |
name = "classic", |
| 138 |
srcs = ["examples/classic.cc"], |
| 139 |
) |
| 140 |
|
| 141 |
cc_binary( |
| 142 |
name = "epoch_shift", |
| 143 |
srcs = ["examples/epoch_shift.cc"], |
| 144 |
) |
| 145 |
|
| 146 |
cc_binary( |
| 147 |
name = "example1", |
| 148 |
srcs = ["examples/example1.cc"], |
| 149 |
deps = [ |
| 150 |
":civil_time", |
| 151 |
":time_zone", |
| 152 |
], |
| 153 |
) |
| 154 |
|
| 155 |
cc_binary( |
| 156 |
name = "example2", |
| 157 |
srcs = ["examples/example2.cc"], |
| 158 |
deps = [":time_zone"], |
| 159 |
) |
| 160 |
|
| 161 |
cc_binary( |
| 162 |
name = "example3", |
| 163 |
srcs = ["examples/example3.cc"], |
| 164 |
deps = [ |
| 165 |
":civil_time", |
| 166 |
":time_zone", |
| 167 |
], |
| 168 |
) |
| 169 |
|
| 170 |
cc_binary( |
| 171 |
name = "example4", |
| 172 |
srcs = ["examples/example4.cc"], |
| 173 |
deps = [ |
| 174 |
":civil_time", |
| 175 |
":time_zone", |
| 176 |
], |
| 177 |
) |
| 178 |
|
| 179 |
cc_binary( |
| 180 |
name = "hello", |
| 181 |
srcs = ["examples/hello.cc"], |
| 182 |
deps = [ |
| 183 |
":civil_time", |
| 184 |
":time_zone", |
| 185 |
], |
| 186 |
) |
| 187 |
|
| 188 |
### binaries |
| 189 |
|
| 190 |
cc_binary( |
| 191 |
name = "time_tool", |
| 192 |
srcs = [ |
| 193 |
"src/time_tool.cc", |
| 194 |
"src/time_zone_if.h", |
| 195 |
"src/time_zone_impl.h", |
| 196 |
"src/time_zone_info.h", |
| 197 |
"src/tzfile.h", |
| 198 |
], |
| 199 |
deps = [ |
| 200 |
":civil_time", |
| 201 |
":time_zone", |
| 202 |
], |
| 203 |
) |