我需要为Android项目构建csparse library。该项目支持Make构建系统。
我对使用NDK进行制作构建不熟悉。我已经使用Androids [[CMake工具链构建基于CMake的项目。
我正在寻找使用NDK来基于Make构建C ++项目的指针。我不想手动编写CMakeLists.txt来使用CMake工具链构建项目,因为csparse项目中的源文件太多!感谢您的任何帮助!
这是我的Android项目中的CMakeLists.txt文件:
cmake_minimum_required(VERSION 3.4.1)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/include/CSparse/Source
)
add_library( # Sets the name of the library.
csparse-lib
# Sets the library as a shared library.
SHARED
# Provides a relative path to your source file(s).
include/CSparse/Source/cs_add.c
include/CSparse/Source/cs_amd.c
include/CSparse/Source/cs_chol.c
include/CSparse/Source/cs_cholsol.c
include/CSparse/Source/cs_compress.c
include/CSparse/Source/cs_counts.c
include/CSparse/Source/cs_cumsum.c
include/CSparse/Source/cs_dfs.c
include/CSparse/Source/cs_dmperm.c
include/CSparse/Source/cs_droptol.c
include/CSparse/Source/cs_dropzeros.c
include/CSparse/Source/cs_dupl.c
include/CSparse/Source/cs_entry.c
include/CSparse/Source/cs_ereach.c
include/CSparse/Source/cs_etree.c
include/CSparse/Source/cs_fkeep.c
include/CSparse/Source/cs_gaxpy.c
include/CSparse/Source/cs_happly.c
include/CSparse/Source/cs_house.c
include/CSparse/Source/cs_ipvec.c
include/CSparse/Source/cs_leaf.c
include/CSparse/Source/cs_load.c
include/CSparse/Source/cs_lsolve.c
include/CSparse/Source/cs_ltsolve.c
include/CSparse/Source/cs_lu.c
include/CSparse/Source/cs_lusol.c
include/CSparse/Source/cs_malloc.c
include/CSparse/Source/cs_maxtrans.c
include/CSparse/Source/cs_multiply.c
include/CSparse/Source/cs_norm.c
include/CSparse/Source/cs_permute.c
include/CSparse/Source/cs_pinv.c
include/CSparse/Source/cs_post.c
include/CSparse/Source/cs_print.c
include/CSparse/Source/cs_pvec.c
include/CSparse/Source/cs_qr.c
include/CSparse/Source/cs_qrsol.c
include/CSparse/Source/cs_randperm.c
include/CSparse/Source/cs_reach.c
include/CSparse/Source/cs_scatter.c
include/CSparse/Source/cs_scc.c
include/CSparse/Source/cs_schol.c
include/CSparse/Source/cs_spsolve.c
include/CSparse/Source/cs_sqr.c
include/CSparse/Source/cs_symperm.c
include/CSparse/Source/cs_tdfs.c
include/CSparse/Source/cs_transpose.c
include/CSparse/Source/cs_updown.c
include/CSparse/Source/cs_usolve.c
include/CSparse/Source/cs_util.c
include/CSparse/Source/cs_utsolve.c
)
add_library(native-lib SHARED native-lib.cpp)
find_library( # Sets the name of the path variable.
log-lib
log)
target_link_libraries( # Specifies the target library.
native-lib
# Links the target library to the log library
# included in the NDK.
${log-lib}
csparse-lib
)
我希望这个答案对其他人有帮助。