xref: /aosp_15_r20/external/tensorflow/third_party/eigen3/eigen_archive.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 used for the @eigen_archive external repository.
5
6licenses([
7    # Note: Although Eigen also includes GPL V3 and LGPL v2.1+ code, TensorFlow
8    #       has taken special care to not reference any restricted code.
9    "reciprocal",  # MPL2
10    "notice",  # Portions BSD
11])
12
13exports_files(["COPYING.MPL2"])
14
15ALL_FILES_WITH_EXTENSIONS = glob(["**/*.*"])
16
17# Top-level headers, excluding anything in one of the  ../src/.. directories.
18EIGEN_HEADERS = glob(
19    [
20        "Eigen/*",
21        "unsupported/Eigen/*",
22        "unsupported/Eigen/CXX11/*",
23    ],
24    exclude = [
25        "**/src/**",
26    ] + ALL_FILES_WITH_EXTENSIONS,
27)
28
29# Internal eigen headers, known to be under an MPL2 license.
30EIGEN_MPL2_SOURCES = glob(
31    [
32        "Eigen/**/src/**/*.h",
33        "Eigen/**/src/**/*.inc",
34        "unsupported/Eigen/**/src/**/*.h",
35        "unsupported/Eigen/**/src/**/*.inc",
36    ],
37    exclude = [
38        # This guarantees that any file depending on non MPL2 licensed code
39        # will not compile.
40        "Eigen/src/Core/util/NonMPL2.h",
41    ],
42)
43
44cc_library(
45    name = "eigen3",
46    srcs = EIGEN_MPL2_SOURCES,
47    hdrs = EIGEN_HEADERS,
48    defines = [
49        # This define (mostly) guarantees we don't link any problematic
50        # code. We use it, but we do not rely on it, as evidenced above.
51        "EIGEN_MPL2_ONLY",
52        "EIGEN_MAX_ALIGN_BYTES=64",
53    ],
54    includes = ["."],
55    visibility = ["//visibility:public"],
56)
57
58filegroup(
59    name = "eigen_header_files",
60    srcs = EIGEN_HEADERS,
61    visibility = ["//visibility:public"],
62)
63
64filegroup(
65    name = "eigen_source_files",
66    srcs = EIGEN_MPL2_SOURCES,
67    visibility = ["//visibility:public"],
68)
69