xref: /oneTBB/BUILD.bazel (revision e6104c95)
1c21e688aSSergey Zheltov# Copyright (c) 2021-2022 Intel Corporation
261640445SVertexwahn#
361640445SVertexwahn# Licensed under the Apache License, Version 2.0 (the "License");
461640445SVertexwahn# you may not use this file except in compliance with the License.
561640445SVertexwahn# You may obtain a copy of the License at
661640445SVertexwahn#
761640445SVertexwahn#     http://www.apache.org/licenses/LICENSE-2.0
861640445SVertexwahn#
961640445SVertexwahn# Unless required by applicable law or agreed to in writing, software
1061640445SVertexwahn# distributed under the License is distributed on an "AS IS" BASIS,
1161640445SVertexwahn# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1261640445SVertexwahn# See the License for the specific language governing permissions and
1361640445SVertexwahn# limitations under the License.
1461640445SVertexwahn
1561640445SVertexwahn# DISCLAIMER: Bazel support is community-based. The maintainers do not
1661640445SVertexwahn# use Bazel internally. The Bazel build can have security risks or
1761640445SVertexwahn# optimization gaps.
1861640445SVertexwahn
1961640445SVertexwahnpackage(
2061640445SVertexwahn    default_visibility = ["//visibility:public"],
2161640445SVertexwahn)
2261640445SVertexwahn
2361640445SVertexwahncc_library(
2461640445SVertexwahn    name = "tbb",
2561640445SVertexwahn    srcs = glob([
2661640445SVertexwahn        "src/tbb/*.cpp",
2761640445SVertexwahn        "src/tbb/*.h",
2861640445SVertexwahn    ]) + select({
2961640445SVertexwahn        "@platforms//cpu:x86_64": glob(["src/tbb/tools_api/**/*.h"]),
3061640445SVertexwahn        "//conditions:default": [],
3161640445SVertexwahn    }),
3261640445SVertexwahn    hdrs = glob([
3361640445SVertexwahn        "include/tbb/*.h",
3461640445SVertexwahn        "include/oneapi/*.h",
3561640445SVertexwahn        "include/oneapi/tbb/*.h",
3661640445SVertexwahn        "include/oneapi/tbb/detail/*.h",
3761640445SVertexwahn    ]),
3801a68ed7SVertexwahn    copts = ["-w"] + select({
39*e6104c95SVertexwahn        "@platforms//os:windows": [""],
4001a68ed7SVertexwahn        "//conditions:default": ["-mwaitpkg"],
4101a68ed7SVertexwahn    }),
4261640445SVertexwahn    defines =
4361640445SVertexwahn        select({
4461640445SVertexwahn            "@platforms//cpu:x86_64": ["__TBB_NO_IMPLICIT_LINKAGE"],
4561640445SVertexwahn            "//conditions:default": [
4661640445SVertexwahn                "USE_PTHREAD",
4761640445SVertexwahn            ],
483c76824aSVertexwahn        }) +
493c76824aSVertexwahn        select({
50*e6104c95SVertexwahn            "@platforms//os:osx": ["_XOPEN_SOURCE"],
513c76824aSVertexwahn            "//conditions:default": [],
5261640445SVertexwahn        }),
5361640445SVertexwahn    includes = [
5461640445SVertexwahn        "include",
5561640445SVertexwahn    ],
5661640445SVertexwahn    linkopts =
5761640445SVertexwahn        select({
58*e6104c95SVertexwahn            "@platforms//os:windows": [],
59*e6104c95SVertexwahn            "@platforms//os:linux": [
6061640445SVertexwahn                "-ldl",
6161640445SVertexwahn                "-pthread",
6261640445SVertexwahn                "-lrt",
6361640445SVertexwahn            ],
643c76824aSVertexwahn            "//conditions:default": ["-pthread"],
6561640445SVertexwahn        }),
6661640445SVertexwahn    local_defines = select({
6761640445SVertexwahn        "@platforms//cpu:x86_64": [
6861640445SVertexwahn            "__TBB_USE_ITT_NOTIFY",
6961640445SVertexwahn        ],
7061640445SVertexwahn        "//conditions:default": [],
7161640445SVertexwahn    }) + [
7261640445SVertexwahn        "__TBB_BUILD",
7361640445SVertexwahn    ],
7461640445SVertexwahn    textual_hdrs = select({
7561640445SVertexwahn        "@platforms//cpu:x86_64": [
7661640445SVertexwahn            "src/tbb/tools_api/ittnotify_static.c",
7761640445SVertexwahn        ],
7861640445SVertexwahn        "//conditions:default": [],
7961640445SVertexwahn    }),
8061640445SVertexwahn)
8161640445SVertexwahn
8261640445SVertexwahncc_library(
8361640445SVertexwahn    name = "tbbmalloc",
8461640445SVertexwahn    srcs =
8561640445SVertexwahn        glob([
8661640445SVertexwahn            "src/tbbmalloc/*.h",
8761640445SVertexwahn            "src/tbb/*.h",
8861640445SVertexwahn            "src/tbbmalloc_proxy/*.h",
8961640445SVertexwahn        ]) + [
9061640445SVertexwahn            "src/tbbmalloc/backend.cpp",
9161640445SVertexwahn            "src/tbbmalloc/backref.cpp",
9261640445SVertexwahn            "src/tbbmalloc/frontend.cpp",
9361640445SVertexwahn            "src/tbbmalloc/large_objects.cpp",
9461640445SVertexwahn            "src/tbbmalloc/tbbmalloc.cpp",
9561640445SVertexwahn        ],
9661640445SVertexwahn    hdrs = glob([
9761640445SVertexwahn        "include/tbb/*.h",
9861640445SVertexwahn        "include/oneapi/tbb/detail/*.h",
9961640445SVertexwahn        "include/oneapi/tbb/*.h",
10061640445SVertexwahn    ]),
10161640445SVertexwahn    includes = [
10261640445SVertexwahn        "include",
10361640445SVertexwahn    ],
10461640445SVertexwahn    local_defines = [
10561640445SVertexwahn        "__TBBMALLOC_BUILD",
10661640445SVertexwahn    ],
10761640445SVertexwahn)
10861640445SVertexwahn
10961640445SVertexwahncc_library(
11061640445SVertexwahn    name = "tbbmalloc_proxy",
11161640445SVertexwahn    srcs = [
11261640445SVertexwahn        "src/tbbmalloc_proxy/function_replacement.cpp",
11361640445SVertexwahn        "src/tbbmalloc_proxy/proxy.cpp",
11461640445SVertexwahn    ],
11561640445SVertexwahn    deps = [
11661640445SVertexwahn        ":tbbmalloc",
11761640445SVertexwahn    ],
11861640445SVertexwahn)
119