|
| 1 | +# Copyright (c) 2021-2025 Intel Corporation |
| 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 | +# http://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 | +# DISCLAIMER: Bazel support is community-based. The maintainers do not |
| 16 | +# use Bazel internally. The Bazel build can have security risks or |
| 17 | +# optimization gaps. |
| 18 | + |
| 19 | +load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test") |
| 20 | +load("@rules_license//rules:license.bzl", "license") |
| 21 | + |
| 22 | +package( |
| 23 | + default_applicable_licenses = [":license"], |
| 24 | +) |
| 25 | + |
| 26 | +exports_files([ |
| 27 | + "LICENSE", |
| 28 | +]) |
| 29 | + |
| 30 | +license( |
| 31 | + name = "license", |
| 32 | + license_kinds = ["@rules_license//licenses/spdx:Apache-2.0"], |
| 33 | + license_text = "LICENSE.txt", |
| 34 | +) |
| 35 | + |
| 36 | +config_setting( |
| 37 | + name = "macos_x86_64", |
| 38 | + constraint_values = [ |
| 39 | + "@platforms//os:osx", |
| 40 | + "@platforms//cpu:x86_64", |
| 41 | + ], |
| 42 | +) |
| 43 | + |
| 44 | +config_setting( |
| 45 | + name = "macos_arm64", |
| 46 | + constraint_values = [ |
| 47 | + "@platforms//os:osx", |
| 48 | + "@platforms//cpu:arm64", |
| 49 | + ], |
| 50 | +) |
| 51 | + |
| 52 | +cc_library( |
| 53 | + name = "tbb", |
| 54 | + srcs = [ |
| 55 | + "src/tbb/address_waiter.cpp", |
| 56 | + "src/tbb/allocator.cpp", |
| 57 | + "src/tbb/arena.cpp", |
| 58 | + "src/tbb/arena_slot.cpp", |
| 59 | + "src/tbb/concurrent_bounded_queue.cpp", |
| 60 | + "src/tbb/dynamic_link.cpp", |
| 61 | + "src/tbb/exception.cpp", |
| 62 | + "src/tbb/global_control.cpp", |
| 63 | + "src/tbb/governor.cpp", |
| 64 | + "src/tbb/itt_notify.cpp", |
| 65 | + "src/tbb/main.cpp", |
| 66 | + "src/tbb/market.cpp", |
| 67 | + "src/tbb/misc.cpp", |
| 68 | + "src/tbb/misc_ex.cpp", |
| 69 | + "src/tbb/observer_proxy.cpp", |
| 70 | + "src/tbb/parallel_pipeline.cpp", |
| 71 | + "src/tbb/private_server.cpp", |
| 72 | + "src/tbb/profiling.cpp", |
| 73 | + "src/tbb/queuing_rw_mutex.cpp", |
| 74 | + "src/tbb/rml_tbb.cpp", |
| 75 | + "src/tbb/rtm_mutex.cpp", |
| 76 | + "src/tbb/rtm_rw_mutex.cpp", |
| 77 | + "src/tbb/semaphore.cpp", |
| 78 | + "src/tbb/small_object_pool.cpp", |
| 79 | + "src/tbb/task.cpp", |
| 80 | + "src/tbb/task_dispatcher.cpp", |
| 81 | + "src/tbb/task_group_context.cpp", |
| 82 | + "src/tbb/tcm_adaptor.cpp", |
| 83 | + "src/tbb/thread_dispatcher.cpp", |
| 84 | + "src/tbb/thread_request_serializer.cpp", |
| 85 | + "src/tbb/threading_control.cpp", |
| 86 | + "src/tbb/version.cpp", |
| 87 | + ] + glob(["src/tbb/*.h"]), |
| 88 | + hdrs = glob([ |
| 89 | + "include/tbb/*.h", |
| 90 | + "include/oneapi/*.h", |
| 91 | + "include/oneapi/tbb/*.h", |
| 92 | + "include/oneapi/tbb/detail/*.h", |
| 93 | + ]), |
| 94 | + copts = select({ |
| 95 | + ":macos_x86_64": ["-mwaitpkg"], |
| 96 | + ":macos_arm64": [], |
| 97 | + "//conditions:default": [], |
| 98 | + }), |
| 99 | + defines = [ |
| 100 | + "__TBB_DYNAMIC_LOAD_ENABLED=0", |
| 101 | + "__TBB_SOURCE_DIRECTLY_INCLUDED=1", |
| 102 | + "__TBB_SKIP_DEPENDENCY_SIGNATURE_VERIFICATION=1", |
| 103 | + "__TBB_BUILD", |
| 104 | + #"__TBB_USE_ITT_NOTIFY", |
| 105 | + ] + select({ |
| 106 | + "@platforms//os:osx": ["_XOPEN_SOURCE"], |
| 107 | + "//conditions:default": [], |
| 108 | + }), |
| 109 | + includes = [ |
| 110 | + "include", |
| 111 | + ], |
| 112 | + visibility = ["//visibility:public"], |
| 113 | +) |
| 114 | + |
| 115 | +cc_library( |
| 116 | + name = "tbbmalloc", |
| 117 | + srcs = |
| 118 | + glob([ |
| 119 | + "src/tbbmalloc/*.h", |
| 120 | + "src/tbb/*.h", |
| 121 | + "src/tbbmalloc_proxy/*.h", |
| 122 | + ]) + [ |
| 123 | + "src/tbbmalloc/backend.cpp", |
| 124 | + "src/tbbmalloc/backref.cpp", |
| 125 | + "src/tbbmalloc/frontend.cpp", |
| 126 | + "src/tbbmalloc/large_objects.cpp", |
| 127 | + "src/tbbmalloc/tbbmalloc.cpp", |
| 128 | + ], |
| 129 | + hdrs = glob([ |
| 130 | + "include/tbb/*.h", |
| 131 | + "include/oneapi/tbb/detail/*.h", |
| 132 | + "include/oneapi/tbb/*.h", |
| 133 | + ]), |
| 134 | + includes = [ |
| 135 | + "include", |
| 136 | + ], |
| 137 | + local_defines = [ |
| 138 | + "__TBBMALLOC_BUILD", |
| 139 | + ], |
| 140 | + visibility = ["//visibility:public"], |
| 141 | +) |
| 142 | + |
| 143 | +cc_library( |
| 144 | + name = "tbbmalloc_proxy", |
| 145 | + srcs = [ |
| 146 | + "src/tbbmalloc_proxy/function_replacement.cpp", |
| 147 | + "src/tbbmalloc_proxy/proxy.cpp", |
| 148 | + ], |
| 149 | + visibility = ["//visibility:public"], |
| 150 | + deps = [ |
| 151 | + ":tbbmalloc", |
| 152 | + ], |
| 153 | +) |
| 154 | + |
| 155 | +cc_test( |
| 156 | + name = "test_mutex", |
| 157 | + srcs = [ |
| 158 | + "test/tbb/test_mutex.cpp", |
| 159 | + "test/tbb/test_mutex.h", |
| 160 | + ] + glob([ |
| 161 | + "test/common/*.h", |
| 162 | + ]), |
| 163 | + includes = ["test"], |
| 164 | + deps = [ |
| 165 | + ":tbb", |
| 166 | + ], |
| 167 | +) |
| 168 | + |
| 169 | +cc_test( |
| 170 | + name = "test_blocked_range", |
| 171 | + srcs = [ |
| 172 | + "test/tbb/test_blocked_range.cpp", |
| 173 | + ] + glob([ |
| 174 | + "test/common/*.h", |
| 175 | + ]), |
| 176 | + includes = ["test"], |
| 177 | + deps = [ |
| 178 | + ":tbb", |
| 179 | + ], |
| 180 | +) |
| 181 | + |
| 182 | +cc_test( |
| 183 | + name = "test_parallel_for", |
| 184 | + srcs = [ |
| 185 | + "test/tbb/test_parallel_for.cpp", |
| 186 | + "test/tbb/test_partitioner.h", |
| 187 | + ] + glob([ |
| 188 | + "test/common/*.h", |
| 189 | + ]), |
| 190 | + includes = ["test"], |
| 191 | + deps = [ |
| 192 | + ":tbb", |
| 193 | + ], |
| 194 | +) |
| 195 | + |
| 196 | +cc_test( |
| 197 | + name = "test_parallel_reduce", |
| 198 | + srcs = [ |
| 199 | + "test/tbb/test_parallel_reduce.cpp", |
| 200 | + ] + glob([ |
| 201 | + "test/common/*.h", |
| 202 | + ]), |
| 203 | + includes = ["test"], |
| 204 | + deps = [ |
| 205 | + ":tbb", |
| 206 | + ], |
| 207 | +) |
| 208 | + |
| 209 | +cc_test( |
| 210 | + name = "test_parallel_for_each", |
| 211 | + srcs = [ |
| 212 | + "test/tbb/test_mutex.h", |
| 213 | + "test/tbb/test_parallel_for_each.cpp", |
| 214 | + ] + glob([ |
| 215 | + "test/common/*.h", |
| 216 | + ]), |
| 217 | + includes = [ |
| 218 | + "test", |
| 219 | + "test/tbb", |
| 220 | + ], |
| 221 | + deps = [ |
| 222 | + ":tbb", |
| 223 | + ], |
| 224 | +) |
| 225 | + |
| 226 | +cc_test( |
| 227 | + name = "test_adaptive_mutex", |
| 228 | + srcs = [ |
| 229 | + "test/conformance/conformance_mutex.h", |
| 230 | + "test/tbb/test_adaptive_mutex.cpp", |
| 231 | + "test/tbb/test_mutex.h", |
| 232 | + ] + glob([ |
| 233 | + "test/common/*.h", |
| 234 | + ]), |
| 235 | + includes = [ |
| 236 | + "test", |
| 237 | + "test/tbb", |
| 238 | + ], |
| 239 | + deps = [ |
| 240 | + ":tbb", |
| 241 | + ], |
| 242 | +) |
| 243 | + |
| 244 | +cc_test( |
| 245 | + name = "test_task", |
| 246 | + srcs = [ |
| 247 | + "test/tbb/test_task.cpp", |
| 248 | + ] + glob([ |
| 249 | + "test/common/*.h", |
| 250 | + ]), |
| 251 | + includes = ["test"], |
| 252 | + deps = [ |
| 253 | + ":tbb", |
| 254 | + ], |
| 255 | +) |
| 256 | + |
| 257 | +#cc_test( |
| 258 | +# name = "conformance_parallel_sort", |
| 259 | +# srcs = [ |
| 260 | +# "test/conformance/conformance_parallel_sort.cpp", |
| 261 | +# ] + glob([ |
| 262 | +# "test/common/*.h", |
| 263 | +# ]), |
| 264 | +# includes = ["test"], |
| 265 | +# deps = [ |
| 266 | +# ":tbb", |
| 267 | +# ], |
| 268 | +#) |
| 269 | + |
| 270 | +cc_test( |
| 271 | + name = "conformance_task_group", |
| 272 | + srcs = [ |
| 273 | + "test/conformance/conformance_task_group.cpp", |
| 274 | + ] + glob([ |
| 275 | + "test/common/*.h", |
| 276 | + ]), |
| 277 | + includes = ["test"], |
| 278 | + deps = [ |
| 279 | + ":tbb", |
| 280 | + ], |
| 281 | +) |
| 282 | + |
| 283 | +alias( |
| 284 | + name = "onetbb", |
| 285 | + actual = ":tbb", |
| 286 | + visibility = ["//visibility:public"], |
| 287 | +) |
0 commit comments