android: allow to build & run examples without Android OpenCV Manager

This commit is contained in:
Alexander Alekhin
2014-06-05 12:29:36 +04:00
parent 3f485d58bb
commit 15b6fd2ec4
12 changed files with 82 additions and 9 deletions

View File

@@ -335,6 +335,16 @@ macro(add_android_project target path)
add_dependencies(${target} ${android_proj_native_deps})
endif()
if(ANDROID_EXAMPLES_WITH_LIBS)
add_custom_target(
${target}_copy_libs
COMMAND ${CMAKE_COMMAND} -DSRC_DIR=${OpenCV_BINARY_DIR}/lib -DDST_DIR=${android_proj_bin_dir}/libs -P ${OpenCV_SOURCE_DIR}/cmake/copyAndroidLibs.cmake
WORKING_DIRECTORY ${OpenCV_BINARY_DIR}/lib
DEPENDS "${OpenCV_BINARY_DIR}/bin/classes.jar.dephelper" opencv_java
)
add_dependencies(${target} ${target}_copy_libs)
endif()
if(__android_project_chain)
add_dependencies(${target} ${__android_project_chain})
endif()

View File

@@ -0,0 +1,8 @@
# helper file for Android samples build
file(GLOB_RECURSE LIBS RELATIVE ${SRC_DIR} "*.so")
foreach(l ${LIBS})
message(STATUS " Copying: ${l} ...")
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SRC_DIR}/${l} ${DST_DIR}/${l})
endforeach()