2011-06-30 21:37:56 +08:00
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
# CMake file for Android samples. See root CMakeLists.txt
|
|
|
|
#
|
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
|
2011-07-04 16:18:02 +08:00
|
|
|
if (BUILD_ANDROID_EXAMPLES)
|
2011-06-30 21:37:56 +08:00
|
|
|
project(android_samples)
|
|
|
|
|
|
|
|
include_directories(
|
|
|
|
"${CMAKE_SOURCE_DIR}/modules/core/include"
|
|
|
|
"${CMAKE_SOURCE_DIR}/modules/flann/include"
|
|
|
|
"${CMAKE_SOURCE_DIR}/modules/imgproc/include"
|
|
|
|
"${CMAKE_SOURCE_DIR}/modules/video/include"
|
|
|
|
"${CMAKE_SOURCE_DIR}/modules/highgui/include"
|
|
|
|
"${CMAKE_SOURCE_DIR}/modules/ml/include"
|
|
|
|
"${CMAKE_SOURCE_DIR}/modules/calib3d/include"
|
|
|
|
"${CMAKE_SOURCE_DIR}/modules/features2d/include"
|
|
|
|
"${CMAKE_SOURCE_DIR}/modules/objdetect/include"
|
|
|
|
"${CMAKE_SOURCE_DIR}/modules/legacy/include"
|
|
|
|
"${CMAKE_SOURCE_DIR}/modules/contrib/include"
|
|
|
|
)
|
|
|
|
|
|
|
|
SET (sample_dependencies opencv_contrib opencv_legacy opencv_objdetect opencv_calib3d opencv_features2d opencv_video opencv_highgui opencv_ml opencv_imgproc opencv_flann opencv_core)
|
|
|
|
if(NOT BUILD_SHARED_LIBS)
|
|
|
|
LIST(APPEND sample_dependencies opencv_androidcamera)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
file(GLOB android_samples RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *)
|
2011-07-01 21:12:05 +08:00
|
|
|
list(REMOVE_ITEM android_samples hello-android)
|
2011-06-30 21:37:56 +08:00
|
|
|
list(SORT android_samples)
|
2011-07-04 14:33:10 +08:00
|
|
|
|
2011-06-30 21:37:56 +08:00
|
|
|
foreach(sample ${android_samples})
|
2011-07-25 04:44:20 +08:00
|
|
|
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${sample}/AndroidManifest.xml")
|
2011-07-25 21:17:11 +08:00
|
|
|
add_android_project("${sample}" "${CMAKE_CURRENT_SOURCE_DIR}/${sample}" INSTALL)
|
2011-06-30 21:37:56 +08:00
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
|
2011-07-01 21:12:05 +08:00
|
|
|
#hello-android sample
|
2011-07-04 16:18:02 +08:00
|
|
|
ADD_EXECUTABLE(hello-android hello-android/main.cpp)
|
2011-07-01 21:12:05 +08:00
|
|
|
ADD_DEPENDENCIES(hello-android ${sample_dependencies})
|
|
|
|
TARGET_LINK_LIBRARIES(hello-android ${OPENCV_LINKER_LIBS} ${sample_dependencies})
|
|
|
|
set_target_properties(hello-android PROPERTIES OUTPUT_NAME hello-android RUNTIME_OUTPUT_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}")
|
2011-07-12 23:59:31 +08:00
|
|
|
if(INSTALL_ANDROID_EXAMPLES)
|
|
|
|
install(TARGETS hello-android DESTINATION bin COMPONENT main)
|
|
|
|
endif()
|
2011-07-01 21:12:05 +08:00
|
|
|
|
2011-06-30 21:37:56 +08:00
|
|
|
endif()
|