diff options
author | Jason Zaman <jasonzaman@gmail.com> | 2018-06-29 05:09:02 +0800 |
---|---|---|
committer | Gunhan Gulsoy <gunan@google.com> | 2018-06-28 14:09:02 -0700 |
commit | f9b93bf58085b1bd06fa9c3741bc4b7f29ec74cc (patch) | |
tree | 242b0a05eccc93b24f62fcfd11c4802a490d04f3 | |
parent | 45b09176cc62fba5c08218558ba52265793d9bcd (diff) |
eigen: Add install_eigen_headers target for installing to system (#20281)
Eigen provides files that are both GPL and MPL. Tensorflow uses only the
MPL headers. This target collects all the headers into genfiles so they
can be easily installed to /usr/include/ later.
Thanks to dennisjenkins@google.com for all the help testing and figuring
out what was missing. And to pcloudy@google.com for pointers to the solution.
Signed-off-by: Jason Zaman <jason@perfinion.com>
-rw-r--r-- | third_party/eigen.BUILD | 6 | ||||
-rw-r--r-- | third_party/eigen3/BUILD | 60 |
2 files changed, 53 insertions, 13 deletions
diff --git a/third_party/eigen.BUILD b/third_party/eigen.BUILD index e54c1a4501..759f8a9be9 100644 --- a/third_party/eigen.BUILD +++ b/third_party/eigen.BUILD @@ -69,3 +69,9 @@ cc_library( includes = ["."], visibility = ["//visibility:public"], ) + +filegroup( + name = "eigen_header_files", + srcs = EIGEN_MPL2_HEADER_FILES, + visibility = ["//visibility:public"], +) diff --git a/third_party/eigen3/BUILD b/third_party/eigen3/BUILD index f661093bc9..9d9c27b180 100644 --- a/third_party/eigen3/BUILD +++ b/third_party/eigen3/BUILD @@ -17,21 +17,23 @@ load("//tensorflow:tensorflow.bzl", "if_mkl") # INTEL_MKL end load("//tensorflow:tensorflow.bzl", "if_mkl") +EIGEN3_THIRD_PARTY_HEADERS = [ + "Eigen/Core", + "Eigen/LU", + "Eigen/Cholesky", + "Eigen/Eigenvalues", + "Eigen/QR", + "Eigen/SVD", + "unsupported/Eigen/MatrixFunctions", + "unsupported/Eigen/SpecialFunctions", + "unsupported/Eigen/CXX11/ThreadPool", + "unsupported/Eigen/CXX11/Tensor", + "unsupported/Eigen/CXX11/FixedPoint", +] + glob(["unsupported/Eigen/CXX11/src/FixedPoint/*.h"]) + cc_library( name = "eigen3", - hdrs = glob(["unsupported/Eigen/CXX11/src/FixedPoint/*.h"]) + [ - "Eigen/Core", - "Eigen/LU", - "Eigen/Cholesky", - "Eigen/Eigenvalues", - "Eigen/QR", - "Eigen/SVD", - "unsupported/Eigen/MatrixFunctions", - "unsupported/Eigen/SpecialFunctions", - "unsupported/Eigen/CXX11/ThreadPool", - "unsupported/Eigen/CXX11/Tensor", - "unsupported/Eigen/CXX11/FixedPoint", - ], + hdrs = EIGEN3_THIRD_PARTY_HEADERS, includes = if_mkl(["./mkl_include"]), visibility = ["//visibility:public"], deps = [ @@ -48,3 +50,35 @@ filegroup( ), visibility = ["//tensorflow:__subpackages__"], ) + +filegroup( + name = "eigen_third_party_header_files", + srcs = EIGEN3_THIRD_PARTY_HEADERS, + visibility = ["//visibility:public"], +) + +genrule( + name = "install_eigen_headers", + srcs = [ + "@eigen_archive//:eigen_header_files", + ":eigen_third_party_header_files", + ], + outs = ["include"], + cmd = """ + mkdir $@ + for f in $(locations @eigen_archive//:eigen_header_files) ; do + d="$${f%/*}" + d="$${d#*external/eigen_archive/}" + + mkdir -p "$@/$${d}" + cp "$${f}" "$@/$${d}/" + done + + for f in $(locations :eigen_third_party_header_files) ; do + d="$${f%/*}" + + mkdir -p "$@/$${d}" + cp "$${f}" "$@/$${d}/" + done + """ +) |