File: CMakeLists.txt

package info (click to toggle)
opencv 2.4.9.1%2Bdfsg-1%2Bdeb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 126,800 kB
  • ctags: 62,729
  • sloc: xml: 509,055; cpp: 490,794; lisp: 23,208; python: 21,174; java: 19,317; ansic: 1,038; sh: 128; makefile: 72
file content (45 lines) | stat: -rw-r--r-- 2,069 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
IF(NOT ANDROID OR ANDROID_NATIVE_API_LEVEL LESS 8)
  ocv_module_disable(androidcamera)
ENDIF()

set(the_description "Auxiliary module for Android native camera support")
set(OPENCV_MODULE_TYPE STATIC)

ocv_define_module(androidcamera INTERNAL opencv_core log dl)
ocv_include_directories("${CMAKE_CURRENT_SOURCE_DIR}/camera_wrapper" "${OpenCV_SOURCE_DIR}/platforms/android/service/engine/jni/include")

# Android source tree for native camera
SET (ANDROID_SOURCE_TREE "ANDROID_SOURCE_TREE-NOTFOUND" CACHE PATH
  "Path to Android source tree. Set this variable to path to your Android sources to compile libnative_camera_rx.x.x.so for your Android")
SET(BUILD_ANDROID_CAMERA_WRAPPER OFF)
if(ANDROID_SOURCE_TREE)
  FILE(STRINGS "${ANDROID_SOURCE_TREE}/development/sdk/platform_source.properties" ANDROID_VERSION REGEX "Platform\\.Version=[0-9]+\\.[0-9]+(\\.[0-9]+)?" )
  string(REGEX REPLACE "Platform\\.Version=([0-9]+\\.[0-9]+(\\.[0-9]+)?)" "\\1" ANDROID_VERSION "${ANDROID_VERSION}")
  if(ANDROID_VERSION MATCHES "^[0-9]+\\.[0-9]+$")
    SET(ANDROID_VERSION "${ANDROID_VERSION}.0")
  endif()
  if(NOT "${ANDROID_VERSION}" STREQUAL "")
    SET(BUILD_ANDROID_CAMERA_WRAPPER ON)
    set(ANDROID_VERSION "${ANDROID_VERSION}" CACHE INTERNAL "Version of Android source tree")
  endif()
endif()
set(BUILD_ANDROID_CAMERA_WRAPPER ${BUILD_ANDROID_CAMERA_WRAPPER} CACHE INTERNAL "Build new wrapper for Android")
MARK_AS_ADVANCED(ANDROID_SOURCE_TREE)

# process wrapper libs
if(BUILD_ANDROID_CAMERA_WRAPPER)
  add_subdirectory(camera_wrapper)
else()
  file(GLOB camera_wrappers "${CMAKE_CURRENT_SOURCE_DIR}/../../3rdparty/lib/${ANDROID_NDK_ABI_NAME}/libnative_camera_r*.so")

  foreach(wrapper ${camera_wrappers})
    ADD_CUSTOM_COMMAND(
      TARGET ${the_module} POST_BUILD
      COMMAND ${CMAKE_COMMAND} -E copy "${wrapper}" "${LIBRARY_OUTPUT_PATH}"
      )
    get_filename_component(wrapper_name "${wrapper}" NAME)
    install(FILES "${LIBRARY_OUTPUT_PATH}/${wrapper_name}"
            DESTINATION ${OPENCV_LIB_INSTALL_PATH}
            COMPONENT libs)
  endforeach()
endif()