Add sparse Eigen support to Bazel build. (#1074)
parent
a82a62f8a0
commit
2be3c1f636
|
@ -124,11 +124,11 @@ def cartographer_repositories():
|
||||||
_maybe(native.new_http_archive,
|
_maybe(native.new_http_archive,
|
||||||
name = "org_ceres_solver_ceres_solver",
|
name = "org_ceres_solver_ceres_solver",
|
||||||
build_file = "@com_github_googlecartographer_cartographer//bazel/third_party:ceres.BUILD",
|
build_file = "@com_github_googlecartographer_cartographer//bazel/third_party:ceres.BUILD",
|
||||||
sha256 = "cb69d1ca4900bc9c4703116a9facba00413eafd893430659fab63246f5320288",
|
sha256 = "ede5b4205ee8d7c7e029e9da74c7ee759fee6961f7e6bfa694274e4a55b8c7ca",
|
||||||
strip_prefix = "ceres-solver-f58eacf082ddf198b2bf982e3cdb57ed3b5ea025",
|
strip_prefix = "ceres-solver-58c5edae2f7c4d2533fe8a975c1f5f0b892dfd3e",
|
||||||
urls = [
|
urls = [
|
||||||
"https://mirror.bazel.build/github.com/ceres-solver/ceres-solver/archive/f58eacf082ddf198b2bf982e3cdb57ed3b5ea025.tar.gz",
|
"https://mirror.bazel.build/github.com/ceres-solver/ceres-solver/archive/58c5edae2f7c4d2533fe8a975c1f5f0b892dfd3e.tar.gz",
|
||||||
"https://github.com/ceres-solver/ceres-solver/archive/f58eacf082ddf198b2bf982e3cdb57ed3b5ea025.tar.gz",
|
"https://github.com/ceres-solver/ceres-solver/archive/58c5edae2f7c4d2533fe8a975c1f5f0b892dfd3e.tar.gz",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -20,14 +20,12 @@ licenses(["notice"]) # New BSD, portions MIT.
|
||||||
|
|
||||||
CERES_DEFINES = [
|
CERES_DEFINES = [
|
||||||
"CERES_USE_CXX11",
|
"CERES_USE_CXX11",
|
||||||
"CERES_NO_EIGENSPARSE",
|
"CERES_USE_EIGEN_SPARSE",
|
||||||
"CERES_NO_SUITESPARSE",
|
"CERES_NO_SUITESPARSE",
|
||||||
"CERES_NO_LAPACK",
|
"CERES_NO_LAPACK",
|
||||||
"CERES_NO_CXSPARSE",
|
"CERES_NO_CXSPARSE",
|
||||||
"CERES_STD_UNORDERED_MAP",
|
"CERES_STD_UNORDERED_MAP",
|
||||||
|
"CERES_USE_CXX11_THREADS",
|
||||||
# Enable support for OpenMP.
|
|
||||||
"CERES_USE_OPENMP",
|
|
||||||
|
|
||||||
# Use the internal mutex code. Not ideal, but it works.
|
# Use the internal mutex code. Not ideal, but it works.
|
||||||
"CERES_HAVE_PTHREAD",
|
"CERES_HAVE_PTHREAD",
|
||||||
|
@ -58,6 +56,7 @@ cc_library(
|
||||||
"internal/ceres/compressed_row_sparse_matrix.cc",
|
"internal/ceres/compressed_row_sparse_matrix.cc",
|
||||||
"internal/ceres/conditioned_cost_function.cc",
|
"internal/ceres/conditioned_cost_function.cc",
|
||||||
"internal/ceres/conjugate_gradients_solver.cc",
|
"internal/ceres/conjugate_gradients_solver.cc",
|
||||||
|
"internal/ceres/context_impl.cc",
|
||||||
"internal/ceres/corrector.cc",
|
"internal/ceres/corrector.cc",
|
||||||
"internal/ceres/covariance.cc",
|
"internal/ceres/covariance.cc",
|
||||||
"internal/ceres/covariance_impl.cc",
|
"internal/ceres/covariance_impl.cc",
|
||||||
|
@ -80,6 +79,7 @@ cc_library(
|
||||||
"internal/ceres/implicit_schur_complement.cc",
|
"internal/ceres/implicit_schur_complement.cc",
|
||||||
"internal/ceres/inner_product_computer.cc",
|
"internal/ceres/inner_product_computer.cc",
|
||||||
"internal/ceres/is_close.cc",
|
"internal/ceres/is_close.cc",
|
||||||
|
"internal/ceres/iterative_refiner.cc",
|
||||||
"internal/ceres/iterative_schur_complement_solver.cc",
|
"internal/ceres/iterative_schur_complement_solver.cc",
|
||||||
"internal/ceres/lapack.cc",
|
"internal/ceres/lapack.cc",
|
||||||
"internal/ceres/levenberg_marquardt_strategy.cc",
|
"internal/ceres/levenberg_marquardt_strategy.cc",
|
||||||
|
@ -95,6 +95,7 @@ cc_library(
|
||||||
"internal/ceres/low_rank_inverse_hessian.cc",
|
"internal/ceres/low_rank_inverse_hessian.cc",
|
||||||
"internal/ceres/minimizer.cc",
|
"internal/ceres/minimizer.cc",
|
||||||
"internal/ceres/normal_prior.cc",
|
"internal/ceres/normal_prior.cc",
|
||||||
|
"internal/ceres/parallel_for_cxx.cc",
|
||||||
"internal/ceres/parameter_block_ordering.cc",
|
"internal/ceres/parameter_block_ordering.cc",
|
||||||
"internal/ceres/partitioned_matrix_view.cc",
|
"internal/ceres/partitioned_matrix_view.cc",
|
||||||
"internal/ceres/polynomial.cc",
|
"internal/ceres/polynomial.cc",
|
||||||
|
@ -120,6 +121,8 @@ cc_library(
|
||||||
"internal/ceres/split.cc",
|
"internal/ceres/split.cc",
|
||||||
"internal/ceres/stringprintf.cc",
|
"internal/ceres/stringprintf.cc",
|
||||||
"internal/ceres/suitesparse.cc",
|
"internal/ceres/suitesparse.cc",
|
||||||
|
"internal/ceres/thread_pool.cc",
|
||||||
|
"internal/ceres/thread_token_provider.cc",
|
||||||
"internal/ceres/trust_region_minimizer.cc",
|
"internal/ceres/trust_region_minimizer.cc",
|
||||||
"internal/ceres/trust_region_preprocessor.cc",
|
"internal/ceres/trust_region_preprocessor.cc",
|
||||||
"internal/ceres/trust_region_step_evaluator.cc",
|
"internal/ceres/trust_region_step_evaluator.cc",
|
||||||
|
|
|
@ -25,22 +25,6 @@ licenses([
|
||||||
|
|
||||||
exports_files(["COPYING.MPL2"])
|
exports_files(["COPYING.MPL2"])
|
||||||
|
|
||||||
# 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",
|
|
||||||
]
|
|
||||||
|
|
||||||
EIGEN_FILES = [
|
EIGEN_FILES = [
|
||||||
"Eigen/**",
|
"Eigen/**",
|
||||||
"unsupported/Eigen/CXX11/**",
|
"unsupported/Eigen/CXX11/**",
|
||||||
|
@ -59,26 +43,14 @@ EIGEN_EXCLUDE_FILES = [
|
||||||
"Eigen/src/Core/arch/AVX/PacketMathGoogleTest.cc",
|
"Eigen/src/Core/arch/AVX/PacketMathGoogleTest.cc",
|
||||||
]
|
]
|
||||||
|
|
||||||
# Files known to be under MPL2 license.
|
|
||||||
EIGEN_MPL2_HEADER_FILES = glob(
|
EIGEN_MPL2_HEADER_FILES = glob(
|
||||||
EIGEN_FILES,
|
EIGEN_FILES,
|
||||||
exclude = EIGEN_EXCLUDE_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(
|
cc_library(
|
||||||
name = "eigen",
|
name = "eigen",
|
||||||
hdrs = EIGEN_MPL2_HEADER_FILES,
|
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",
|
|
||||||
],
|
|
||||||
includes = ["."],
|
includes = ["."],
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue