• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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        "unsupported/Eigen/**/src/**/*.h",
34    ],
35    exclude = [
36        # This guarantees that any file depending on non MPL2 licensed code
37        # will not compile.
38        "Eigen/src/Core/util/NonMPL2.h",
39    ],
40)
41
42cc_library(
43    name = "eigen3",
44    srcs = EIGEN_MPL2_SOURCES,
45    hdrs = EIGEN_HEADERS,
46    defines = [
47        # This define (mostly) guarantees we don't link any problematic
48        # code. We use it, but we do not rely on it, as evidenced above.
49        "EIGEN_MPL2_ONLY",
50        "EIGEN_MAX_ALIGN_BYTES=64",
51    ],
52    includes = ["."],
53    visibility = ["//visibility:public"],
54)
55
56filegroup(
57    name = "eigen_header_files",
58    srcs = EIGEN_HEADERS,
59    visibility = ["//visibility:public"],
60)
61
62filegroup(
63    name = "eigen_source_files",
64    srcs = EIGEN_MPL2_SOURCES,
65    visibility = ["//visibility:public"],
66)
67