Android tests are included into cmake build
authorAndrey Kamaev <no@email>
Thu, 30 Jun 2011 14:35:35 +0000 (14:35 +0000)
committerAndrey Kamaev <no@email>
Thu, 30 Jun 2011 14:35:35 +0000 (14:35 +0000)
modules/java/CMakeLists.txt
modules/java/android_test/default.properties

index 43783f2..1d1cf3b 100644 (file)
@@ -136,5 +136,29 @@ foreach(java_file ${java_project_files} ${generated_java_sources})
     endif()
 endforeach()
 
+#android test project
+if(ANDROID AND BUILD_TESTS AND CAN_BUILD_ANDROID_PROJECTS)
+    SET(test_dir "${CMAKE_CURRENT_SOURCE_DIR}/android_test")
+    SET(test_target OpenCV_JavaAPI_Tests)
+
+    add_custom_target(${test_target} ALL)
+    add_dependencies(${test_target} opencv_java opencv_java_api)
+
+    file(RELATIVE_PATH OPENCV_REFERENCE_PATH "${test_dir}" "${CMAKE_BINARY_DIR}")
+
+    add_custom_command(
+        TARGET ${test_target}
+        WORKING_DIRECTORY ${test_dir}
+        COMMAND ${CMAKE_COMMAND} -E remove -f "${test_dir}/default.properties"
+        COMMAND ${CMAKE_COMMAND} -E touch "${test_dir}/default.properties"
+        COMMAND ${ANDROID_EXECUTABLE} update project --name "${test_target}" --target 7 --library "${OPENCV_REFERENCE_PATH}" --path .
+        COMMAND ${ANT_EXECUTABLE} debug
+        COMMAND ${CMAKE_COMMAND} -E copy "${test_dir}/bin/${test_target}-debug.apk" "${CMAKE_BINARY_DIR}/bin/${test_target}-debug.apk"
+        )
+
+    LIST(APPEND additional_clean_files "${CMAKE_BINARY_DIR}/bin/${test_target}-debug.apk" "${test_dir}/build.xml" "${test_dir}/local.properties" "${test_dir}/proguard.cfg")
+
+endif()
+
 set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${additional_clean_files}")
 
index b4a7e0f..fb3ea1f 100644 (file)
@@ -1,12 +1,3 @@
-# This file is automatically generated by Android Tools.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must be checked in Version Control Systems.
-#
-# To customize properties used by the Ant build system use,
-# "build.properties", and override values to adapt the script to your
-# project structure.
-
+android.library.reference.1=../../../android/build
 # Project target.
 target=android-8
-android.library.reference.1=../../../android/build