CMakeLists.txt 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  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. add_library( # Sets the name of the library.
  10. gb_native
  11. # Sets the library as a shared library.
  12. SHARED
  13. # Provides a relative path to your source file(s).
  14. src/main/cpp/gb_native.cpp
  15. src/main/cpp/filterUtil.c
  16. src/main/cpp/gb28181_muxer.cpp
  17. src/main/cpp/gb28181_sender.cpp
  18. src/main/cpp/threadsafe_queue.cpp
  19. src/main/cpp/mpeg-ps-enc.c
  20. src/main/cpp/psh/mpeg-pack-header.c
  21. src/main/cpp/psh/mpeg-system-header.c
  22. src/main/cpp/psh/mpeg-psm.c
  23. src/main/cpp/psh/mpeg-pes.c
  24. src/main/cpp/psh/mpeg-util.c
  25. src/main/cpp/psh/mpeg-element-descriptor.c
  26. src/main/cpp/psh/mpeg-crc32.c
  27. src/main/cpp/psh/mpeg-ps-dec.c
  28. src/main/cpp/psh/mpeg-psd.c
  29. src/main/cpp/psh/mpeg-packet.c
  30. src/main/cpp/psh/mpeg-ts-h264.c
  31. src/main/cpp/psh/mpeg-ts-h265.c
  32. src/main/cpp/rtp/rtp-h264-pack.c
  33. src/main/cpp/rtp/rtp-payload.c
  34. src/main/cpp/rtp/rtp-packet.c
  35. src/main/cpp/rtp/rtp-h264-bitstream.c
  36. src/main/cpp/rtp/rtp-h264-unpack.c
  37. src/main/cpp/rtp/rtp-h265-unpack.c
  38. src/main/cpp/rtp/rtp-h265-pack.c
  39. src/main/cpp/rtp/rtp-mp4v-es-unpack.c
  40. src/main/cpp/rtp/rtp-mp4v-es-pack.c
  41. src/main/cpp/rtp/rtp-ts-pack.c
  42. src/main/cpp/rtp/rtp-ts-unpack.c
  43. src/main/cpp/rtp/rtp-ps-unpack.c
  44. src/main/cpp/rtp/rtp-payload-helper.c
  45. src/main/cpp/rtp_hn/RTPPacketAnalysis.cpp
  46. src/main/cpp/rtp_hn/PSAnalysis.cpp
  47. )
  48. add_library(
  49. avcodec
  50. SHARED
  51. IMPORTED
  52. )
  53. add_library(
  54. avfilter
  55. SHARED
  56. IMPORTED
  57. )
  58. add_library(
  59. avformat
  60. SHARED
  61. IMPORTED
  62. )
  63. add_library(
  64. avutil
  65. SHARED
  66. IMPORTED
  67. )
  68. add_library(
  69. swresample
  70. SHARED
  71. IMPORTED
  72. )
  73. add_library(
  74. swscale
  75. SHARED
  76. IMPORTED
  77. )
  78. if(${ANDROID_ABI} STREQUAL "arm64-v8a")
  79. set_target_properties(
  80. avcodec
  81. PROPERTIES IMPORTED_LOCATION
  82. ${CMAKE_SOURCE_DIR}/src/main/jniLibs/arm64-v8a/libavcodec.so
  83. )
  84. set_target_properties(
  85. avfilter
  86. PROPERTIES IMPORTED_LOCATION
  87. ${CMAKE_SOURCE_DIR}/src/main/jniLibs/arm64-v8a/libavfilter.so
  88. )
  89. set_target_properties(
  90. avformat
  91. PROPERTIES IMPORTED_LOCATION
  92. ${CMAKE_SOURCE_DIR}/src/main/jniLibs/arm64-v8a/libavformat.so
  93. )
  94. set_target_properties(
  95. avutil
  96. PROPERTIES IMPORTED_LOCATION
  97. ${CMAKE_SOURCE_DIR}/src/main/jniLibs/arm64-v8a/libavutil.so
  98. )
  99. set_target_properties(
  100. swresample
  101. PROPERTIES IMPORTED_LOCATION
  102. ${CMAKE_SOURCE_DIR}/src/main/jniLibs/arm64-v8a/libswresample.so
  103. )
  104. set_target_properties(
  105. swscale
  106. PROPERTIES IMPORTED_LOCATION
  107. ${CMAKE_SOURCE_DIR}/src/main/jniLibs/arm64-v8a/libswscale.so
  108. )
  109. set_target_properties(
  110. swscale
  111. PROPERTIES IMPORTED_LOCATION
  112. ${CMAKE_SOURCE_DIR}/src/main/jniLibs/arm64-v8a/libpostproc.so
  113. )
  114. endif(${ANDROID_ABI} STREQUAL "arm64-v8a")
  115. if(${ANDROID_ABI} STREQUAL "armeabi-v7a")
  116. set_target_properties(
  117. avcodec
  118. PROPERTIES IMPORTED_LOCATION
  119. ${CMAKE_SOURCE_DIR}/src/main/jniLibs/armeabi-v7a/libavcodec.so
  120. )
  121. set_target_properties(
  122. avfilter
  123. PROPERTIES IMPORTED_LOCATION
  124. ${CMAKE_SOURCE_DIR}/src/main/jniLibs/armeabi-v7a/libavfilter.so
  125. )
  126. set_target_properties(
  127. avformat
  128. PROPERTIES IMPORTED_LOCATION
  129. ${CMAKE_SOURCE_DIR}/src/main/jniLibs/armeabi-v7a/libavformat.so
  130. )
  131. set_target_properties(
  132. avutil
  133. PROPERTIES IMPORTED_LOCATION
  134. ${CMAKE_SOURCE_DIR}/src/main/jniLibs/armeabi-v7a/libavutil.so
  135. )
  136. set_target_properties(
  137. swresample
  138. PROPERTIES IMPORTED_LOCATION
  139. ${CMAKE_SOURCE_DIR}/src/main/jniLibs/armeabi-v7a/libswresample.so
  140. )
  141. set_target_properties(
  142. swscale
  143. PROPERTIES IMPORTED_LOCATION
  144. ${CMAKE_SOURCE_DIR}/src/main/jniLibs/armeabi-v7a/libswscale.so
  145. )
  146. set_target_properties(
  147. swscale
  148. PROPERTIES IMPORTED_LOCATION
  149. ${CMAKE_SOURCE_DIR}/src/main/jniLibs/armeabi-v7a/libpostproc.so
  150. )
  151. endif(${ANDROID_ABI} STREQUAL "armeabi-v7a")
  152. #include_directories(
  153. # ${CMAKE_SOURCE_DIR}/ffmpeg-3.2.5/
  154. #)
  155. # Searches for a specified prebuilt library and stores the path as a
  156. # variable. Because CMake includes system libraries in the search path by
  157. # default, you only need to specify the name of the public NDK library
  158. # you want to add. CMake verifies that the library exists before
  159. # completing its build.
  160. find_library( # Sets the name of the path variable.
  161. log-lib
  162. # Specifies the name of the NDK library that
  163. # you want CMake to locate.
  164. log )
  165. # Specifies libraries CMake should link to your target library. You
  166. # can link multiple libraries, such as libraries you define in this
  167. # build script, prebuilt third-party libraries, or system libraries.
  168. target_link_libraries( # Specifies the target library.
  169. gb_native
  170. avcodec
  171. avfilter
  172. avformat
  173. avutil
  174. swresample
  175. swscale
  176. # Links the target library to the log library
  177. # included in the NDK.
  178. ${log-lib} )