# For more information about using CMake with Android Studio, read the
# documentation: https://d.android.com/studio/projects/add-native-code.html
# Sets the minimum version of CMake required to build the native library.
cmake_minimum_required(VERSION 3.4.1)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/src/jniLibs/${ANDROID_ABI})
#添加子目录,将自动找到子目录中的CMakeLists.txt
ADD_SUBDIRECTORY(${PROJECT_SOURCE_DIR}/src/main/cpp/firstsub)
#ADD_SUBDIRECTORY(${PROJECT_SOURCE_DIR}/src/cpp/two)
#ADD_SUBDIRECTORY(${PROJECT_SOURCE_DIR}/src/cpp/three)
```
TestObject test = new TestObject();
test.name = "new name.";
Log.d(LOG_TAG, "" + nameFromJNI(test));
Log.d(LOG_TAG, "file content is " + getFileContent(FILE_PATH));
classFromJNI();
firstFromJNI();
```
# 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).
src/main/cpp/native-lib.c src/main/cpp/native-lib.cpp)
# Searches for a specified prebuilt library and stores the path as a
# variable. Because CMake includes system libraries in the search path by
# default, you only need to specify the name of the public NDK library
# you want to add. CMake verifies that the library exists before
# completing its build.
find_library( # Sets the name of the path variable.
log-lib
# Specifies the name of the NDK library that
# you want CMake to locate.
log )
# Specifies libraries CMake should link to your target library. You
# can link multiple libraries, such as libraries you define in this
# build script, prebuilt third-party libraries, or system libraries.
message("PROJECT_SOURCE_DIR is " + ${PROJECT_SOURCE_DIR})
target_link_libraries( # Specifies the target library.
native-lib
first
jnigraphics
# Links the target library to the log library
# included in the NDK.
${log-lib} )
2020-04-14
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- Wisdom is oftentimes nearer when we stoop than when we so...
- 《经济法基础》高频考点解读-考前冲刺题 单选题 [if !supportLists]1.[endif]下列说法不正...
- 本文目标 将git上面的项目导入到eclipse中 步骤: 1.进入到git中选择需要下载的项目,点击对应...