Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
e72a2324
Commit
e72a2324
authored
Mar 27, 2012
by
Andrey Kamaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reworked build scripts for Android Java API, tests and examples
parent
3b5b20b7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
33 changed files
with
193 additions
and
135 deletions
+193
-135
CMakeLists.txt
CMakeLists.txt
+3
-0
OpenCVAndroidProject.cmake
cmake/OpenCVAndroidProject.cmake
+0
-0
OpenCVDetectAndroidSDK.cmake
cmake/OpenCVDetectAndroidSDK.cmake
+7
-24
OpenCVModule.cmake
cmake/OpenCVModule.cmake
+16
-0
CMakeLists.txt
modules/java/CMakeLists.txt
+36
-38
CMakeLists.txt
modules/java/android_test/CMakeLists.txt
+59
-0
default.properties
modules/java/android_test/default.properties
+0
-3
project.properties
modules/java/android_test/project.properties
+0
-3
CMakeLists.txt
samples/android/15-puzzle/CMakeLists.txt
+6
-0
default.properties
samples/android/15-puzzle/default.properties
+0
-3
project.properties
samples/android/15-puzzle/project.properties
+0
-3
CMakeLists.txt
samples/android/CMakeLists.txt
+15
-23
CMakeLists.txt
samples/android/face-detection/CMakeLists.txt
+6
-0
default.properties
samples/android/face-detection/default.properties
+0
-3
project.properties
samples/android/face-detection/project.properties
+0
-3
CMakeLists.txt
samples/android/image-manipulations/CMakeLists.txt
+6
-0
default.properties
samples/android/image-manipulations/default.properties
+0
-3
project.properties
samples/android/image-manipulations/project.properties
+0
-3
CMakeLists.txt
samples/android/tutorial-0-androidcamera/CMakeLists.txt
+7
-0
default.properties
samples/android/tutorial-0-androidcamera/default.properties
+0
-2
project.properties
samples/android/tutorial-0-androidcamera/project.properties
+0
-2
CMakeLists.txt
samples/android/tutorial-1-addopencv/CMakeLists.txt
+7
-0
default.properties
samples/android/tutorial-1-addopencv/default.properties
+0
-3
project.properties
samples/android/tutorial-1-addopencv/project.properties
+0
-3
CMakeLists.txt
samples/android/tutorial-2-opencvcamera/CMakeLists.txt
+7
-0
default.properties
samples/android/tutorial-2-opencvcamera/default.properties
+0
-3
project.properties
samples/android/tutorial-2-opencvcamera/project.properties
+0
-3
CMakeLists.txt
samples/android/tutorial-3-native/CMakeLists.txt
+6
-0
default.properties
samples/android/tutorial-3-native/default.properties
+0
-2
project.properties
samples/android/tutorial-3-native/project.properties
+0
-2
CMakeLists.txt
samples/android/tutorial-4-mixed/CMakeLists.txt
+12
-0
default.properties
samples/android/tutorial-4-mixed/default.properties
+0
-3
project.properties
samples/android/tutorial-4-mixed/project.properties
+0
-3
No files found.
CMakeLists.txt
View file @
e72a2324
...
...
@@ -455,6 +455,9 @@ include(cmake/OpenCVDetectPython.cmake REQUIRED)
if
((
NOT DEFINED BUILD_opencv_java OR BUILD_opencv_java
)
AND PYTHON_EXECUTABLE
)
if
(
ANDROID
)
include
(
cmake/OpenCVDetectAndroidSDK.cmake REQUIRED
)
if
(
NOT ANDROID_TOOLS_Pkg_Revision GREATER 13
)
message
(
WARNING
"OpenCV requires Android SDK tool revision 14 or newer. Otherwise tests and samples will no be compiled."
)
endif
()
endif
()
include
(
cmake/OpenCVDetectApacheAnt.cmake REQUIRED
)
...
...
cmake/OpenCVAndroidProject.cmake
View file @
e72a2324
This diff is collapsed.
Click to expand it.
cmake/OpenCVDetectAndroidSDK.cmake
View file @
e72a2324
...
...
@@ -85,7 +85,7 @@ if(ANDROID_EXECUTABLE)
set
(
ANDROID_MANIFEST_FILE AndroidManifest.xml
)
set
(
ANDROID_LIB_PROJECT_FILES build.xml local.properties proguard-project.txt
${
ANDROID_PROJECT_PROPERTIES_FILE
}
)
set
(
ANDROID_PROJECT_FILES
${
ANDROID_
ANT_PROPERTIES_FILE
}
${
ANDROID_
LIB_PROJECT_FILES
}
)
set
(
ANDROID_PROJECT_FILES
${
ANDROID_LIB_PROJECT_FILES
}
)
#get installed targets
if
(
ANDROID_TOOLS_Pkg_Revision GREATER 11
)
...
...
@@ -120,31 +120,14 @@ if(ANDROID_EXECUTABLE)
set
(
ANDROID_EXECUTABLE
"ANDROID_EXECUTABLE-NOTFOUND"
)
endif
()
# detect ANDROID_SDK_TARGET if no target is provided by user
#TODO: remove this block
# clear ANDROID_SDK_TARGET if no target is provided by user
if
(
NOT ANDROID_SDK_TARGET
)
set
(
desired_android_target_level
${
ANDROID_NATIVE_API_LEVEL
}
)
if
(
desired_android_target_level LESS 11
)
set
(
desired_android_target_level 11
)
endif
()
if
(
ANDROID_PROCESS EQUAL 0
)
math
(
EXPR desired_android_target_level_1
"
${
desired_android_target_level
}
-1"
)
foreach
(
target
${
ANDROID_SDK_TARGETS
}
)
string
(
REGEX MATCH
"[0-9]+$"
target_level
"
${
target
}
"
)
if
(
target_level GREATER desired_android_target_level_1
)
set
(
ANDROID_SDK_TARGET
"
${
target
}
"
)
break
()
endif
()
endforeach
()
else
()
set
(
ANDROID_SDK_TARGET android-
${
desired_android_target_level
}
)
message
(
WARNING
"Could not retrieve list of installed Android targets. Will try to use
\"
${
ANDROID_SDK_TARGET
}
\"
target"
)
endif
()
endif
(
NOT ANDROID_SDK_TARGET
)
set
(
ANDROID_SDK_TARGET
""
CACHE STRING
"Android SDK target for the OpenCV Java API and samples"
)
endif
()
if
(
ANDROID_SDK_TARGETS AND CMAKE_VERSION VERSION_GREATER
"2.8"
)
set_property
(
CACHE ANDROID_SDK_TARGET PROPERTY STRINGS
${
ANDROID_SDK_TARGETS
}
)
endif
()
SET
(
ANDROID_SDK_TARGET
"
${
ANDROID_SDK_TARGET
}
"
CACHE STRING
"SDK target for Android tests and samples"
)
string
(
REGEX MATCH
"[0-9]+$"
ANDROID_SDK_TARGET_LEVEL
"
${
ANDROID_SDK_TARGET
}
"
)
endif
(
ANDROID_EXECUTABLE
)
# finds minimal installed SDK target compatible with provided names or API levels
...
...
cmake/OpenCVModule.cmake
View file @
e72a2324
...
...
@@ -355,6 +355,22 @@ macro(ocv_include_modules)
endforeach
()
endmacro
()
# setup include paths for the list of passed modules and recursively add dependent modules
macro
(
ocv_include_modules_recurse
)
foreach
(
d
${
ARGN
}
)
if
(
d MATCHES
"^opencv_"
AND HAVE_
${
d
}
)
if
(
EXISTS
"
${
OPENCV_MODULE_
${
d
}
_LOCATION
}
/include"
)
ocv_include_directories
(
"
${
OPENCV_MODULE_
${
d
}
_LOCATION
}
/include"
)
endif
()
if
(
OPENCV_MODULE_
${
d
}
_DEPS
)
ocv_include_modules_recurse
(
${
OPENCV_MODULE_
${
d
}
_DEPS
}
)
endif
()
elseif
(
EXISTS
"
${
d
}
"
)
ocv_include_directories
(
"
${
d
}
"
)
endif
()
endforeach
()
endmacro
()
# setup include path for OpenCV headers for specified module
# ocv_module_include_directories(<extra include directories/extra include modules>)
macro
(
ocv_module_include_directories
)
...
...
modules/java/CMakeLists.txt
View file @
e72a2324
...
...
@@ -24,8 +24,8 @@ set(RST_PARSER "${CMAKE_CURRENT_SOURCE_DIR}/rst_parser.py")
set
(
CHECK_TEST_COVERAGE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/check-tests.py"
)
# add dependencies to cmake (we should rerun cmake if any of these scripts is modified)
configure_file
(
"
${
GEN_JAVA
}
"
"
${
CMAKE
_BINARY_DIR
}
/junk/gen_java.junk"
COPYONLY
)
configure_file
(
"
${
HDR_PARSER
}
"
"
${
CMAKE
_BINARY_DIR
}
/junk/hdr_parser.junk"
COPYONLY
)
configure_file
(
"
${
GEN_JAVA
}
"
"
${
OpenCV
_BINARY_DIR
}
/junk/gen_java.junk"
COPYONLY
)
configure_file
(
"
${
HDR_PARSER
}
"
"
${
OpenCV
_BINARY_DIR
}
/junk/hdr_parser.junk"
COPYONLY
)
set
(
java_hdr_deps
""
)
set
(
generated_cpp_sources
""
)
...
...
@@ -53,7 +53,7 @@ foreach(module ${OPENCV_JAVA_MODULES})
# add dependencies to cmake (we should rerun cmake if any of these headers is modified)
foreach
(
header
${
module_headers
}
)
get_filename_component
(
header_name
"
${
header
}
"
NAME_WE
)
configure_file
(
"
${
header
}
"
"
${
CMAKE
_BINARY_DIR
}
/junk/
${
header_name
}
.junk"
COPYONLY
)
configure_file
(
"
${
header
}
"
"
${
OpenCV
_BINARY_DIR
}
/junk/
${
header_name
}
.junk"
COPYONLY
)
endforeach
()
# first run (to get list of generated files)
...
...
@@ -125,17 +125,17 @@ foreach(java_file ${documented_java_files})
string
(
REPLACE
"+"
"/"
java_file_name
"
${
java_file_name
}
"
)
add_custom_command
(
OUTPUT
"
${
CMAKE
_BINARY_DIR
}
/
${
JAVA_OUTPUT_DIR
}
/
${
java_file_name
}
"
COMMAND
${
CMAKE_COMMAND
}
-E copy
"
${
java_file
}
"
"
${
CMAKE
_BINARY_DIR
}
/
${
JAVA_OUTPUT_DIR
}
/
${
java_file_name
}
"
OUTPUT
"
${
OpenCV
_BINARY_DIR
}
/
${
JAVA_OUTPUT_DIR
}
/
${
java_file_name
}
"
COMMAND
${
CMAKE_COMMAND
}
-E copy
"
${
java_file
}
"
"
${
OpenCV
_BINARY_DIR
}
/
${
JAVA_OUTPUT_DIR
}
/
${
java_file_name
}
"
MAIN_DEPENDENCY
"
${
java_file
}
"
DEPENDS
${
java_documented_headers_deps
}
COMMENT
"Generating
${
JAVA_OUTPUT_DIR
}
/
${
java_file_name
}
"
)
list
(
APPEND java_files
"
${
CMAKE
_BINARY_DIR
}
/
${
JAVA_OUTPUT_DIR
}
/
${
java_file_name
}
"
)
list
(
APPEND java_files
"
${
OpenCV
_BINARY_DIR
}
/
${
JAVA_OUTPUT_DIR
}
/
${
java_file_name
}
"
)
if
(
ANDROID
)
get_filename_component
(
install_subdir
"
${
java_file_name
}
"
PATH
)
install
(
FILES
"
${
CMAKE
_BINARY_DIR
}
/
${
JAVA_OUTPUT_DIR
}
/
${
java_file_name
}
"
DESTINATION
${
JAVA_OUTPUT_DIR
}
/
${
install_subdir
}
COMPONENT main
)
install
(
FILES
"
${
OpenCV
_BINARY_DIR
}
/
${
JAVA_OUTPUT_DIR
}
/
${
java_file_name
}
"
DESTINATION
${
JAVA_OUTPUT_DIR
}
/
${
install_subdir
}
COMPONENT main
)
endif
()
endforeach
()
...
...
@@ -178,10 +178,7 @@ if(ANDROID)
# force strip library after the build command
# because samples and tests will make a copy of the library before install
get_target_property
(
__opencv_java_location
${
the_module
}
LOCATION
)
add_custom_command
(
TARGET
${
the_module
}
POST_BUILD
COMMAND
${
CMAKE_STRIP
}
--strip-unneeded
"
${
__opencv_java_location
}
"
)
add_custom_command
(
TARGET
${
the_module
}
POST_BUILD COMMAND
${
CMAKE_STRIP
}
--strip-unneeded
"
${
__opencv_java_location
}
"
)
set
(
lib_proj_files
""
)
...
...
@@ -190,16 +187,16 @@ if(ANDROID)
foreach
(
f
${
android_lib_project_files
}
)
if
(
NOT f MATCHES
"
\\
.svn"
)
add_custom_command
(
OUTPUT
"
${
CMAKE
_BINARY_DIR
}
/
${
f
}
"
COMMAND
${
CMAKE_COMMAND
}
-E copy
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/android/
${
f
}
"
"
${
CMAKE
_BINARY_DIR
}
/
${
f
}
"
OUTPUT
"
${
OpenCV
_BINARY_DIR
}
/
${
f
}
"
COMMAND
${
CMAKE_COMMAND
}
-E copy
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/android/
${
f
}
"
"
${
OpenCV
_BINARY_DIR
}
/
${
f
}
"
DEPENDS
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/android/
${
f
}
"
COMMENT
"Generating
${
f
}
"
)
list
(
APPEND lib_proj_files
"
${
CMAKE
_BINARY_DIR
}
/
${
f
}
"
)
list
(
APPEND lib_proj_files
"
${
OpenCV
_BINARY_DIR
}
/
${
f
}
"
)
if
(
NOT f MATCHES
"jni/.+"
)
install
(
FILES
"
${
CMAKE
_BINARY_DIR
}
/
${
f
}
"
DESTINATION . COMPONENT main
)
install
(
FILES
"
${
OpenCV
_BINARY_DIR
}
/
${
f
}
"
DESTINATION . COMPONENT main
)
endif
()
endif
()
endforeach
()
...
...
@@ -208,13 +205,12 @@ if(ANDROID)
foreach
(
jni_file
${
handwrittren_cpp_sources
}
${
handwrittren_h_sources
}
${
generated_cpp_sources
}
)
get_filename_component
(
jni_file_name
"
${
jni_file
}
"
NAME
)
add_custom_command
(
OUTPUT
"
${
CMAKE_BINARY_DIR
}
/jni/
${
jni_file_name
}
"
COMMAND
${
CMAKE_COMMAND
}
-E copy
"
${
jni_file
}
"
"
${
CMAKE_BINARY_DIR
}
/jni/
${
jni_file_name
}
"
COMMAND
${
CMAKE_COMMAND
}
-E touch
"
${
CMAKE_BINARY_DIR
}
/jni/
${
jni_file_name
}
"
OUTPUT
"
${
OpenCV_BINARY_DIR
}
/jni/
${
jni_file_name
}
"
COMMAND
${
CMAKE_COMMAND
}
-E copy
"
${
jni_file
}
"
"
${
OpenCV_BINARY_DIR
}
/jni/
${
jni_file_name
}
"
DEPENDS
"
${
jni_file
}
"
${
java_hdr_deps
}
COMMENT
"Generating jni/
${
jni_file_name
}
"
)
list
(
APPEND lib_proj_files
"
${
CMAKE
_BINARY_DIR
}
/jni/
${
jni_file_name
}
"
)
list
(
APPEND lib_proj_files
"
${
OpenCV
_BINARY_DIR
}
/jni/
${
jni_file_name
}
"
)
endforeach
()
# create Android library project in build folder
...
...
@@ -222,32 +218,34 @@ if(ANDROID)
set
(
lib_target
${
the_module
}
_android_library
)
set
(
lib_target_files
${
ANDROID_LIB_PROJECT_FILES
}
)
ocv_list_add_prefix
(
lib_target_files
"
${
CMAKE
_BINARY_DIR
}
/"
)
ocv_list_add_prefix
(
lib_target_files
"
${
OpenCV
_BINARY_DIR
}
/"
)
android_get_compatible_target
(
lib_target_sdk_target
8
)
android_get_compatible_target
(
lib_target_sdk_target
${
ANDROID_NATIVE_API_LEVEL
}
${
ANDROID_SDK_TARGET
}
)
add_custom_command
(
OUTPUT
${
lib_target_files
}
COMMAND
${
CMAKE_COMMAND
}
-E remove
${
lib_target_files
}
COMMAND
${
ANDROID_EXECUTABLE
}
--silent create lib-project --path \
"
${
CMAKE
_BINARY_DIR
}
\"
--target
\"
${
lib_target_sdk_target
}
\"
--name OpenCV --package org.opencv 2>
\"
${
CMAKE_CURRENT_BINARY_DIR
}
/create_lib_project.log
\"
MAIN_DEPENDENCY "
${
CMAKE
_BINARY_DIR
}
/
${
ANDROID_MANIFEST_FILE
}
"
COMMAND
${
ANDROID_EXECUTABLE
}
--silent create lib-project --path \
"
${
OpenCV
_BINARY_DIR
}
\"
--target
\"
${
lib_target_sdk_target
}
\"
--name OpenCV --package org.opencv 2>
\"
${
CMAKE_CURRENT_BINARY_DIR
}
/create_lib_project.log
\"
MAIN_DEPENDENCY "
${
OpenCV
_BINARY_DIR
}
/
${
ANDROID_MANIFEST_FILE
}
"
DEPENDS
${
lib_proj_files
}
COMMENT "
Generating OpenCV Android library project. SDK target:
${
lib_target_sdk_target
}
"
)
install(FILES "
${
CMAKE
_BINARY_DIR
}
/
${
ANDROID_PROJECT_PROPERTIES_FILE
}
" DESTINATION . COMPONENT main)
install(FILES "
${
OpenCV
_BINARY_DIR
}
/
${
ANDROID_PROJECT_PROPERTIES_FILE
}
" DESTINATION . COMPONENT main)
if(ANT_EXECUTABLE AND ANDROID_TOOLS_Pkg_Revision GREATER 13)
# build the library project
# normally we should do this after a native part, but for a library project we can build the java part first
add_custom_command(
OUTPUT "
${
CMAKE
_BINARY_DIR
}
/bin/classes.jar
"
OUTPUT "
${
OpenCV
_BINARY_DIR
}
/bin/classes.jar
"
COMMAND
${
ANT_EXECUTABLE
}
-q -noinput -k debug
WORKING_DIRECTORY "
${
CMAKE_BINARY_DIR
}
"
COMMAND
${
CMAKE_COMMAND
}
-E touch "
${
OpenCV_BINARY_DIR
}
/bin/classes.jar
" # needed because ant does not update the timestamp of updated jar
WORKING_DIRECTORY "
${
OpenCV_BINARY_DIR
}
"
DEPENDS
${
lib_proj_files
}
${
lib_target_files
}
${
java_files
}
COMMENT "
Building OpenCV Android library project
"
)
install(FILES "
${
CMAKE_BINARY_DIR
}
/bin/classes.jar
" DESTINATION bin COMPONENT main)
list(APPEND lib_target_files "
${
CMAKE_BINARY_DIR
}
/bin/classes.jar
")
install(FILES "
${
OpenCV_BINARY_DIR
}
/bin/classes.jar
" "
${
OpenCV_BINARY_DIR
}
/bin/jarlist.cache
" "
${
OpenCV_BINARY_DIR
}
/bin/build.prop
" DESTINATION bin COMPONENT main)
install(DIRECTORY "
${
OpenCV_BINARY_DIR
}
/bin/res
" "
${
OpenCV_BINARY_DIR
}
/bin/classes
" DESTINATION bin COMPONENT main)
list(APPEND lib_target_files "
${
OpenCV_BINARY_DIR
}
/bin/classes.jar
")
endif()
add_custom_target(
${
lib_target
}
...
...
@@ -260,14 +258,14 @@ if(ANDROID)
endif(ANDROID)
#android test project
ocv_check_dependencies(
${
OPENCV_MODULE_
${
the_module
}
_OPT_DEPS
}
)
if(BUILD_TESTS AND OCV_DEPENDENCIES_FOUND
)
add_android_project(opencv_test_java "
${
CMAKE_CURRENT_SOURCE_DIR
}
/android_test
")
if(PYTHON_EXECUTABLE)
add_custom_command(
TARGET opencv_test_java_android_project POST_BUILD
COMMAND
${
PYTHON_EXECUTABLE
}
${
CHECK_TEST_COVERAGE
}
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/android_test/src
" "
${
CMAKE
_BINARY_DIR
}
/src
" > "
${
CMAKE_CURRENT_BINARY_DIR
}
/tests_coverage.log
"
)
endif()
if(ANDROID AND BUILD_TESTS
)
add_subdirectory(android_test
)
#
add_android_project(opencv_test_java "
${
CMAKE_CURRENT_SOURCE_DIR
}
/android_test
")
#
if(PYTHON_EXECUTABLE)
#
add_custom_command(
#
TARGET opencv_test_java_android_project POST_BUILD
# COMMAND
${
PYTHON_EXECUTABLE
}
${
CHECK_TEST_COVERAGE
}
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/android_test/src
" "
${
OpenCV
_BINARY_DIR
}
/src
" > "
${
CMAKE_CURRENT_BINARY_DIR
}
/tests_coverage.log
"
#
)
#
endif()
endif()
modules/java/android_test/CMakeLists.txt
0 → 100644
View file @
e72a2324
ocv_check_dependencies
(
opencv_java
${
OPENCV_MODULE_opencv_java_OPT_DEPS
}
${
OPENCV_MODULE_opencv_java_REQ_DEPS
}
)
if
(
NOT OCV_DEPENDENCIES_FOUND OR NOT ANT_EXECUTABLE OR NOT ANDROID_EXECUTABLE OR NOT ANDROID_TOOLS_Pkg_Revision GREATER 13
)
return
()
endif
()
project
(
opencv_test_java
)
set
(
opencv_test_java_bin_dir
"
${
CMAKE_CURRENT_BINARY_DIR
}
/.build"
)
# get project sources
file
(
GLOB_RECURSE opencv_test_java_files RELATIVE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/res/*"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/src/*"
)
ocv_list_filterout
(
opencv_test_java_files
".svn"
)
# copy sources out from the build tree
set
(
opencv_test_java_file_deps
""
)
foreach
(
f
${
opencv_test_java_files
}
${
ANDROID_MANIFEST_FILE
}
)
add_custom_command
(
OUTPUT
"
${
opencv_test_java_bin_dir
}
/
${
f
}
"
COMMAND
${
CMAKE_COMMAND
}
-E copy
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/
${
f
}
"
"
${
opencv_test_java_bin_dir
}
/
${
f
}
"
MAIN_DEPENDENCY
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/
${
f
}
"
COMMENT
"Copying
${
f
}
"
)
list
(
APPEND opencv_test_java_file_deps
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/
${
f
}
"
"
${
opencv_test_java_bin_dir
}
/
${
f
}
"
)
endforeach
()
# fix Android project
set
(
android_proj_target_files
${
ANDROID_PROJECT_FILES
}
)
ocv_list_add_prefix
(
android_proj_target_files
"
${
opencv_test_java_bin_dir
}
/"
)
file
(
RELATIVE_PATH __dep
"
${
opencv_test_java_bin_dir
}
"
"
${
OpenCV_BINARY_DIR
}
"
)
add_custom_command
(
OUTPUT
${
android_proj_target_files
}
COMMAND
${
CMAKE_COMMAND
}
-E remove
${
android_proj_target_files
}
COMMAND
${
ANDROID_EXECUTABLE
}
--silent update test-project --path
"
${
opencv_test_java_bin_dir
}
"
--main
"
${
OpenCV_BINARY_DIR
}
"
COMMAND
${
ANDROID_EXECUTABLE
}
--silent update project --path
"
${
opencv_test_java_bin_dir
}
"
--library
"
${
__dep
}
"
MAIN_DEPENDENCY
"
${
opencv_test_java_bin_dir
}
/
${
ANDROID_MANIFEST_FILE
}
"
DEPENDS
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/
${
ANDROID_MANIFEST_FILE
}
"
COMMENT
"Updating Android Java API test project"
)
list
(
APPEND opencv_test_java_file_deps
${
android_proj_target_files
}
)
# build java part
add_custom_command
(
OUTPUT
"
${
opencv_test_java_bin_dir
}
/bin/OpenCVTest-debug.apk"
COMMAND
${
ANT_EXECUTABLE
}
-q -noinput -k debug
COMMAND
${
CMAKE_COMMAND
}
-E touch
"
${
opencv_test_java_bin_dir
}
/bin/OpenCVTest-debug.apk"
# needed because ant does not update the timestamp of updated apk
WORKING_DIRECTORY
"
${
opencv_test_java_bin_dir
}
"
MAIN_DEPENDENCY
"
${
opencv_test_java_bin_dir
}
/
${
ANDROID_MANIFEST_FILE
}
"
DEPENDS
"
${
OpenCV_BINARY_DIR
}
/bin/classes.jar"
opencv_java
DEPENDS
${
opencv_test_java_file_deps
}
)
add_custom_target
(
${
PROJECT_NAME
}
ALL SOURCES
"
${
opencv_test_java_bin_dir
}
/bin/OpenCVTest-debug.apk"
)
add_dependencies
(
${
PROJECT_NAME
}
opencv_java
)
# put the final .apk to the OpenCV's bin folder
add_custom_command
(
TARGET
${
PROJECT_NAME
}
POST_BUILD COMMAND
${
CMAKE_COMMAND
}
-E copy
"
${
opencv_test_java_bin_dir
}
/bin/OpenCVTest-debug.apk"
"
${
OpenCV_BINARY_DIR
}
/bin/
${
PROJECT_NAME
}
.apk"
)
add_dependencies
(
opencv_tests
${
PROJECT_NAME
}
)
modules/java/android_test/default.properties
deleted
100644 → 0
View file @
3b5b20b7
android.library.reference.1
=
../../../android/build
# Project target.
target
=
android-8
modules/java/android_test/project.properties
deleted
100644 → 0
View file @
3b5b20b7
android.library.reference.1
=
../../../android/build
# Project target.
target
=
android-8
samples/android/15-puzzle/CMakeLists.txt
0 → 100644
View file @
e72a2324
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
()
samples/android/15-puzzle/default.properties
deleted
100644 → 0
View file @
3b5b20b7
android.library.reference.1
=
../../../android/build
# Project target.
target
=
android-8
samples/android/15-puzzle/project.properties
deleted
100644 → 0
View file @
3b5b20b7
android.library.reference.1
=
../../../android/build
# Project target.
target
=
android-8
samples/android/CMakeLists.txt
View file @
e72a2324
...
...
@@ -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
()
samples/android/face-detection/CMakeLists.txt
0 → 100644
View file @
e72a2324
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
()
samples/android/face-detection/default.properties
deleted
100644 → 0
View file @
3b5b20b7
android.library.reference.1
=
../../OpenCV-2.3.1
# Project target.
target
=
android-8
samples/android/face-detection/project.properties
deleted
100644 → 0
View file @
3b5b20b7
android.library.reference.1
=
../../../android/build
# Project target.
target
=
android-8
samples/android/image-manipulations/CMakeLists.txt
0 → 100644
View file @
e72a2324
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
()
samples/android/image-manipulations/default.properties
deleted
100644 → 0
View file @
3b5b20b7
android.library.reference.1
=
../../../android/build
# Project target.
target
=
android-8
samples/android/image-manipulations/project.properties
deleted
100644 → 0
View file @
3b5b20b7
android.library.reference.1
=
../../../android/build
# Project target.
target
=
android-8
samples/android/tutorial-0-androidcamera/CMakeLists.txt
0 → 100644
View file @
e72a2324
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
()
samples/android/tutorial-0-androidcamera/default.properties
deleted
100644 → 0
View file @
3b5b20b7
# Project target.
target
=
android-8
samples/android/tutorial-0-androidcamera/project.properties
deleted
100644 → 0
View file @
3b5b20b7
# Project target.
target
=
android-11
samples/android/tutorial-1-addopencv/CMakeLists.txt
0 → 100644
View file @
e72a2324
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
()
samples/android/tutorial-1-addopencv/default.properties
deleted
100644 → 0
View file @
3b5b20b7
android.library.reference.1
=
../../../android/build
# Project target.
target
=
android-8
samples/android/tutorial-1-addopencv/project.properties
deleted
100644 → 0
View file @
3b5b20b7
android.library.reference.1
=
../../../android/build
# Project target.
target
=
android-11
samples/android/tutorial-2-opencvcamera/CMakeLists.txt
0 → 100644
View file @
e72a2324
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
()
samples/android/tutorial-2-opencvcamera/default.properties
deleted
100644 → 0
View file @
3b5b20b7
android.library.reference.1
=
../../../android/build
# Project target.
target
=
android-8
samples/android/tutorial-2-opencvcamera/project.properties
deleted
100644 → 0
View file @
3b5b20b7
android.library.reference.1
=
../../../android/build
# Project target.
target
=
android-8
samples/android/tutorial-3-native/CMakeLists.txt
0 → 100644
View file @
e72a2324
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
()
samples/android/tutorial-3-native/default.properties
deleted
100644 → 0
View file @
3b5b20b7
# Project target.
target
=
android-8
samples/android/tutorial-3-native/project.properties
deleted
100644 → 0
View file @
3b5b20b7
# Project target.
target
=
android-11
samples/android/tutorial-4-mixed/CMakeLists.txt
0 → 100644
View file @
e72a2324
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
()
samples/android/tutorial-4-mixed/default.properties
deleted
100644 → 0
View file @
3b5b20b7
android.library.reference.1
=
../../../android/build
# Project target.
target
=
android-8
samples/android/tutorial-4-mixed/project.properties
deleted
100644 → 0
View file @
3b5b20b7
android.library.reference.1
=
../../../android/build
# Project target.
target
=
android-11
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment