CMakeLists.txt 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. # Sets the minimum version of CMake required to build the native
  2. # library. You should either keep the default value or only pass a
  3. # value of 3.4.0 or lower.
  4. cmake_minimum_required(VERSION 3.6)
  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 it for you.
  8. # Gradle automatically packages shared libraries with your APK.
  9. set(CMAKE_VERBOSE_MAKEFILE on)
  10. set(libs "${CMAKE_SOURCE_DIR}/src/main/jniLibs")
  11. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11 -fexceptions -frtti")
  12. include_directories(${CMAKE_SOURCE_DIR}/src/main/cpp/include)
  13. #--------------------------------------------------- import ---------------------------------------------------#
  14. add_library(libavcodec SHARED IMPORTED )
  15. set_target_properties(libavcodec PROPERTIES
  16. IMPORTED_LOCATION "${libs}/${ANDROID_ABI}/libavcodec.a")
  17. add_library(libavformat SHARED IMPORTED )
  18. set_target_properties(libavformat PROPERTIES
  19. IMPORTED_LOCATION "${libs}/${ANDROID_ABI}/libavformat.a")
  20. add_library(libavutil SHARED IMPORTED )
  21. set_target_properties(libavutil PROPERTIES
  22. IMPORTED_LOCATION "${libs}/${ANDROID_ABI}/libavutil.a")
  23. add_library(libswresample SHARED IMPORTED )
  24. set_target_properties(libswresample PROPERTIES
  25. IMPORTED_LOCATION "${libs}/${ANDROID_ABI}/libswresample.a")
  26. add_library(libswscale SHARED IMPORTED )
  27. set_target_properties(libswscale PROPERTIES
  28. IMPORTED_LOCATION "${libs}/${ANDROID_ABI}/libswscale.a")
  29. add_library(libx264 SHARED IMPORTED )
  30. set_target_properties(libx264 PROPERTIES
  31. IMPORTED_LOCATION "${libs}/${ANDROID_ABI}/libx264.a")
  32. add_library(libyuv SHARED IMPORTED )
  33. set_target_properties(libyuv PROPERTIES
  34. IMPORTED_LOCATION "${libs}/${ANDROID_ABI}/libyuv.a")
  35. add_library( # Sets the name of the library.
  36. rtsp
  37. # Sets the library as a shared library.
  38. SHARED
  39. # Provides a relative path to your source file(s).
  40. # Associated headers in the same location as their source
  41. # file are automatically included.
  42. # src/main/cpp/rtsp.cpp
  43. src/main/cpp/RtspJni.cpp
  44. src/main/cpp/RtspClient.hpp
  45. src/main/cpp/RtspClient.cpp
  46. )
  47. target_link_libraries(
  48. rtsp
  49. android
  50. log
  51. m
  52. z
  53. libavformat
  54. libavcodec
  55. libavutil
  56. libswresample
  57. libswscale
  58. libx264
  59. libyuv
  60. )