1. defaultConfig {
externalNativeBuild {
cmake {
arguments '-DANDROID_STL=c++_static'
cppFlags "-std=c++14"
}
}
}
2.cmakelist
# 设置include文件夹的地址
include_directories(${CMAKE_SOURCE_DIR}/src/main/cpp/include/)
set(CMAKE_VERBOSE_MAKEFILE on)
aux_source_directory(. DIR_LIB_SRCS)
aux_source_directory(./object_tracking OTHER_SRC_LIST)
list(APPEND DIR_LIB_SRCS ${OTHER_SRC_LIST})
# Creates and names a library, sets it as either STATIC
# or SHARED, and provides the relative paths to its source code.
# You can define multiple libraries, and CMake builds them for you.
# Gradle automatically packages shared libraries with your APK.
add_library( # Sets the name of the library.
native-lib
# Sets the library as a shared library.
SHARED
# Provides a relative path to your source file(s).
${DIR_LIB_SRCS}
)