Windows环境下编译Ceres

2024-05-30 04:18
文章标签 编译 windows 环境 ceres

本文主要是介绍Windows环境下编译Ceres,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

1. 下载ceres稳定版本ceres-solver-1.14.0

2. 解压进入jni目录,修改Application.mk文件

#APP_BUILD_SCRIPT := $(call my-dir)/Android.mk
#APP_PROJECT_PATH := $(call my-dir)APP_CPPFLAGS += -fexceptions
APP_CPPFLAGS += -frtti
APP_OPTIM := release# Use libc++ from LLVM. It is a modern BSD licensed implementation of
# the standard C++ library.
APP_STL := gnustl_static
APP_ABI := arm64-v8a

3. 修改Android.mk文件

# Ceres Solver - A fast non-linear least squares minimizer
# Copyright 2015 Google Inc. All rights reserved.
# http://ceres-solver.org/
#
# 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.
#
# Building
# --------
#
# You will have to specify the environment EIGEN_PATH to point to the
# Eigen sources when building. For example:
#
#   EIGEN_PATH=/home/keir/src/eigen-3.0.5 ndk-build -j
#
# It is also possible to specify CERES_EXTRA_DEFINES, in case you need
# to pass more definitions to the C compiler.
#
# 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.
#
# 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.
#
# 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.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)
EIGEN_PATH := $(LOCAL_PATH)/../eigen
# Ceres requires Eigen to build.
ifndef EIGEN_PATH$(error Ceres requires Eigen; please invoke via EIGEN_PATH=... ndk-build)
endifCERES_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_DIRCERES_INCLUDE_PATHS += $(CERES_GLOG_DIR)
elseCERES_INCLUDE_PATHS += $(LOCAL_PATH)/../internal/ceres/miniglog
endif
CERES_SRC_PATH := ../internal/ceresinclude $(CLEAR_VARS)
LOCAL_C_INCLUDES := $(CERES_INCLUDE_PATHS)
LOCAL_C_INCLUDES += $(EIGEN_PATH)LOCAL_CPP_EXTENSION := .cc
LOCAL_CFLAGS := $(CERES_EXTRA_DEFINES) \-DCERES_NO_LAPACK \-DCERES_NO_SUITESPARSE \-DCERES_NO_CXSPARSE \-DCERES_STD_UNORDERED_MAP \-std=gnu++11 \-DCERES_TR1_MEMORY_HEADER \-DCERES_TR1_SHARED_PTR# 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
endifLOCAL_SRC_FILES := $(CERES_SRC_PATH)/array_utils.cc \$(CERES_SRC_PATH)/blas.cc \$(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 \$(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 \$(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)/context.cc \$(CERES_SRC_PATH)/context_impl.cc \$(CERES_SRC_PATH)/coordinate_descent_minimizer.cc \$(CERES_SRC_PATH)/corrector.cc \$(CERES_SRC_PATH)/covariance.cc \$(CERES_SRC_PATH)/covariance_impl.cc \$(CERES_SRC_PATH)/dense_normal_cholesky_solver.cc \$(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 \$(CERES_SRC_PATH)/dynamic_compressed_row_jacobian_writer.cc \$(CERES_SRC_PATH)/dynamic_compressed_row_sparse_matrix.cc \$(CERES_SRC_PATH)/dynamic_sparse_normal_cholesky_solver.cc \$(CERES_SRC_PATH)/eigensparse.cc \$(CERES_SRC_PATH)/evaluator.cc \$(CERES_SRC_PATH)/file.cc \$(CERES_SRC_PATH)/function_sample.cc \$(CERES_SRC_PATH)/gradient_checker.cc \$(CERES_SRC_PATH)/gradient_checking_cost_function.cc \$(CERES_SRC_PATH)/gradient_problem.cc \$(CERES_SRC_PATH)/gradient_problem_solver.cc \$(CERES_SRC_PATH)/is_close.cc \$(CERES_SRC_PATH)/implicit_schur_complement.cc \$(CERES_SRC_PATH)/inner_product_computer.cc \$(CERES_SRC_PATH)/iterative_schur_complement_solver.cc \$(CERES_SRC_PATH)/lapack.cc \$(CERES_SRC_PATH)/levenberg_marquardt_strategy.cc \$(CERES_SRC_PATH)/line_search.cc \$(CERES_SRC_PATH)/line_search_direction.cc \$(CERES_SRC_PATH)/line_search_minimizer.cc \$(CERES_SRC_PATH)/linear_least_squares_problems.cc \$(CERES_SRC_PATH)/linear_operator.cc \$(CERES_SRC_PATH)/line_search_preprocessor.cc \$(CERES_SRC_PATH)/linear_solver.cc \$(CERES_SRC_PATH)/local_parameterization.cc \$(CERES_SRC_PATH)/loss_function.cc \$(CERES_SRC_PATH)/low_rank_inverse_hessian.cc \$(CERES_SRC_PATH)/minimizer.cc \$(CERES_SRC_PATH)/normal_prior.cc \$(CERES_SRC_PATH)/parameter_block_ordering.cc \$(CERES_SRC_PATH)/partitioned_matrix_view.cc \$(CERES_SRC_PATH)/polynomial.cc \$(CERES_SRC_PATH)/preconditioner.cc \$(CERES_SRC_PATH)/preprocessor.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)/schur_complement_solver.cc \$(CERES_SRC_PATH)/schur_eliminator.cc \$(CERES_SRC_PATH)/schur_jacobi_preconditioner.cc \$(CERES_SRC_PATH)/schur_templates.cc \$(CERES_SRC_PATH)/scratch_evaluate_preparer.cc \$(CERES_SRC_PATH)/single_linkage_clustering.cc \$(CERES_SRC_PATH)/solver.cc \$(CERES_SRC_PATH)/solver_utils.cc \$(CERES_SRC_PATH)/sparse_cholesky.cc \$(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)/subset_preconditioner.cc \$(CERES_SRC_PATH)/suitesparse.cc \$(CERES_SRC_PATH)/thread_token_provider.cc \$(CERES_SRC_PATH)/triplet_sparse_matrix.cc \$(CERES_SRC_PATH)/trust_region_minimizer.cc \$(CERES_SRC_PATH)/trust_region_preprocessor.cc \$(CERES_SRC_PATH)/trust_region_step_evaluator.cc \$(CERES_SRC_PATH)/trust_region_strategy.cc \$(CERES_SRC_PATH)/types.cc \$(CERES_SRC_PATH)/visibility_based_preconditioner.cc \$(CERES_SRC_PATH)/visibility.cc \$(CERES_SRC_PATH)/wall_time.cc \$(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 \$(CERES_SRC_PATH)/generated/schur_eliminator_2_3_6.cc \$(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 \$(CERES_SRC_PATH)/generated/schur_eliminator_2_4_6.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/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_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 \$(CERES_SRC_PATH)/generated/partitioned_matrix_view_2_4_6.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.ccifndef CERES_GLOG_DIR
LOCAL_SRC_FILES += $(CERES_SRC_PATH)/miniglog/glog/logging.cc
endifLOCAL_MODULE := ceres
include $(BUILD_STATIC_LIBRARY)

3. 下载Eigine并配置到Android.mk中,jni的上级目录运行ndk-build.bat

这篇关于Windows环境下编译Ceres的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1015553

相关文章

阿里开源语音识别SenseVoiceWindows环境部署

SenseVoice介绍 SenseVoice 专注于高精度多语言语音识别、情感辨识和音频事件检测多语言识别: 采用超过 40 万小时数据训练,支持超过 50 种语言,识别效果上优于 Whisper 模型。富文本识别:具备优秀的情感识别,能够在测试数据上达到和超过目前最佳情感识别模型的效果。支持声音事件检测能力,支持音乐、掌声、笑声、哭声、咳嗽、喷嚏等多种常见人机交互事件进行检测。高效推

安装nodejs环境

本文介绍了如何通过nvm(NodeVersionManager)安装和管理Node.js及npm的不同版本,包括下载安装脚本、检查版本并安装特定版本的方法。 1、安装nvm curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash 2、查看nvm版本 nvm --version 3、安装

【IPV6从入门到起飞】5-1 IPV6+Home Assistant(搭建基本环境)

【IPV6从入门到起飞】5-1 IPV6+Home Assistant #搭建基本环境 1 背景2 docker下载 hass3 创建容器4 浏览器访问 hass5 手机APP远程访问hass6 更多玩法 1 背景 既然电脑可以IPV6入站,手机流量可以访问IPV6网络的服务,为什么不在电脑搭建Home Assistant(hass),来控制你的设备呢?@智能家居 @万物互联

高并发环境中保持幂等性

在高并发环境中保持幂等性是一项重要的挑战。幂等性指的是无论操作执行多少次,其效果都是相同的。确保操作的幂等性可以避免重复执行带来的副作用。以下是一些保持幂等性的常用方法: 唯一标识符: 请求唯一标识:在每次请求中引入唯一标识符(如 UUID 或者生成的唯一 ID),在处理请求时,系统可以检查这个标识符是否已经处理过,如果是,则忽略重复请求。幂等键(Idempotency Key):客户端在每次

maven 编译构建可以执行的jar包

💝💝💝欢迎莅临我的博客,很高兴能够在这里和您见面!希望您在这里可以感受到一份轻松愉快的氛围,不仅可以获得有趣的内容和知识,也可以畅所欲言、分享您的想法和见解。 推荐:「stormsha的主页」👈,「stormsha的知识库」👈持续学习,不断总结,共同进步,为了踏实,做好当下事儿~ 专栏导航 Python系列: Python面试题合集,剑指大厂Git系列: Git操作技巧GO

pico2 开发环境搭建-基于ubuntu

pico2 开发环境搭建-基于ubuntu 安装编译工具链下载sdk 和example编译example 安装编译工具链 sudo apt install cmake gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib 注意cmake的版本,需要在3.17 以上 下载sdk 和ex

pip-tools:打造可重复、可控的 Python 开发环境,解决依赖关系,让代码更稳定

在 Python 开发中,管理依赖关系是一项繁琐且容易出错的任务。手动更新依赖版本、处理冲突、确保一致性等等,都可能让开发者感到头疼。而 pip-tools 为开发者提供了一套稳定可靠的解决方案。 什么是 pip-tools? pip-tools 是一组命令行工具,旨在简化 Python 依赖关系的管理,确保项目环境的稳定性和可重复性。它主要包含两个核心工具:pip-compile 和 pip

跨系统环境下LabVIEW程序稳定运行

在LabVIEW开发中,不同电脑的配置和操作系统(如Win11与Win7)可能对程序的稳定运行产生影响。为了确保程序在不同平台上都能正常且稳定运行,需要从兼容性、驱动、以及性能优化等多个方面入手。本文将详细介绍如何在不同系统环境下,使LabVIEW开发的程序保持稳定运行的有效策略。 LabVIEW版本兼容性 LabVIEW各版本对不同操作系统的支持存在差异。因此,在开发程序时,尽量使用

Go Playground 在线编程环境

For all examples in this and the next chapter, we will use Go Playground. Go Playground represents a web service that can run programs written in Go. It can be opened in a web browser using the follow

沁恒CH32在MounRiver Studio上环境配置以及使用详细教程

目录 1.  RISC-V简介 2.  CPU架构现状 3.  MounRiver Studio软件下载 4.  MounRiver Studio软件安装 5.  MounRiver Studio软件介绍 6.  创建工程 7.  编译代码 1.  RISC-V简介         RISC就是精简指令集计算机(Reduced Instruction SetCom