Files
ceres-solver/jni/Android.mk
T

245 lines
12 KiB
Makefile
Raw Normal View History

2012-08-16 14:23:47 -07:00
# Ceres Solver - A fast non-linear least squares minimizer
# Copyright 2015 Google Inc. All rights reserved.
# http://ceres-solver.org/
2012-08-16 14:23:47 -07:00
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of Google Inc. nor the names of its contributors may be
# used to endorse or promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# Author: settinger@google.com (Scott Ettinger)
# keir@google.com (Keir Mierle)
#
# Builds Ceres for Android, using the standard toolchain (not
# standalone). It uses LLVM's libc++ as the standard library. It is a
# modern BSD licensed implementation of the standard c++ library. We
# do this to avoid any licensing issues that may arise from using
# GCC's libstdc++ which is licensed under GPL3.
2012-08-16 14:23:47 -07:00
#
# Building
# --------
2012-08-16 14:23:47 -07:00
#
# You will have to specify the environment EIGEN_PATH to point to the
# Eigen sources when building. For example:
2012-08-16 14:23:47 -07:00
#
# EIGEN_PATH=/home/keir/src/eigen-3.0.5 ndk-build -j
2012-08-16 14:23:47 -07:00
#
# It is also possible to specify CERES_EXTRA_DEFINES, in case you need
# to pass more definitions to the C compiler.
2012-08-16 14:23:47 -07:00
#
# Using the library
# -----------------
# Copy the static library:
2012-08-16 14:23:47 -07:00
#
# ../obj/local/armeabi-v7a/libceres.a
#
# into your own project, then link it into your binary in your
# Android.mk file.
2012-08-16 14:23:47 -07:00
#
# Reducing binary size
# --------------------
# This build includes the Schur specializations, which increase the
# size of the binary. If you don't need them for your application,
# consider adding:
2012-08-16 14:23:47 -07:00
#
# -DCERES_RESTRICT_SCHUR_SPECIALIZATION
#
# to the LOCAL_CFLAGS variable below.
2013-03-12 09:45:08 -07:00
#
# Changing the logging library
# ----------------------------
# Ceres Solver ships with a replacement for glog that provides a
# simple and small implementation that builds on Android. However, if
# you wish to supply a header only version yourself, then you may
# define CERES_GLOG_DIR to point to it.
2012-08-16 14:23:47 -07:00
LOCAL_PATH := $(call my-dir)
# Ceres requires at least NDK version r9d to compile.
2014-06-05 12:18:23 -07:00
ifneq ($(shell $(LOCAL_PATH)/assert_ndk_version.sh "r9d" $(NDK_ROOT)), true)
$(error Ceres requires NDK version r9d or greater)
endif
2012-08-16 14:23:47 -07:00
EIGEN_PATH := $(EIGEN_PATH)
CERES_INCLUDE_PATHS := $(CERES_EXTRA_INCLUDES)
CERES_INCLUDE_PATHS += $(LOCAL_PATH)/../internal
2013-01-29 16:02:41 -08:00
CERES_INCLUDE_PATHS += $(LOCAL_PATH)/../internal/ceres
CERES_INCLUDE_PATHS += $(LOCAL_PATH)/../include
CERES_INCLUDE_PATHS += $(LOCAL_PATH)/../config
# Use the alternate glog implementation if provided by the user.
ifdef CERES_GLOG_DIR
CERES_INCLUDE_PATHS += $(CERES_GLOG_DIR)
else
CERES_INCLUDE_PATHS += $(LOCAL_PATH)/../internal/ceres/miniglog
endif
2012-08-16 14:23:47 -07:00
CERES_SRC_PATH := ../internal/ceres
include $(CLEAR_VARS)
LOCAL_C_INCLUDES := $(CERES_INCLUDE_PATHS)
LOCAL_C_INCLUDES += $(EIGEN_PATH)
LOCAL_CPP_EXTENSION := .cc
LOCAL_CFLAGS := $(CERES_EXTRA_DEFINES) \
2013-08-09 10:35:37 -07:00
-DCERES_NO_LAPACK \
2012-08-16 14:23:47 -07:00
-DCERES_NO_SUITESPARSE \
-DCERES_NO_CXSPARSE \
2014-06-02 21:33:40 -07:00
-DCERES_STD_UNORDERED_MAP
2012-08-16 14:23:47 -07:00
2015-02-05 15:05:06 -08:00
# If the user did not enable threads in CERES_EXTRA_DEFINES, then add
# CERES_NO_THREADS.
#
# TODO(sameeragarwal): Update comments here and in the docs to
# demonstrate how OpenMP can be used by the user.
ifeq (,$(findstring CERES_HAVE_PTHREAD, $(LOCAL_CFLAGS)))
LOCAL_CFLAGS += -DCERES_NO_THREADS
endif
2012-08-16 14:23:47 -07:00
LOCAL_SRC_FILES := $(CERES_SRC_PATH)/array_utils.cc \
2013-08-15 10:13:45 -07:00
$(CERES_SRC_PATH)/blas.cc \
2012-08-16 14:23:47 -07:00
$(CERES_SRC_PATH)/block_evaluate_preparer.cc \
$(CERES_SRC_PATH)/block_jacobian_writer.cc \
$(CERES_SRC_PATH)/block_jacobi_preconditioner.cc \
$(CERES_SRC_PATH)/block_random_access_dense_matrix.cc \
2013-10-23 14:51:07 -07:00
$(CERES_SRC_PATH)/block_random_access_diagonal_matrix.cc \
2012-08-16 14:23:47 -07:00
$(CERES_SRC_PATH)/block_random_access_matrix.cc \
$(CERES_SRC_PATH)/block_random_access_sparse_matrix.cc \
$(CERES_SRC_PATH)/block_sparse_matrix.cc \
$(CERES_SRC_PATH)/block_structure.cc \
2014-05-31 23:30:32 -07:00
$(CERES_SRC_PATH)/callbacks.cc \
2012-08-16 14:23:47 -07:00
$(CERES_SRC_PATH)/canonical_views_clustering.cc \
$(CERES_SRC_PATH)/cgnr_solver.cc \
$(CERES_SRC_PATH)/compressed_row_jacobian_writer.cc \
$(CERES_SRC_PATH)/compressed_row_sparse_matrix.cc \
$(CERES_SRC_PATH)/conditioned_cost_function.cc \
$(CERES_SRC_PATH)/conjugate_gradients_solver.cc \
$(CERES_SRC_PATH)/coordinate_descent_minimizer.cc \
2012-08-16 14:23:47 -07:00
$(CERES_SRC_PATH)/corrector.cc \
$(CERES_SRC_PATH)/covariance.cc \
$(CERES_SRC_PATH)/covariance_impl.cc \
$(CERES_SRC_PATH)/dense_normal_cholesky_solver.cc \
2012-08-16 14:23:47 -07:00
$(CERES_SRC_PATH)/dense_qr_solver.cc \
$(CERES_SRC_PATH)/dense_sparse_matrix.cc \
$(CERES_SRC_PATH)/detect_structure.cc \
$(CERES_SRC_PATH)/dogleg_strategy.cc \
2014-04-28 10:28:24 -07:00
$(CERES_SRC_PATH)/dynamic_compressed_row_jacobian_writer.cc \
$(CERES_SRC_PATH)/dynamic_compressed_row_sparse_matrix.cc \
2012-08-16 14:23:47 -07:00
$(CERES_SRC_PATH)/evaluator.cc \
$(CERES_SRC_PATH)/file.cc \
$(CERES_SRC_PATH)/gradient_checking_cost_function.cc \
$(CERES_SRC_PATH)/gradient_problem.cc \
$(CERES_SRC_PATH)/gradient_problem_solver.cc \
2012-08-16 14:23:47 -07:00
$(CERES_SRC_PATH)/implicit_schur_complement.cc \
$(CERES_SRC_PATH)/iterative_schur_complement_solver.cc \
2013-08-15 10:13:45 -07:00
$(CERES_SRC_PATH)/lapack.cc \
2012-08-16 14:23:47 -07:00
$(CERES_SRC_PATH)/levenberg_marquardt_strategy.cc \
2012-11-25 19:28:06 -08:00
$(CERES_SRC_PATH)/line_search.cc \
2012-11-30 12:32:43 -08:00
$(CERES_SRC_PATH)/line_search_direction.cc \
2012-11-26 12:55:58 -08:00
$(CERES_SRC_PATH)/line_search_minimizer.cc \
2012-08-16 14:23:47 -07:00
$(CERES_SRC_PATH)/linear_least_squares_problems.cc \
$(CERES_SRC_PATH)/linear_operator.cc \
2014-06-05 21:30:13 -07:00
$(CERES_SRC_PATH)/line_search_preprocessor.cc \
2012-08-16 14:23:47 -07:00
$(CERES_SRC_PATH)/linear_solver.cc \
$(CERES_SRC_PATH)/local_parameterization.cc \
$(CERES_SRC_PATH)/loss_function.cc \
2012-11-30 12:32:43 -08:00
$(CERES_SRC_PATH)/low_rank_inverse_hessian.cc \
$(CERES_SRC_PATH)/minimizer.cc \
2012-08-16 14:23:47 -07:00
$(CERES_SRC_PATH)/normal_prior.cc \
2012-10-15 13:52:36 -07:00
$(CERES_SRC_PATH)/parameter_block_ordering.cc \
2012-08-16 14:23:47 -07:00
$(CERES_SRC_PATH)/partitioned_matrix_view.cc \
$(CERES_SRC_PATH)/polynomial.cc \
2013-02-17 16:50:37 -08:00
$(CERES_SRC_PATH)/preconditioner.cc \
2014-06-05 21:30:13 -07:00
$(CERES_SRC_PATH)/preprocessor.cc \
2012-08-16 14:23:47 -07:00
$(CERES_SRC_PATH)/problem.cc \
$(CERES_SRC_PATH)/problem_impl.cc \
$(CERES_SRC_PATH)/program.cc \
2014-06-06 15:24:03 -07:00
$(CERES_SRC_PATH)/reorder_program.cc \
2012-08-16 14:23:47 -07:00
$(CERES_SRC_PATH)/residual_block.cc \
$(CERES_SRC_PATH)/residual_block_utils.cc \
$(CERES_SRC_PATH)/schur_complement_solver.cc \
$(CERES_SRC_PATH)/schur_eliminator.cc \
2013-02-17 16:50:37 -08:00
$(CERES_SRC_PATH)/schur_jacobi_preconditioner.cc \
2012-08-16 14:23:47 -07:00
$(CERES_SRC_PATH)/scratch_evaluate_preparer.cc \
$(CERES_SRC_PATH)/solver.cc \
2014-09-17 09:46:08 -07:00
$(CERES_SRC_PATH)/solver_utils.cc \
2012-08-16 14:23:47 -07:00
$(CERES_SRC_PATH)/sparse_matrix.cc \
$(CERES_SRC_PATH)/sparse_normal_cholesky_solver.cc \
$(CERES_SRC_PATH)/split.cc \
$(CERES_SRC_PATH)/stringprintf.cc \
$(CERES_SRC_PATH)/suitesparse.cc \
$(CERES_SRC_PATH)/triplet_sparse_matrix.cc \
$(CERES_SRC_PATH)/trust_region_minimizer.cc \
2014-06-05 21:30:13 -07:00
$(CERES_SRC_PATH)/trust_region_preprocessor.cc \
2012-08-16 14:23:47 -07:00
$(CERES_SRC_PATH)/trust_region_strategy.cc \
$(CERES_SRC_PATH)/types.cc \
$(CERES_SRC_PATH)/visibility_based_preconditioner.cc \
$(CERES_SRC_PATH)/visibility.cc \
2012-10-15 14:10:43 -07:00
$(CERES_SRC_PATH)/wall_time.cc \
2012-08-16 14:23:47 -07:00
$(CERES_SRC_PATH)/generated/schur_eliminator_d_d_d.cc \
$(CERES_SRC_PATH)/generated/schur_eliminator_2_2_2.cc \
$(CERES_SRC_PATH)/generated/schur_eliminator_2_2_3.cc \
$(CERES_SRC_PATH)/generated/schur_eliminator_2_2_4.cc \
$(CERES_SRC_PATH)/generated/schur_eliminator_2_2_d.cc \
$(CERES_SRC_PATH)/generated/schur_eliminator_2_3_3.cc \
$(CERES_SRC_PATH)/generated/schur_eliminator_2_3_4.cc \
2014-12-02 11:04:24 -08:00
$(CERES_SRC_PATH)/generated/schur_eliminator_2_3_6.cc \
2012-08-16 14:23:47 -07:00
$(CERES_SRC_PATH)/generated/schur_eliminator_2_3_9.cc \
$(CERES_SRC_PATH)/generated/schur_eliminator_2_3_d.cc \
$(CERES_SRC_PATH)/generated/schur_eliminator_2_4_3.cc \
$(CERES_SRC_PATH)/generated/schur_eliminator_2_4_4.cc \
2014-06-05 17:05:36 -07:00
$(CERES_SRC_PATH)/generated/schur_eliminator_2_4_8.cc \
$(CERES_SRC_PATH)/generated/schur_eliminator_2_4_9.cc \
2012-08-16 14:23:47 -07:00
$(CERES_SRC_PATH)/generated/schur_eliminator_2_4_d.cc \
$(CERES_SRC_PATH)/generated/schur_eliminator_2_d_d.cc \
2012-08-16 14:23:47 -07:00
$(CERES_SRC_PATH)/generated/schur_eliminator_4_4_2.cc \
$(CERES_SRC_PATH)/generated/schur_eliminator_4_4_3.cc \
$(CERES_SRC_PATH)/generated/schur_eliminator_4_4_4.cc \
$(CERES_SRC_PATH)/generated/schur_eliminator_4_4_d.cc \
$(CERES_SRC_PATH)/generated/partitioned_matrix_view_d_d_d.cc \
$(CERES_SRC_PATH)/generated/partitioned_matrix_view_2_2_2.cc \
$(CERES_SRC_PATH)/generated/partitioned_matrix_view_2_2_3.cc \
$(CERES_SRC_PATH)/generated/partitioned_matrix_view_2_2_4.cc \
$(CERES_SRC_PATH)/generated/partitioned_matrix_view_2_2_d.cc \
$(CERES_SRC_PATH)/generated/partitioned_matrix_view_2_3_3.cc \
$(CERES_SRC_PATH)/generated/partitioned_matrix_view_2_3_4.cc \
2014-12-02 11:04:24 -08:00
$(CERES_SRC_PATH)/generated/partitioned_matrix_view_2_3_6.cc \
$(CERES_SRC_PATH)/generated/partitioned_matrix_view_2_3_9.cc \
$(CERES_SRC_PATH)/generated/partitioned_matrix_view_2_3_d.cc \
$(CERES_SRC_PATH)/generated/partitioned_matrix_view_2_4_3.cc \
$(CERES_SRC_PATH)/generated/partitioned_matrix_view_2_4_4.cc \
2014-06-05 17:05:36 -07:00
$(CERES_SRC_PATH)/generated/partitioned_matrix_view_2_4_8.cc \
$(CERES_SRC_PATH)/generated/partitioned_matrix_view_2_4_9.cc \
$(CERES_SRC_PATH)/generated/partitioned_matrix_view_2_4_d.cc \
$(CERES_SRC_PATH)/generated/partitioned_matrix_view_2_d_d.cc \
$(CERES_SRC_PATH)/generated/partitioned_matrix_view_4_4_2.cc \
$(CERES_SRC_PATH)/generated/partitioned_matrix_view_4_4_3.cc \
$(CERES_SRC_PATH)/generated/partitioned_matrix_view_4_4_4.cc \
$(CERES_SRC_PATH)/generated/partitioned_matrix_view_4_4_d.cc
2012-08-16 14:23:47 -07:00
ifndef CERES_GLOG_DIR
LOCAL_SRC_FILES += $(CERES_SRC_PATH)/miniglog/glog/logging.cc
endif
2012-08-16 14:23:47 -07:00
LOCAL_MODULE := ceres
include $(BUILD_STATIC_LIBRARY)