CMakeLists.txt 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. #设置库文件的输出目录
  10. set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/../soLibs/comm/${ANDROID_ABI})
  11. include_directories(src/main/cpp/r4log)
  12. include_directories(src/main/cpp/comm)
  13. #######################################
  14. # libdolin-comm.so
  15. #######################################
  16. aux_source_directory(src/main/cpp/comm COMM_SRC)
  17. #aux_source_directory(src/main/cpp/ DIR_SOURCE)
  18. #aux_source_directory(src/main/cpp/buffer DIR_SOURCE_BUFFER)
  19. #aux_source_directory(src/main/cpp/comm DIR_SOURCE_KIT)
  20. add_library(
  21. dolin-comm
  22. SHARED
  23. ${COMM_SRC}
  24. )
  25. # Searches for a specified prebuilt library and stores the path as a
  26. # variable. Because CMake includes system libraries in the search path by
  27. # default, you only need to specify the name of the public NDK library
  28. # you want to add. CMake verifies that the library exists before
  29. # completing its build.
  30. find_library( # Sets the name of the path variable.
  31. log-lib
  32. # Specifies the name of the NDK library that
  33. # you want CMake to locate.
  34. log)
  35. # Specifies libraries CMake should link to your target library. You
  36. # can link multiple libraries, such as libraries you define in this
  37. # build script, prebuilt third-party libraries, or system libraries.
  38. target_link_libraries( # Specifies the target library.
  39. dolin-comm
  40. # Links the target library to the log library
  41. # included in the NDK.
  42. ${log-lib})
  43. #######################################
  44. # libdolin-comm.so
  45. #######################################
  46. aux_source_directory(src/main/cpp/r4log R4LOG_SRC)
  47. add_library(
  48. dolin-r4log
  49. SHARED
  50. ${R4LOG_SRC}
  51. )
  52. # Specifies libraries CMake should link to your target library. You
  53. # can link multiple libraries, such as libraries you define in this
  54. # build script, prebuilt third-party libraries, or system libraries.
  55. target_link_libraries( # Specifies the target library.
  56. dolin-r4log
  57. # Links the target library to the log library
  58. # included in the NDK.
  59. ${log-lib})