android studio CMake NDK: Configuration notes

Download: Download the SDK-Tool in CMake, LLDB, NDK.

 

 

 

 

Project Creation

 

 

 

 

 

 The last two pages of this configuration also chosen to facilitate debugging.

 

 

Configure the output format and path name of the library and the library:

1.配置CMakeLists.txt

# Set the minimum requirements CMake compile-time version 
cmake_minimum_required (VERSION 3.4.1)

Path Set # dynamic library so generated final output 
#set (CMAKE_LIBRARY_OUTPUT_DIRECTORY PROJECT_SOURCE_DIR} {$ /../ jniLibs / ANDROID_ABI $ {})
add_library (
library # name added
      test-lib
        # Type library: SHARED represents the dynamic library so, STATIC represents a static library 
      SHARED
# cpp file to compile the source file path
      src / main / cpp / Native-lib.cpp)

# Set NDK local library you want to use a reference library name
find_library (Sets # The name of The path variable. 
log-lib

# The name of The Specifies that the NDK Library
# you want to CMake the locate.
log)

# Set the target library so generated, the library to be associated
target_link_libraries( # Specifies the target library.
test-lib

# Links the target library to the log library
# included in the NDK.
${log-lib})

2. gradle configuration file, specify the library so CPU Framework

 

 

 

 

 

 

Guess you like

Origin www.cnblogs.com/suxiaoqi/p/12457818.html