1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 15:53:03 +04:00

Reworked build scripts for Android Java API, tests and examples

This commit is contained in:
Andrey Kamaev
2012-03-27 16:05:52 +00:00
parent 3b5b20b795
commit e72a23243b
33 changed files with 305 additions and 264 deletions
+6
View File
@@ -0,0 +1,6 @@
set(sample example-15-puzzle)
add_android_project(${sample} "${CMAKE_CURRENT_SOURCE_DIR}" LIBRARY_DEPS ${OpenCV_BINARY_DIR} SDK_TARGET 11 ${ANDROID_SDK_TARGET})
if(TARGET ${sample})
add_dependencies(opencv_android_examples ${sample})
endif()
@@ -1,3 +0,0 @@
android.library.reference.1=../../../android/build
# Project target.
target=android-8
@@ -1,3 +0,0 @@
android.library.reference.1=../../../android/build
# Project target.
target=android-8
+15 -23
View File
@@ -2,30 +2,22 @@
# CMake file for Android samples. See root CMakeLists.txt
#
# ----------------------------------------------------------------------------
SET(OPENCV_ANDROID_SAMPLES_REQUIRED_DEPS opencv_contrib opencv_legacy opencv_objdetect opencv_calib3d opencv_features2d opencv_video opencv_highgui opencv_ml opencv_imgproc opencv_flann opencv_core)
add_custom_target(opencv_android_examples)
ocv_check_dependencies(${OPENCV_ANDROID_SAMPLES_REQUIRED_DEPS} opencv_java)
add_subdirectory(15-puzzle)
add_subdirectory(face-detection)
add_subdirectory(image-manipulations)
add_subdirectory(tutorial-0-androidcamera)
add_subdirectory(tutorial-1-addopencv)
add_subdirectory(tutorial-2-opencvcamera)
add_subdirectory(tutorial-3-native)
add_subdirectory(tutorial-4-mixed)
if(BUILD_ANDROID_EXAMPLES AND OCV_DEPENDENCIES_FOUND)
project(android_samples)
ocv_include_modules(${OPENCV_ANDROID_SAMPLES_REQUIRED_DEPS})
file(GLOB android_samples RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *)
list(REMOVE_ITEM android_samples hello-android)
list(SORT android_samples)
foreach(sample ${android_samples})
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${sample}/AndroidManifest.xml")
add_android_project("${sample}" "${CMAKE_CURRENT_SOURCE_DIR}/${sample}" INSTALL)
endif()
endforeach()
#hello-android sample
ADD_EXECUTABLE(hello-android hello-android/main.cpp)
TARGET_LINK_LIBRARIES(hello-android ${OPENCV_LINKER_LIBS} ${OPENCV_ANDROID_SAMPLES_REQUIRED_DEPS})
#hello-android sample
if(HAVE_opencv_highgui)
ocv_include_modules_recurse(opencv_highgui opencv_core)
add_executable(hello-android hello-android/main.cpp)
target_link_libraries(hello-android ${OPENCV_LINKER_LIBS} opencv_highgui opencv_core)
set_target_properties(hello-android PROPERTIES OUTPUT_NAME hello-android RUNTIME_OUTPUT_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}")
if(INSTALL_ANDROID_EXAMPLES)
install(TARGETS hello-android DESTINATION bin COMPONENT main)
endif()
add_dependencies(opencv_android_examples hello-android)
endif()
@@ -0,0 +1,6 @@
set(sample example-face-detection)
add_android_project(${sample} "${CMAKE_CURRENT_SOURCE_DIR}" LIBRARY_DEPS ${OpenCV_BINARY_DIR} SDK_TARGET 11 ${ANDROID_SDK_TARGET})
if(TARGET ${sample})
add_dependencies(opencv_android_examples ${sample})
endif()
@@ -1,3 +0,0 @@
android.library.reference.1=../../OpenCV-2.3.1
# Project target.
target=android-8
@@ -1,3 +0,0 @@
android.library.reference.1=../../../android/build
# Project target.
target=android-8
@@ -0,0 +1,6 @@
set(sample example-image-manipulations)
add_android_project(${sample} "${CMAKE_CURRENT_SOURCE_DIR}" LIBRARY_DEPS ${OpenCV_BINARY_DIR} SDK_TARGET 11 ${ANDROID_SDK_TARGET})
if(TARGET ${sample})
add_dependencies(opencv_android_examples ${sample})
endif()
@@ -1,3 +0,0 @@
android.library.reference.1=../../../android/build
# Project target.
target=android-8
@@ -1,3 +0,0 @@
android.library.reference.1=../../../android/build
# Project target.
target=android-8
@@ -0,0 +1,7 @@
set(sample example-tutorial-0-androidcamera)
add_android_project(${sample} "${CMAKE_CURRENT_SOURCE_DIR}" SDK_TARGET 11 ${ANDROID_SDK_TARGET})
if(TARGET ${sample})
add_dependencies(opencv_android_examples ${sample})
endif()
@@ -1,2 +0,0 @@
# Project target.
target=android-8
@@ -1,2 +0,0 @@
# Project target.
target=android-11
@@ -0,0 +1,7 @@
set(sample example-tutorial-1-addopencv)
add_android_project(${sample} "${CMAKE_CURRENT_SOURCE_DIR}" LIBRARY_DEPS ${OpenCV_BINARY_DIR} SDK_TARGET 11 ${ANDROID_SDK_TARGET})
if(TARGET ${sample})
add_dependencies(opencv_android_examples ${sample})
endif()
@@ -1,3 +0,0 @@
android.library.reference.1=../../../android/build
# Project target.
target=android-8
@@ -1,3 +0,0 @@
android.library.reference.1=../../../android/build
# Project target.
target=android-11
@@ -0,0 +1,7 @@
set(sample example-tutorial-2-opencvcamera)
add_android_project(${sample} "${CMAKE_CURRENT_SOURCE_DIR}" LIBRARY_DEPS ${OpenCV_BINARY_DIR} SDK_TARGET 11 ${ANDROID_SDK_TARGET})
if(TARGET ${sample})
add_dependencies(opencv_android_examples ${sample})
endif()
@@ -1,3 +0,0 @@
android.library.reference.1=../../../android/build
# Project target.
target=android-8
@@ -1,3 +0,0 @@
android.library.reference.1=../../../android/build
# Project target.
target=android-8
@@ -0,0 +1,6 @@
set(sample example-tutorial-3-native)
add_android_project(${sample} "${CMAKE_CURRENT_SOURCE_DIR}" SDK_TARGET 11 ${ANDROID_SDK_TARGET} NATIVE_DEPS opencv_features2d)
if(TARGET ${sample})
add_dependencies(opencv_android_examples ${sample})
endif()
@@ -1,2 +0,0 @@
# Project target.
target=android-8
@@ -1,2 +0,0 @@
# Project target.
target=android-11
@@ -0,0 +1,12 @@
set(sample example-tutorial-4-mixed)
if(BUILD_FAT_JAVA_LIB)
set(native_deps opencv_java)
else()
set(native_deps opencv_features2d)
endif()
add_android_project(${sample} "${CMAKE_CURRENT_SOURCE_DIR}" LIBRARY_DEPS ${OpenCV_BINARY_DIR} SDK_TARGET 11 ${ANDROID_SDK_TARGET} NATIVE_DEPS ${native_deps})
if(TARGET ${sample})
add_dependencies(opencv_android_examples ${sample})
endif()
@@ -1,3 +0,0 @@
android.library.reference.1=../../../android/build
# Project target.
target=android-8
@@ -1,3 +0,0 @@
android.library.reference.1=../../../android/build
# Project target.
target=android-11