序言
基础版:https://blog.csdn.net/qq_41811438/article/details/103323128
升级版:https://blog.csdn.net/qq_41811438/article/details/103323497
这篇文章主要是在升级版的基础上,进行完善。目前我觉得这样的配置已经够用了。以此作为最终版,以备忘。
正文
1、CMakeLists.txt文件源码如下:
cmake_minimum_required(VERSION 3.4.1)
set(LOCAL_MODULE DemoTest) # Specify the name of so that you will generate.
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/SharedLibs/${ANDROID_ABI})
include_directories(${PROJECT_SOURCE_DIR}/Math/inc)
aux_source_directory(${PROJECT_SOURCE_DIR}/Math/src SRC_FILES_LIST)
MESSAGE(STATUS "Jimmy:")
MESSAGE(STATUS ${SRC_FILES_LIST})
add_library(${LOCAL_MODULE}
SHARED
# Following , the same as LOCAL_SRC_FILES in Android.mk
JNI.cpp ${SRC_FILES_LIST})
target_link_libraries(${LOCAL_MODULE}
# Link the other so(dll).
log )
2、app目录下的build.gradle文件配置:
//jimmy add for ndk specified //
defaultConfig.externalNativeBuild.cmake{
abiFilters 'armeabi-v7a'
}
externalNativeBuild {
cmake {
path 'src/main/jni/CMakeLists.txt'
}
}
//
备注:
MESSAGE(STATUS "Jimmy:" "hi" "world") MESSAGE(STATUS "Include Files Folders: " ${PROJECT_SOURCE_DIR})
用来打印信息,以便于发现宏值是否有错!!!!
工程架构目录,部分截图:
---- The End.