STT-tensorflow/eigen.BUILD
Justine Tunney 65038b0840 Optimize Bazel external dependencies
This change does the following:

- Always use {,new_}http_archive rather than git_repository
- Make liberal use of strip_prefix
- Clarify licenses() in BUILD files
- On POSIX include headers like a normal C/C++ program

This change accomplishes the following:

- Reduce download size >100MB: The biggest culprit is grpc which has
  tens of thousands of commits in its GitHub repository.

- Reduce disk size >200MB: On disk, grpc takes up 250MB when cloned even
  though the tarball of the git repo is 3.2MB. By never using git
  externals, we save on network.

- Consume less cpu: Cloning git repositories is much slower than
  downloading and extracting a tarball.
Change: 133895791
2016-09-21 17:16:04 -07:00

71 lines
2.1 KiB
Plaintext

# Description:
# Eigen is a C++ template library for linear algebra: vectors,
# matrices, and related algorithms.
licenses([
# Note: Eigen is an MPL2 library that includes GPL v3 and LGPL v2.1+ code.
# We've taken special care to not reference any restricted code.
"reciprocal", # MPL2
"notice", # Portions BSD
])
# License-restricted (i.e. not reciprocal or notice) files inside Eigen/...
EIGEN_RESTRICTED_FILES = [
"Eigen/src/OrderingMethods/Amd.h",
"Eigen/src/SparseCholesky/**",
]
# Notable transitive dependencies of restricted files inside Eigen/...
EIGEN_RESTRICTED_DEPS = [
"Eigen/Eigen",
"Eigen/IterativeLinearSolvers",
"Eigen/MetisSupport",
"Eigen/Sparse",
"Eigen/SparseCholesky",
"Eigen/SparseLU",
]
# Note: unsupported/Eigen is unsupported and might go away at any time.
EIGEN_FILES = [
"Eigen/**",
"unsupported/Eigen/CXX11/**",
"unsupported/Eigen/FFT",
"unsupported/Eigen/KroneckerProduct",
"unsupported/Eigen/src/FFT/**",
"unsupported/Eigen/src/KroneckerProduct/**",
"unsupported/Eigen/MatrixFunctions",
"unsupported/Eigen/SpecialFunctions",
"unsupported/Eigen/src/SpecialFunctions/**",
]
# List of files picked up by glob but actually part of another target.
EIGEN_EXCLUDE_FILES = [
"Eigen/src/Core/arch/AVX/PacketMathGoogleTest.cc",
]
# Files known to be under MPL2 license.
EIGEN_MPL2_HEADER_FILES = glob(
EIGEN_FILES,
exclude = EIGEN_EXCLUDE_FILES +
EIGEN_RESTRICTED_FILES +
EIGEN_RESTRICTED_DEPS + [
# Guarantees any file missed by excludes above will not compile.
"Eigen/src/Core/util/NonMPL2.h",
"Eigen/**/CMakeLists.txt",
],
)
cc_library(
name = "eigen",
hdrs = EIGEN_MPL2_HEADER_FILES,
defines = [
# This define (mostly) guarantees we don't link any problematic
# code. We use it, but we do not rely on it, as evidenced above.
"EIGEN_MPL2_ONLY",
# TODO(jart): Use EIGEN_USE_NONBLOCKING_THREAD_POOL but first add an
# eigen_initialize.cc file and alwayslink=1.
],
includes = ["."],
visibility = ["//visibility:public"],
)