aboutsummaryrefslogtreecommitdiff
path: root/jni/Android.mk
diff options
context:
space:
mode:
Diffstat (limited to 'jni/Android.mk')
-rw-r--r--jni/Android.mk108
1 files changed, 61 insertions, 47 deletions
diff --git a/jni/Android.mk b/jni/Android.mk
index 7d5afd8..70680f5 100644
--- a/jni/Android.mk
+++ b/jni/Android.mk
@@ -29,49 +29,44 @@
# Author: settinger@google.com (Scott Ettinger)
# keir@google.com (Keir Mierle)
#
-# Builds Ceres for Android, using the standard toolchain (not standalone). It
-# uses STLPort instead of GNU C++. This is useful for anyone wishing to ship
-# GPL-free code. This cannot build the tests or other parts of Ceres; only the
-# core libraries. If you need a more complete Ceres build, consider using the
-# CMake toolchain (noting that the standalone toolchain doesn't work with
-# STLPort).
+# 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.
#
-# You will have to specify the environment EIGEN_PATH to point to the Eigen
-# sources when building. For example:
+# Building
+# --------
#
-# EIGEN_PATH=/home/keir/src/eigen-3.0.5 ndk-build -j
+# You will have to specify the environment EIGEN_PATH to point to the
+# Eigen sources when building. For example:
#
-# It is also possible to specify CERES_EXTRA_DEFINES, in case you need to pass
-# more definitions to the C compiler.
+# EIGEN_PATH=/home/keir/src/eigen-3.0.5 ndk-build -j
#
-# IMPORTANT:
+# It is also possible to specify CERES_EXTRA_DEFINES, in case you need
+# to pass more definitions to the C compiler.
#
-# The shared library built at the bottom is fake, broken, and empty. It exists
-# only to force ndk-build to build the shared library. This shouldn't be
-# necessary, but if it is missing, then ndk-build will do nothing when asked to
-# build. The produced .so library is NON-FUNCTIONAL since it has no Ceres
-# function-level dependencies. Instead, copy the static library:
+# Using the library
+# -----------------
+# Copy the static library:
#
# ../obj/local/armeabi-v7a/libceres.a
#
-# into your own project, then link it into your binary in your Android.mk file.
+# into your own project, then link it into your binary in your
+# Android.mk file.
#
-# Reducing binary size:
-#
-# This build includes the Schur specializations, which cause binary bloat. If
-# you don't need them for your application, consider adding:
+# 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:
#
# -DCERES_RESTRICT_SCHUR_SPECIALIZATION
#
-# to the LOCAL_CFLAGS variable below, and commenting out all the
-# generated/schur_eliminator_2_2_2.cc-alike files, leaving only the _d_d_d one.
-#
-# Similarly if you do not need the line search minimizer, consider adding
-#
-# -DCERES_NO_LINE_SEARCH_MINIMIZER
-#
-# Changing the logging library:
+# to the LOCAL_CFLAGS variable below.
#
+# 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
@@ -79,11 +74,17 @@
LOCAL_PATH := $(call my-dir)
+# Ceres requires at least NDK version r9d to compile.
+ifneq ($(shell $(LOCAL_PATH)/assert_ndk_version.sh "r9d" $(NDK_ROOT)), true)
+ $(error Ceres requires NDK version r9d or greater)
+endif
+
EIGEN_PATH := $(EIGEN_PATH)
CERES_INCLUDE_PATHS := $(CERES_EXTRA_INCLUDES)
CERES_INCLUDE_PATHS += $(LOCAL_PATH)/../internal
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
@@ -101,15 +102,9 @@ LOCAL_CPP_EXTENSION := .cc
LOCAL_CFLAGS := $(CERES_EXTRA_DEFINES) \
-DCERES_NO_LAPACK \
-DCERES_NO_SUITESPARSE \
- -DCERES_NO_GFLAGS \
-DCERES_NO_THREADS \
-DCERES_NO_CXSPARSE \
- -DCERES_NO_TR1 \
- -DCERES_WORK_AROUND_ANDROID_NDK_COMPILER_BUG
-
-# On Android NDK 8b, GCC gives spurrious warnings about ABI incompatibility for
-# which there is no solution. Hide the warning instead.
-LOCAL_CFLAGS += -Wno-psabi
+ -DCERES_STD_UNORDERED_MAP
LOCAL_SRC_FILES := $(CERES_SRC_PATH)/array_utils.cc \
$(CERES_SRC_PATH)/blas.cc \
@@ -117,10 +112,12 @@ LOCAL_SRC_FILES := $(CERES_SRC_PATH)/array_utils.cc \
$(CERES_SRC_PATH)/block_jacobian_writer.cc \
$(CERES_SRC_PATH)/block_jacobi_preconditioner.cc \
$(CERES_SRC_PATH)/block_random_access_dense_matrix.cc \
+ $(CERES_SRC_PATH)/block_random_access_diagonal_matrix.cc \
$(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 \
+ $(CERES_SRC_PATH)/callbacks.cc \
$(CERES_SRC_PATH)/canonical_views_clustering.cc \
$(CERES_SRC_PATH)/cgnr_solver.cc \
$(CERES_SRC_PATH)/compressed_row_jacobian_writer.cc \
@@ -134,6 +131,8 @@ LOCAL_SRC_FILES := $(CERES_SRC_PATH)/array_utils.cc \
$(CERES_SRC_PATH)/dense_sparse_matrix.cc \
$(CERES_SRC_PATH)/detect_structure.cc \
$(CERES_SRC_PATH)/dogleg_strategy.cc \
+ $(CERES_SRC_PATH)/dynamic_compressed_row_jacobian_writer.cc \
+ $(CERES_SRC_PATH)/dynamic_compressed_row_sparse_matrix.cc \
$(CERES_SRC_PATH)/evaluator.cc \
$(CERES_SRC_PATH)/file.cc \
$(CERES_SRC_PATH)/gradient_checking_cost_function.cc \
@@ -159,9 +158,9 @@ LOCAL_SRC_FILES := $(CERES_SRC_PATH)/array_utils.cc \
$(CERES_SRC_PATH)/problem.cc \
$(CERES_SRC_PATH)/problem_impl.cc \
$(CERES_SRC_PATH)/program.cc \
+ $(CERES_SRC_PATH)/reorder_program.cc \
$(CERES_SRC_PATH)/residual_block.cc \
$(CERES_SRC_PATH)/residual_block_utils.cc \
- $(CERES_SRC_PATH)/runtime_numeric_diff_cost_function.cc \
$(CERES_SRC_PATH)/schur_complement_solver.cc \
$(CERES_SRC_PATH)/schur_eliminator.cc \
$(CERES_SRC_PATH)/schur_jacobi_preconditioner.cc \
@@ -172,6 +171,7 @@ LOCAL_SRC_FILES := $(CERES_SRC_PATH)/array_utils.cc \
$(CERES_SRC_PATH)/sparse_normal_cholesky_solver.cc \
$(CERES_SRC_PATH)/split.cc \
$(CERES_SRC_PATH)/stringprintf.cc \
+ $(CERES_SRC_PATH)/summary_utils.cc \
$(CERES_SRC_PATH)/suitesparse.cc \
$(CERES_SRC_PATH)/triplet_sparse_matrix.cc \
$(CERES_SRC_PATH)/trust_region_minimizer.cc \
@@ -191,11 +191,33 @@ LOCAL_SRC_FILES := $(CERES_SRC_PATH)/array_utils.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 \
+ $(CERES_SRC_PATH)/generated/schur_eliminator_2_4_8.cc \
+ $(CERES_SRC_PATH)/generated/schur_eliminator_2_4_9.cc \
$(CERES_SRC_PATH)/generated/schur_eliminator_2_4_d.cc \
+ $(CERES_SRC_PATH)/generated/schur_eliminator_2_d_d.cc \
$(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/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 \
+ $(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 \
+ $(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
ifndef CERES_GLOG_DIR
LOCAL_SRC_FILES += $(CERES_SRC_PATH)/miniglog/glog/logging.cc
@@ -203,11 +225,3 @@ endif
LOCAL_MODULE := ceres
include $(BUILD_STATIC_LIBRARY)
-
-# This is a fake library; see the file header comments.
-include $(CLEAR_VARS)
-LOCAL_C_INCLUDES := $(CERES_INCLUDE_PATHS)
-LOCAL_C_INCLUDES += $(EIGEN_PATH)
-LOCAL_MODULE := forces_static_ceres_build_do_not_use
-LOCAL_STATIC_LIBRARIES := ceres
-include $(BUILD_SHARED_LIBRARY)