我正在试图编译一个名为Eigen的本地外部库(包含.h文件),以便在我的App项目中使用它。为此,我尝试使用本指南Configure CMake配置我的CMakeList.txt文件。我一直在阅读很多博客和论坛,但由于我在Android NDK上很新,我不明白这些:
我在CMakeLists.txt中需要做哪些更改? 我试过补充说:
//Sets lib_src_DIR to the path of the target CMake project.
set( Eigen_src_DIR ../Eigen )
//Sets lib_build_DIR to the path of the desired output directory.
set( lib_build_DIR ../Eigen/output)
file(MAKE_DIRECTORY ${lib_build_DIR})
//Adds the CMakeLists.txt file located in the specified directory
// as a build dependency.
add_subdirectory( # Specifies the directory of the CMakeLists.txt file.
${lib_src_DIR}
# Specifies the directory for the build outputs.
${lib_build_DIR})
// Adds the output of the additional CMake build as a prebuilt static library and names it lib_gmath.
add_library( lib_eigen STATIC IMPORTED )
set_target_properties( lib_eigen PROPERTIES IMPORTED_LOCATION
${lib_build_DIR}/${ANDROID_ABI}/lib_eigen.a )
include_directories( ${lib_src_DIR}/Eigen )
我已将此库中的文件夹放在../app/Eigen