CMakeLists.txt 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. # For more information about using CMake with Android Studio, read the
  2. # documentation: https://d.android.com/studio/projects/add-native-code.html
  3. # Sets the minimum version of CMake required to build the native library.
  4. cmake_minimum_required(VERSION 3.4.1)
  5. # Creates and names a library, sets it as either STATIC
  6. # or SHARED, and provides the relative paths to its source code.
  7. # You can define multiple libraries, and CMake builds them for you.
  8. # Gradle automatically packages shared libraries with your APK.
  9. set(PUBLISH TRUE)
  10. include_directories(src/main/cpp/third_part/buffer)
  11. include_directories(src/main/cpp/third_part/kit)
  12. aux_source_directory(src/main/cpp/ DIR_SOURCE)
  13. aux_source_directory(src/main/cpp/third_part/buffer DIR_BUFFER)
  14. add_library(
  15. dolin-zap
  16. SHARED
  17. ${DIR_SOURCE}
  18. ${DIR_BUFFER}
  19. )
  20. #动态方式加载 STATIC:表示静态的.a的库 SHARED:表示.so的库
  21. #add_library(dolin-comm SHARED IMPORTED)
  22. #设置要连接的so的相对路径
  23. #${CMAKE_SOURCE_DIR}:表示CMake.txt的当前文件夹路径
  24. #${ANDROID_ABI}:编译时会自动根据CPU架构去选择相应的库
  25. #set_target_properties(dolin-comm PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/../soLibs/comm/${ANDROID_ABI}/libdolin-comm.so)
  26. #if (${PUBLISH})
  27. # #set_target_properties(dolin-comm PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/../soLibs/comm/${ANDROID_ABI}/libdolin-comm.so)
  28. #else ()
  29. # set_target_properties(dolin-comm PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/../soLibs/comm/${ANDROID_ABI}/libdolin-comm.so)
  30. #endif ()
  31. ##添加第三方头文件
  32. #target_include_directories(dolin-zap PRIVATE ${CMAKE_SOURCE_DIR}/src/main/cpp/third_part)
  33. # Searches for a specified prebuilt library and stores the path as a
  34. # variable. Because CMake includes system libraries in the search path by
  35. # default, you only need to specify the name of the public NDK library
  36. # you want to add. CMake verifies that the library exists before
  37. # completing its build.
  38. find_library( # Sets the name of the path variable.
  39. log-lib
  40. # Specifies the name of the NDK library that
  41. # you want CMake to locate.
  42. log)
  43. # Specifies libraries CMake should link to your target library. You
  44. # can link multiple libraries, such as libraries you define in this
  45. # build script, prebuilt third-party libraries, or system libraries.
  46. target_link_libraries( # Specifies the target library.
  47. dolin-zap
  48. # dolin-comm
  49. # Links the target library to the log library
  50. # included in the NDK.
  51. ${log-lib})