xref: /aosp_15_r20/external/tensorflow/third_party/eigen3/BUILD (revision b6fb3261f9314811a0f4371741dbb8839866f948)
1# Description:
2#   Eigen is a C++ template library for linear algebra: vectors,
3#   matrices, and related algorithms.
4# This is the BUILD file with extra code to patch into @eigen_archive.
5
6load("//third_party/mkl:build_defs.bzl", "if_mkl")
7
8licenses([
9    # Note: Eigen is an MPL2 library that includes GPL v3 and LGPL v2.1+ code.
10    #       We've taken special care to not reference any restricted code.
11    "reciprocal",  # MPL2
12    "notice",  # Portions BSD
13])
14
15exports_files(["LICENSE"])
16
17EIGEN3_THIRD_PARTY_HEADERS = [
18    "Eigen/Core",
19    "Eigen/LU",
20    "Eigen/Cholesky",
21    "Eigen/Eigenvalues",
22    "Eigen/OrderingMethods",
23    "Eigen/QR",
24    "Eigen/SparseCholesky",
25    "Eigen/SparseCore",
26    "Eigen/SVD",
27    "unsupported/Eigen/MatrixFunctions",
28    "unsupported/Eigen/SpecialFunctions",
29    "unsupported/Eigen/CXX11/ThreadPool",
30    "unsupported/Eigen/CXX11/Tensor",
31    "unsupported/Eigen/CXX11/FixedPoint",
32] + glob(["unsupported/Eigen/CXX11/src/FixedPoint/*.h"])
33
34cc_library(
35    name = "eigen3",
36    hdrs = EIGEN3_THIRD_PARTY_HEADERS,
37    includes = if_mkl(["./mkl_include"]),
38    visibility = ["//visibility:public"],
39    deps = [
40        "@eigen_archive//:eigen3",
41    ],
42)
43
44filegroup(
45    name = "all_files",
46    srcs = glob(
47        ["**/*"],
48        exclude = ["**/OWNERS"],
49    ),
50    visibility = ["//tensorflow:__subpackages__"],
51)
52
53filegroup(
54    name = "eigen_third_party_header_files",
55    srcs = EIGEN3_THIRD_PARTY_HEADERS,
56    visibility = ["//visibility:public"],
57)
58
59genrule(
60    name = "install_eigen_headers",
61    srcs = [
62        "@eigen_archive//:eigen_header_files",
63        "@eigen_archive//:eigen_source_files",
64        ":eigen_third_party_header_files",
65    ],
66    outs = ["include"],
67    cmd = """
68    mkdir $@
69    for f in $(SRCS); do
70      d="$${f%/*}"
71      d="$${d#*external/eigen_archive/}"
72
73      mkdir -p "$@/$${d}"
74      cp "$${f}" "$@/$${d}/"
75    done
76    """,
77    tags = ["manual"],
78)
79