Commit 739da31a authored by Andrey Kamaev's avatar Andrey Kamaev

Fixed Android build with SDK tools revision 20

parent 7fc18fe1
...@@ -175,6 +175,7 @@ macro(android_get_compatible_target VAR) ...@@ -175,6 +175,7 @@ macro(android_get_compatible_target VAR)
endif() endif()
endmacro() endmacro()
unset(__android_project_chain CACHE)
#add_android_project(target_name ${path} NATIVE_DEPS opencv_core LIBRARY_DEPS ${OpenCV_BINARY_DIR} SDK_TARGET 11) #add_android_project(target_name ${path} NATIVE_DEPS opencv_core LIBRARY_DEPS ${OpenCV_BINARY_DIR} SDK_TARGET 11)
macro(add_android_project target path) macro(add_android_project target path)
# parse arguments # parse arguments
...@@ -288,17 +289,18 @@ macro(add_android_project target path) ...@@ -288,17 +289,18 @@ macro(add_android_project target path)
COMMAND ${CMAKE_COMMAND} -E touch "${android_proj_bin_dir}/bin/${target}-debug.apk" # needed because ant does not update the timestamp of updated apk COMMAND ${CMAKE_COMMAND} -E touch "${android_proj_bin_dir}/bin/${target}-debug.apk" # needed because ant does not update the timestamp of updated apk
WORKING_DIRECTORY "${android_proj_bin_dir}" WORKING_DIRECTORY "${android_proj_bin_dir}"
MAIN_DEPENDENCY "${android_proj_bin_dir}/${ANDROID_MANIFEST_FILE}" MAIN_DEPENDENCY "${android_proj_bin_dir}/${ANDROID_MANIFEST_FILE}"
DEPENDS ${android_proj_file_deps} ${JNI_LIB_NAME}) DEPENDS ${android_proj_file_deps} ${JNI_LIB_NAME} ${__android_project_chain})
else() else()
add_custom_command( add_custom_command(
OUTPUT "${android_proj_bin_dir}/bin/${target}-debug.apk" OUTPUT "${android_proj_bin_dir}/bin/${target}-debug.apk"
COMMAND ${ANT_EXECUTABLE} -q -noinput -k debug COMMAND ${ANT_EXECUTABLE} -q -noinput -k debug
COMMAND ${CMAKE_COMMAND} -E touch "${android_proj_bin_dir}/bin/${target}-debug.apk" # needed because ant does not update the timestamp of updated apk COMMAND ${CMAKE_COMMAND} -E touch "${android_proj_bin_dir}/bin/${target}-debug.apk" # needed because ant does not update the timestamp of updated apk
WORKING_DIRECTORY "${android_proj_bin_dir}" WORKING_DIRECTORY "${android_proj_bin_dir}"
MAIN_DEPENDENCY "${android_proj_bin_dir}/${ANDROID_MANIFEST_FILE}" MAIN_DEPENDENCY "${android_proj_bin_dir}/${ANDROID_MANIFEST_FILE}"
DEPENDS "${OpenCV_BINARY_DIR}/bin/classes.jar" opencv_java # as we are part of OpenCV we can just force this dependency DEPENDS "${OpenCV_BINARY_DIR}/bin/.classes.jar.dephelper" opencv_java # as we are part of OpenCV we can just force this dependency
DEPENDS ${android_proj_file_deps} ${JNI_LIB_NAME}) DEPENDS ${android_proj_file_deps} ${JNI_LIB_NAME} ${__android_project_chain})
endif() endif()
set(__android_project_chain ${target} CACHE INTERNAL "auxiliary variable used for Android progects chaining")
unset(JNI_LIB_NAME) unset(JNI_LIB_NAME)
......
...@@ -248,9 +248,9 @@ if(ANDROID) ...@@ -248,9 +248,9 @@ if(ANDROID)
# build the library project # 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 # normally we should do this after a native part, but for a library project we can build the java part first
add_custom_command( add_custom_command(
OUTPUT "${OpenCV_BINARY_DIR}/bin/classes.jar" OUTPUT "${OpenCV_BINARY_DIR}/bin/classes.jar" "${OpenCV_BINARY_DIR}/bin/.classes.jar.dephelper"
COMMAND ${ANT_EXECUTABLE} -q -noinput -k debug COMMAND ${ANT_EXECUTABLE} -q -noinput -k debug
COMMAND ${CMAKE_COMMAND} -E touch "${OpenCV_BINARY_DIR}/bin/classes.jar" # needed because ant does not update the timestamp of updated jar COMMAND ${CMAKE_COMMAND} -E touch "${OpenCV_BINARY_DIR}/bin/.classes.jar.dephelper" # can not rely on classes.jar because different versions of SDK update timestamp at different times
WORKING_DIRECTORY "${OpenCV_BINARY_DIR}" WORKING_DIRECTORY "${OpenCV_BINARY_DIR}"
DEPENDS ${lib_proj_files} ${lib_target_files} ${java_files} DEPENDS ${lib_proj_files} ${lib_target_files} ${java_files}
COMMENT "Building OpenCV Android library project" COMMENT "Building OpenCV Android library project"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment