CMakeLists.txt 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. set(TARGET smart_cropper)
  6. set(SRC_DIR src/main/cpp/)
  7. set(OPENCV_LIB_DIR opencv/lib/${ANDROID_ABI}/)
  8. set(OPENCV_3RD_LIB_DIR opencv/3rdparty/${ANDROID_ABI}/)
  9. include_directories(opencv/include
  10. src/main/cpp/include)
  11. link_directories(${OPENCV_LIB_DIR}
  12. ${OPENCV_3RD_LIB_DIR})
  13. # Creates and names a library, sets it as either STATIC
  14. # or SHARED, and provides the relative paths to its source code.
  15. # You can define multiple libraries, and CMake builds them for you.
  16. # Gradle automatically packages shared libraries with your APK.
  17. aux_source_directory(${SRC_DIR} DIR_LIB_SOURCE)
  18. add_library(${TARGET} SHARED ${DIR_LIB_SOURCE})
  19. # Searches for a specified prebuilt library and stores the path as a
  20. # variable. Because CMake includes system libraries in the search path by
  21. # default, you only need to specify the name of the public NDK library
  22. # you want to add. CMake verifies that the library exists before
  23. # completing its build.
  24. target_link_libraries(${TARGET} log jnigraphics z)
  25. # Specifies libraries CMake should link to your target library. You
  26. # can link multiple libraries, such as libraries you define in this
  27. # build script, prebuilt third-party libraries, or system libraries.
  28. if(${ANDROID_ABI} STREQUAL x86 OR ${ANDROID_ABI} STREQUAL x86_64)
  29. target_link_libraries(${TARGET} opencv_imgproc opencv_core ippiw ippicv ittnotify tbb cpufeatures)
  30. else()
  31. target_link_libraries(${TARGET} opencv_imgproc opencv_core tegra_hal tbb cpufeatures)
  32. endif()