Keir Mierle | 8ceb02c | 2012-08-16 14:23:47 -0700 | [diff] [blame] | 1 | # Ceres Solver - A fast non-linear least squares minimizer |
| 2 | # Copyright 2010, 2011, 2012 Google Inc. All rights reserved. |
| 3 | # http://code.google.com/p/ceres-solver/ |
| 4 | # |
| 5 | # Redistribution and use in source and binary forms, with or without |
| 6 | # modification, are permitted provided that the following conditions are met: |
| 7 | # |
| 8 | # * Redistributions of source code must retain the above copyright notice, |
| 9 | # this list of conditions and the following disclaimer. |
| 10 | # * Redistributions in binary form must reproduce the above copyright notice, |
| 11 | # this list of conditions and the following disclaimer in the documentation |
| 12 | # and/or other materials provided with the distribution. |
| 13 | # * Neither the name of Google Inc. nor the names of its contributors may be |
| 14 | # used to endorse or promote products derived from this software without |
| 15 | # specific prior written permission. |
| 16 | # |
| 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 18 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 19 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 20 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
| 21 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 22 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 23 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 24 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 25 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 26 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 27 | # POSSIBILITY OF SUCH DAMAGE. |
| 28 | # |
| 29 | # Author: settinger@google.com (Scott Ettinger) |
| 30 | # keir@google.com (Keir Mierle) |
| 31 | # |
| 32 | # Builds Ceres for Android, using the standard toolchain (not standalone). It |
| 33 | # uses STLPort instead of GNU C++. This is useful for anyone wishing to ship |
| 34 | # GPL-free code. This cannot build the tests or other parts of Ceres; only the |
| 35 | # core libraries. If you need a more complete Ceres build, consider using the |
| 36 | # CMake toolchain (noting that the standalone toolchain doesn't work with |
| 37 | # STLPort). |
| 38 | # |
| 39 | # You will have to specify the environment EIGEN_PATH to point to the Eigen |
| 40 | # sources when building. For example: |
| 41 | # |
| 42 | # EIGEN_PATH=/home/keir/src/eigen-3.0.5 ndk-build -j |
| 43 | # |
| 44 | # It is also possible to specify CERES_EXTRA_DEFINES, in case you need to pass |
| 45 | # more definitions to the C compiler. |
| 46 | # |
| 47 | # IMPORTANT: |
| 48 | # |
| 49 | # The shared library built at the bottom is fake, broken, and empty. It exists |
| 50 | # only to force ndk-build to build the shared library. This shouldn't be |
| 51 | # necessary, but if it is missing, then ndk-build will do nothing when asked to |
| 52 | # build. The produced .so library is NON-FUNCTIONAL since it has no Ceres |
| 53 | # function-level dependencies. Instead, copy the static library: |
| 54 | # |
| 55 | # ../obj/local/armeabi-v7a/libceres.a |
| 56 | # |
| 57 | # into your own project, then link it into your binary in your Android.mk file. |
| 58 | # |
| 59 | # Reducing binary size: |
| 60 | # |
| 61 | # This build includes the Schur specializations, which cause binary bloat. If |
| 62 | # you don't need them for your application, consider adding: |
| 63 | # |
| 64 | # -DCERES_RESTRICT_SCHUR_SPECIALIZATION |
| 65 | # |
Sameer Agarwal | 5a161a2 | 2013-10-29 22:08:15 -0700 | [diff] [blame] | 66 | # to the LOCAL_CFLAGS variable below. |
Sameer Agarwal | 8140f0f | 2013-03-12 09:45:08 -0700 | [diff] [blame] | 67 | # |
| 68 | # Similarly if you do not need the line search minimizer, consider adding |
| 69 | # |
| 70 | # -DCERES_NO_LINE_SEARCH_MINIMIZER |
Sameer Agarwal | 793a339 | 2013-03-13 12:14:00 -0700 | [diff] [blame] | 71 | # |
| 72 | # Changing the logging library: |
| 73 | # |
| 74 | # Ceres Solver ships with a replacement for glog that provides a |
| 75 | # simple and small implementation that builds on Android. However, if |
| 76 | # you wish to supply a header only version yourself, then you may |
| 77 | # define CERES_GLOG_DIR to point to it. |
Keir Mierle | 8ceb02c | 2012-08-16 14:23:47 -0700 | [diff] [blame] | 78 | |
| 79 | LOCAL_PATH := $(call my-dir) |
| 80 | |
| 81 | EIGEN_PATH := $(EIGEN_PATH) |
Sameer Agarwal | 793a339 | 2013-03-13 12:14:00 -0700 | [diff] [blame] | 82 | CERES_INCLUDE_PATHS := $(CERES_EXTRA_INCLUDES) |
| 83 | CERES_INCLUDE_PATHS += $(LOCAL_PATH)/../internal |
Sameer Agarwal | a2fd9ca | 2013-01-29 16:02:41 -0800 | [diff] [blame] | 84 | CERES_INCLUDE_PATHS += $(LOCAL_PATH)/../internal/ceres |
| 85 | CERES_INCLUDE_PATHS += $(LOCAL_PATH)/../include |
Sameer Agarwal | 793a339 | 2013-03-13 12:14:00 -0700 | [diff] [blame] | 86 | |
| 87 | # Use the alternate glog implementation if provided by the user. |
| 88 | ifdef CERES_GLOG_DIR |
| 89 | CERES_INCLUDE_PATHS += $(CERES_GLOG_DIR) |
| 90 | else |
| 91 | CERES_INCLUDE_PATHS += $(LOCAL_PATH)/../internal/ceres/miniglog |
| 92 | endif |
Keir Mierle | 8ceb02c | 2012-08-16 14:23:47 -0700 | [diff] [blame] | 93 | CERES_SRC_PATH := ../internal/ceres |
| 94 | |
| 95 | include $(CLEAR_VARS) |
| 96 | LOCAL_C_INCLUDES := $(CERES_INCLUDE_PATHS) |
| 97 | LOCAL_C_INCLUDES += $(EIGEN_PATH) |
| 98 | |
| 99 | LOCAL_CPP_EXTENSION := .cc |
Keir Mierle | 8ceb02c | 2012-08-16 14:23:47 -0700 | [diff] [blame] | 100 | LOCAL_CFLAGS := $(CERES_EXTRA_DEFINES) \ |
Sameer Agarwal | 367b65e | 2013-08-09 10:35:37 -0700 | [diff] [blame] | 101 | -DCERES_NO_LAPACK \ |
Keir Mierle | 8ceb02c | 2012-08-16 14:23:47 -0700 | [diff] [blame] | 102 | -DCERES_NO_SUITESPARSE \ |
| 103 | -DCERES_NO_GFLAGS \ |
| 104 | -DCERES_NO_THREADS \ |
| 105 | -DCERES_NO_CXSPARSE \ |
Sameer Agarwal | f6b67df | 2013-10-25 06:24:19 -0700 | [diff] [blame] | 106 | -DCERES_NO_UNORDERED_MAP \ |
Keir Mierle | 6ad6257 | 2012-08-22 11:10:31 -0700 | [diff] [blame] | 107 | -DCERES_WORK_AROUND_ANDROID_NDK_COMPILER_BUG |
Keir Mierle | 8ceb02c | 2012-08-16 14:23:47 -0700 | [diff] [blame] | 108 | |
Keir Mierle | 27dd0d3 | 2012-10-15 13:52:36 -0700 | [diff] [blame] | 109 | # On Android NDK 8b, GCC gives spurrious warnings about ABI incompatibility for |
| 110 | # which there is no solution. Hide the warning instead. |
| 111 | LOCAL_CFLAGS += -Wno-psabi |
| 112 | |
Keir Mierle | 8ceb02c | 2012-08-16 14:23:47 -0700 | [diff] [blame] | 113 | LOCAL_SRC_FILES := $(CERES_SRC_PATH)/array_utils.cc \ |
Sameer Agarwal | dc60d9c | 2013-08-15 10:13:45 -0700 | [diff] [blame] | 114 | $(CERES_SRC_PATH)/blas.cc \ |
Keir Mierle | 8ceb02c | 2012-08-16 14:23:47 -0700 | [diff] [blame] | 115 | $(CERES_SRC_PATH)/block_evaluate_preparer.cc \ |
| 116 | $(CERES_SRC_PATH)/block_jacobian_writer.cc \ |
| 117 | $(CERES_SRC_PATH)/block_jacobi_preconditioner.cc \ |
| 118 | $(CERES_SRC_PATH)/block_random_access_dense_matrix.cc \ |
Sameer Agarwal | 0e2743e | 2013-10-23 14:51:07 -0700 | [diff] [blame] | 119 | $(CERES_SRC_PATH)/block_random_access_diagonal_matrix.cc \ |
Keir Mierle | 8ceb02c | 2012-08-16 14:23:47 -0700 | [diff] [blame] | 120 | $(CERES_SRC_PATH)/block_random_access_matrix.cc \ |
| 121 | $(CERES_SRC_PATH)/block_random_access_sparse_matrix.cc \ |
| 122 | $(CERES_SRC_PATH)/block_sparse_matrix.cc \ |
| 123 | $(CERES_SRC_PATH)/block_structure.cc \ |
| 124 | $(CERES_SRC_PATH)/canonical_views_clustering.cc \ |
| 125 | $(CERES_SRC_PATH)/cgnr_solver.cc \ |
| 126 | $(CERES_SRC_PATH)/compressed_row_jacobian_writer.cc \ |
| 127 | $(CERES_SRC_PATH)/compressed_row_sparse_matrix.cc \ |
| 128 | $(CERES_SRC_PATH)/conditioned_cost_function.cc \ |
| 129 | $(CERES_SRC_PATH)/conjugate_gradients_solver.cc \ |
Sameer Agarwal | ba8d967 | 2012-10-02 00:48:57 -0700 | [diff] [blame] | 130 | $(CERES_SRC_PATH)/coordinate_descent_minimizer.cc \ |
Keir Mierle | 8ceb02c | 2012-08-16 14:23:47 -0700 | [diff] [blame] | 131 | $(CERES_SRC_PATH)/corrector.cc \ |
Sameer Agarwal | b9f15a5 | 2012-08-18 13:06:19 -0700 | [diff] [blame] | 132 | $(CERES_SRC_PATH)/dense_normal_cholesky_solver.cc \ |
Keir Mierle | 8ceb02c | 2012-08-16 14:23:47 -0700 | [diff] [blame] | 133 | $(CERES_SRC_PATH)/dense_qr_solver.cc \ |
| 134 | $(CERES_SRC_PATH)/dense_sparse_matrix.cc \ |
| 135 | $(CERES_SRC_PATH)/detect_structure.cc \ |
| 136 | $(CERES_SRC_PATH)/dogleg_strategy.cc \ |
| 137 | $(CERES_SRC_PATH)/evaluator.cc \ |
| 138 | $(CERES_SRC_PATH)/file.cc \ |
| 139 | $(CERES_SRC_PATH)/gradient_checking_cost_function.cc \ |
| 140 | $(CERES_SRC_PATH)/implicit_schur_complement.cc \ |
| 141 | $(CERES_SRC_PATH)/iterative_schur_complement_solver.cc \ |
Sameer Agarwal | dc60d9c | 2013-08-15 10:13:45 -0700 | [diff] [blame] | 142 | $(CERES_SRC_PATH)/lapack.cc \ |
Keir Mierle | 8ceb02c | 2012-08-16 14:23:47 -0700 | [diff] [blame] | 143 | $(CERES_SRC_PATH)/levenberg_marquardt_strategy.cc \ |
Sameer Agarwal | 1d11be9 | 2012-11-25 19:28:06 -0800 | [diff] [blame] | 144 | $(CERES_SRC_PATH)/line_search.cc \ |
Sameer Agarwal | 9883fc3 | 2012-11-30 12:32:43 -0800 | [diff] [blame] | 145 | $(CERES_SRC_PATH)/line_search_direction.cc \ |
Sameer Agarwal | f4d0164 | 2012-11-26 12:55:58 -0800 | [diff] [blame] | 146 | $(CERES_SRC_PATH)/line_search_minimizer.cc \ |
Keir Mierle | 8ceb02c | 2012-08-16 14:23:47 -0700 | [diff] [blame] | 147 | $(CERES_SRC_PATH)/linear_least_squares_problems.cc \ |
| 148 | $(CERES_SRC_PATH)/linear_operator.cc \ |
| 149 | $(CERES_SRC_PATH)/linear_solver.cc \ |
| 150 | $(CERES_SRC_PATH)/local_parameterization.cc \ |
| 151 | $(CERES_SRC_PATH)/loss_function.cc \ |
Sameer Agarwal | 9883fc3 | 2012-11-30 12:32:43 -0800 | [diff] [blame] | 152 | $(CERES_SRC_PATH)/low_rank_inverse_hessian.cc \ |
Sameer Agarwal | 9883fc3 | 2012-11-30 12:32:43 -0800 | [diff] [blame] | 153 | $(CERES_SRC_PATH)/minimizer.cc \ |
Keir Mierle | 8ceb02c | 2012-08-16 14:23:47 -0700 | [diff] [blame] | 154 | $(CERES_SRC_PATH)/normal_prior.cc \ |
Keir Mierle | 27dd0d3 | 2012-10-15 13:52:36 -0700 | [diff] [blame] | 155 | $(CERES_SRC_PATH)/parameter_block_ordering.cc \ |
Keir Mierle | 8ceb02c | 2012-08-16 14:23:47 -0700 | [diff] [blame] | 156 | $(CERES_SRC_PATH)/partitioned_matrix_view.cc \ |
Sameer Agarwal | e7295c2 | 2012-11-23 18:56:50 -0800 | [diff] [blame] | 157 | $(CERES_SRC_PATH)/polynomial.cc \ |
Sameer Agarwal | 290b975 | 2013-02-17 16:50:37 -0800 | [diff] [blame] | 158 | $(CERES_SRC_PATH)/preconditioner.cc \ |
Keir Mierle | 8ceb02c | 2012-08-16 14:23:47 -0700 | [diff] [blame] | 159 | $(CERES_SRC_PATH)/problem.cc \ |
| 160 | $(CERES_SRC_PATH)/problem_impl.cc \ |
| 161 | $(CERES_SRC_PATH)/program.cc \ |
| 162 | $(CERES_SRC_PATH)/residual_block.cc \ |
| 163 | $(CERES_SRC_PATH)/residual_block_utils.cc \ |
Keir Mierle | 8ceb02c | 2012-08-16 14:23:47 -0700 | [diff] [blame] | 164 | $(CERES_SRC_PATH)/schur_complement_solver.cc \ |
| 165 | $(CERES_SRC_PATH)/schur_eliminator.cc \ |
Sameer Agarwal | 290b975 | 2013-02-17 16:50:37 -0800 | [diff] [blame] | 166 | $(CERES_SRC_PATH)/schur_jacobi_preconditioner.cc \ |
Keir Mierle | 8ceb02c | 2012-08-16 14:23:47 -0700 | [diff] [blame] | 167 | $(CERES_SRC_PATH)/scratch_evaluate_preparer.cc \ |
| 168 | $(CERES_SRC_PATH)/solver.cc \ |
| 169 | $(CERES_SRC_PATH)/solver_impl.cc \ |
| 170 | $(CERES_SRC_PATH)/sparse_matrix.cc \ |
| 171 | $(CERES_SRC_PATH)/sparse_normal_cholesky_solver.cc \ |
| 172 | $(CERES_SRC_PATH)/split.cc \ |
| 173 | $(CERES_SRC_PATH)/stringprintf.cc \ |
| 174 | $(CERES_SRC_PATH)/suitesparse.cc \ |
| 175 | $(CERES_SRC_PATH)/triplet_sparse_matrix.cc \ |
| 176 | $(CERES_SRC_PATH)/trust_region_minimizer.cc \ |
| 177 | $(CERES_SRC_PATH)/trust_region_strategy.cc \ |
| 178 | $(CERES_SRC_PATH)/types.cc \ |
| 179 | $(CERES_SRC_PATH)/visibility_based_preconditioner.cc \ |
| 180 | $(CERES_SRC_PATH)/visibility.cc \ |
Keir Mierle | c804bb0 | 2012-10-15 14:10:43 -0700 | [diff] [blame] | 181 | $(CERES_SRC_PATH)/wall_time.cc \ |
Keir Mierle | 8ceb02c | 2012-08-16 14:23:47 -0700 | [diff] [blame] | 182 | $(CERES_SRC_PATH)/generated/schur_eliminator_d_d_d.cc \ |
| 183 | $(CERES_SRC_PATH)/generated/schur_eliminator_2_2_2.cc \ |
| 184 | $(CERES_SRC_PATH)/generated/schur_eliminator_2_2_3.cc \ |
| 185 | $(CERES_SRC_PATH)/generated/schur_eliminator_2_2_4.cc \ |
| 186 | $(CERES_SRC_PATH)/generated/schur_eliminator_2_2_d.cc \ |
| 187 | $(CERES_SRC_PATH)/generated/schur_eliminator_2_3_3.cc \ |
| 188 | $(CERES_SRC_PATH)/generated/schur_eliminator_2_3_4.cc \ |
| 189 | $(CERES_SRC_PATH)/generated/schur_eliminator_2_3_9.cc \ |
| 190 | $(CERES_SRC_PATH)/generated/schur_eliminator_2_3_d.cc \ |
| 191 | $(CERES_SRC_PATH)/generated/schur_eliminator_2_4_3.cc \ |
| 192 | $(CERES_SRC_PATH)/generated/schur_eliminator_2_4_4.cc \ |
| 193 | $(CERES_SRC_PATH)/generated/schur_eliminator_2_4_d.cc \ |
| 194 | $(CERES_SRC_PATH)/generated/schur_eliminator_4_4_2.cc \ |
| 195 | $(CERES_SRC_PATH)/generated/schur_eliminator_4_4_3.cc \ |
| 196 | $(CERES_SRC_PATH)/generated/schur_eliminator_4_4_4.cc \ |
Sameer Agarwal | 5a161a2 | 2013-10-29 22:08:15 -0700 | [diff] [blame] | 197 | $(CERES_SRC_PATH)/generated/schur_eliminator_4_4_d.cc \ |
Sameer Agarwal | 9ba0b35 | 2013-11-05 13:04:56 -0800 | [diff] [blame] | 198 | $(CERES_SRC_PATH)/generated/partitioned_matrix_view_d_d_d.cc \ |
Sameer Agarwal | 5a161a2 | 2013-10-29 22:08:15 -0700 | [diff] [blame] | 199 | $(CERES_SRC_PATH)/generated/partitioned_matrix_view_2_2_2.cc \ |
| 200 | $(CERES_SRC_PATH)/generated/partitioned_matrix_view_2_2_3.cc \ |
| 201 | $(CERES_SRC_PATH)/generated/partitioned_matrix_view_2_2_4.cc \ |
| 202 | $(CERES_SRC_PATH)/generated/partitioned_matrix_view_2_2_d.cc \ |
| 203 | $(CERES_SRC_PATH)/generated/partitioned_matrix_view_2_3_3.cc \ |
| 204 | $(CERES_SRC_PATH)/generated/partitioned_matrix_view_2_3_4.cc \ |
| 205 | $(CERES_SRC_PATH)/generated/partitioned_matrix_view_2_3_9.cc \ |
| 206 | $(CERES_SRC_PATH)/generated/partitioned_matrix_view_2_3_d.cc \ |
| 207 | $(CERES_SRC_PATH)/generated/partitioned_matrix_view_2_4_3.cc \ |
| 208 | $(CERES_SRC_PATH)/generated/partitioned_matrix_view_2_4_4.cc \ |
| 209 | $(CERES_SRC_PATH)/generated/partitioned_matrix_view_2_4_d.cc \ |
| 210 | $(CERES_SRC_PATH)/generated/partitioned_matrix_view_4_4_2.cc \ |
| 211 | $(CERES_SRC_PATH)/generated/partitioned_matrix_view_4_4_3.cc \ |
| 212 | $(CERES_SRC_PATH)/generated/partitioned_matrix_view_4_4_4.cc \ |
| 213 | $(CERES_SRC_PATH)/generated/partitioned_matrix_view_4_4_d.cc |
Keir Mierle | 8ceb02c | 2012-08-16 14:23:47 -0700 | [diff] [blame] | 214 | |
Sameer Agarwal | 793a339 | 2013-03-13 12:14:00 -0700 | [diff] [blame] | 215 | ifndef CERES_GLOG_DIR |
| 216 | LOCAL_SRC_FILES += $(CERES_SRC_PATH)/miniglog/glog/logging.cc |
| 217 | endif |
| 218 | |
Keir Mierle | 8ceb02c | 2012-08-16 14:23:47 -0700 | [diff] [blame] | 219 | LOCAL_MODULE := ceres |
| 220 | include $(BUILD_STATIC_LIBRARY) |
| 221 | |
| 222 | # This is a fake library; see the file header comments. |
| 223 | include $(CLEAR_VARS) |
| 224 | LOCAL_C_INCLUDES := $(CERES_INCLUDE_PATHS) |
| 225 | LOCAL_C_INCLUDES += $(EIGEN_PATH) |
| 226 | LOCAL_MODULE := forces_static_ceres_build_do_not_use |
| 227 | LOCAL_STATIC_LIBRARIES := ceres |
| 228 | include $(BUILD_SHARED_LIBRARY) |