1if(ANDROID)
2  # --------------------------------------------------------------------------------------------
3  #  Installation for Android ndk-build makefile:  OpenCV.mk
4  #  Part 1/2: ${BIN_DIR}/OpenCV.mk              -> For use *without* "make install"
5  #  Part 2/2: ${BIN_DIR}/unix-install/OpenCV.mk -> For use with "make install"
6  # -------------------------------------------------------------------------------------------
7
8  # build type
9  if(BUILD_SHARED_LIBS)
10    set(OPENCV_LIBTYPE_CONFIGMAKE "SHARED")
11  else()
12    set(OPENCV_LIBTYPE_CONFIGMAKE "STATIC")
13  endif()
14
15  if(BUILD_FAT_JAVA_LIB)
16    set(OPENCV_LIBTYPE_CONFIGMAKE "SHARED")
17    set(OPENCV_STATIC_LIBTYPE_CONFIGMAKE "STATIC")
18  else()
19    set(OPENCV_STATIC_LIBTYPE_CONFIGMAKE ${OPENCV_LIBTYPE_CONFIGMAKE})
20  endif()
21
22  # build the list of opencv libs and dependencies for all modules
23  ocv_get_all_libs(OPENCV_MODULES_CONFIGMAKE OPENCV_EXTRA_COMPONENTS_CONFIGMAKE OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE)
24
25  # list -> string
26  string(REPLACE ";" " " OPENCV_MODULES_CONFIGMAKE "${OPENCV_MODULES_CONFIGMAKE}")
27  string(REPLACE ";" " " OPENCV_EXTRA_COMPONENTS_CONFIGMAKE "${OPENCV_EXTRA_COMPONENTS_CONFIGMAKE}")
28  string(REPLACE ";" " " OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE "${OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE}")
29
30  # replace 'opencv_<module>' -> '<module>''
31  string(REPLACE "opencv_" "" OPENCV_MODULES_CONFIGMAKE "${OPENCV_MODULES_CONFIGMAKE}")
32
33
34  # prepare 3rd-party component list without TBB for armeabi and mips platforms. TBB is useless there.
35  set(OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE_NO_TBB ${OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE})
36  foreach(mod ${OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE_NO_TBB})
37     string(REPLACE "tbb" "" OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE_NO_TBB "${OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE_NO_TBB}")
38  endforeach()
39
40  if(BUILD_FAT_JAVA_LIB)
41    set(OPENCV_LIBS_CONFIGMAKE java3)
42  else()
43    set(OPENCV_LIBS_CONFIGMAKE "${OPENCV_MODULES_CONFIGMAKE}")
44  endif()
45
46  # -------------------------------------------------------------------------------------------
47  #  Part 1/2: ${BIN_DIR}/OpenCV.mk              -> For use *without* "make install"
48  # -------------------------------------------------------------------------------------------
49  set(OPENCV_INCLUDE_DIRS_CONFIGCMAKE "\"${OPENCV_CONFIG_FILE_INCLUDE_DIR}\" \"${OpenCV_SOURCE_DIR}/include\" \"${OpenCV_SOURCE_DIR}/include/opencv\"")
50  set(OPENCV_BASE_INCLUDE_DIR_CONFIGCMAKE "\"${OpenCV_SOURCE_DIR}\"")
51  set(OPENCV_LIBS_DIR_CONFIGCMAKE "\$(OPENCV_THIS_DIR)/lib/\$(OPENCV_TARGET_ARCH_ABI)")
52  set(OPENCV_3RDPARTY_LIBS_DIR_CONFIGCMAKE "\$(OPENCV_THIS_DIR)/3rdparty/lib/\$(OPENCV_TARGET_ARCH_ABI)")
53
54  configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCV.mk.in" "${CMAKE_BINARY_DIR}/OpenCV.mk" @ONLY)
55
56  # -------------------------------------------------------------------------------------------
57  #  Part 2/2: ${BIN_DIR}/unix-install/OpenCV.mk -> For use with "make install"
58  # -------------------------------------------------------------------------------------------
59  set(OPENCV_INCLUDE_DIRS_CONFIGCMAKE "\"\$(LOCAL_PATH)/\$(OPENCV_THIS_DIR)/include/opencv\" \"\$(LOCAL_PATH)/\$(OPENCV_THIS_DIR)/include\"")
60  set(OPENCV_BASE_INCLUDE_DIR_CONFIGCMAKE "")
61  set(OPENCV_LIBS_DIR_CONFIGCMAKE "\$(OPENCV_THIS_DIR)/../libs/\$(OPENCV_TARGET_ARCH_ABI)")
62  set(OPENCV_3RDPARTY_LIBS_DIR_CONFIGCMAKE "\$(OPENCV_THIS_DIR)/../3rdparty/libs/\$(OPENCV_TARGET_ARCH_ABI)")
63
64  configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCV.mk.in" "${CMAKE_BINARY_DIR}/unix-install/OpenCV.mk" @ONLY)
65  install(FILES ${CMAKE_BINARY_DIR}/unix-install/OpenCV.mk DESTINATION ${OPENCV_CONFIG_INSTALL_PATH} COMPONENT dev)
66endif(ANDROID)
67