1licenses(["notice"])  # 3-Clause BSD
2
3load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
4
5config_setting(
6    name = "build_with_mkl",
7    define_values = {
8        "build_with_mkl": "true",
9    },
10    visibility = ["//visibility:public"],
11)
12
13config_setting(
14    name = "build_with_mkl_lnx_x64",
15    define_values = {
16        "build_with_mkl": "true",
17    },
18    values = {
19        "cpu": "k8",
20    },
21    visibility = ["//visibility:public"],
22)
23
24config_setting(
25    name = "build_with_mkl_lnx_openmp",
26    constraint_values = [
27        "@platforms//os:linux",
28    ],
29    define_values = {
30        "build_with_mkl": "true",
31        "build_with_openmp": "true",
32    },
33    visibility = ["//visibility:public"],
34)
35
36config_setting(
37    name = "build_with_mkl_windows_openmp",
38    constraint_values = [
39        "@platforms//os:windows",
40    ],
41    define_values = {
42        "build_with_mkl": "true",
43        "build_with_openmp": "true",
44    },
45    visibility = ["//visibility:public"],
46)
47
48config_setting(
49    name = "build_with_mkl_aarch64",
50    define_values = {
51        "build_with_mkl_aarch64": "true",
52    },
53    visibility = ["//visibility:public"],
54)
55
56config_setting(
57    name = "enable_mkl",
58    define_values = {
59        "enable_mkl": "true",
60        "build_with_mkl": "true",
61    },
62    visibility = ["//visibility:public"],
63)
64
65filegroup(
66    name = "LICENSE",
67    srcs = [
68        "MKL_LICENSE",
69        "@llvm_openmp//:LICENSE.txt",
70    ],
71    visibility = ["//visibility:public"],
72)
73
74# TODO(Intel-tf) Remove the following 3 calls to cc_library and replace all uses
75# of mkl_libs_* with @llvm_openmp//:libiomp5.* directly.
76
77cc_library(
78    name = "mkl_libs_linux",
79    srcs = [
80        "@llvm_openmp//:libiomp5.so",
81    ],
82    visibility = ["//visibility:public"],
83)
84
85# MacOS build configuration is provided for completness, it has not been tested
86cc_library(
87    name = "mkl_libs_darwin",
88    srcs = [
89        "@llvm_openmp//:libiomp5.dylib",
90    ],
91    visibility = ["//visibility:public"],
92)
93
94cc_library(
95    name = "mkl_libs_windows",
96    srcs = [
97        "@llvm_openmp//:libiomp5md.dll",
98    ],
99    visibility = ["//visibility:public"],
100)
101
102cc_library(
103    name = "intel_binary_blob",
104    visibility = ["//visibility:public"],
105    deps = select({
106        "@org_tensorflow//tensorflow:linux_x86_64": [
107            ":mkl_libs_linux",
108        ],
109        "@org_tensorflow//tensorflow:macos": [
110            ":mkl_libs_darwin",
111        ],
112        "@org_tensorflow//tensorflow:windows": [
113            ":mkl_libs_windows",
114        ],
115        "//conditions:default": [],
116    }),
117)
118
119bzl_library(
120    name = "build_defs_bzl",
121    srcs = ["build_defs.bzl"],
122    visibility = ["//visibility:public"],
123)
124