diff --git a/3rdparty/ippicv/downloader.cmake b/3rdparty/ippicv/downloader.cmake index 1c6b90e21e46..6dd3d16f4d5a 100644 --- a/3rdparty/ippicv/downloader.cmake +++ b/3rdparty/ippicv/downloader.cmake @@ -15,7 +15,7 @@ function(_icv_downloader) set(OPENCV_ICV_PLATFORM "macosx") set(OPENCV_ICV_PACKAGE_SUBDIR "/ippicv_osx") elseif(UNIX) - if(ANDROID AND NOT (ANDROID_ABI STREQUAL x86 OR ANDROID_ABI STREQUAL x86_64)) + if(ANDROID AND NOT (CMAKE_ANDROID_ARCH STREQUAL x86 OR CMAKE_ANDROID_ARCH STREQUAL x86_64)) return() endif() set(OPENCV_ICV_PACKAGE_NAME "ippicv_linux_20151201.tgz") diff --git a/CMakeLists.txt b/CMakeLists.txt index 24669cb3d7cd..761c64e5895e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -324,12 +324,9 @@ include(cmake/OpenCVVersion.cmake) set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin" CACHE PATH "Output directory for applications") if(ANDROID) - if(ANDROID_ABI MATCHES "NEON") + if(CMAKE_ANDROID_ARM_NEON) set(ENABLE_NEON ON) endif() - if(ANDROID_ABI MATCHES "VFPV3") - set(ENABLE_VFPV3 ON) - endif() endif() if(ANDROID OR WIN32) @@ -352,13 +349,13 @@ else() endif() if(ANDROID) - ocv_update(OPENCV_SAMPLES_BIN_INSTALL_PATH "${OpenCV_INSTALL_BINARIES_PREFIX}samples/${ANDROID_NDK_ABI_NAME}") + ocv_update(OPENCV_SAMPLES_BIN_INSTALL_PATH "${OpenCV_INSTALL_BINARIES_PREFIX}samples/${CMAKE_ANDROID_ARCH_ABI}") else() ocv_update(OPENCV_SAMPLES_BIN_INSTALL_PATH "${OpenCV_INSTALL_BINARIES_PREFIX}samples") endif() if(ANDROID) - ocv_update(OPENCV_BIN_INSTALL_PATH "${OpenCV_INSTALL_BINARIES_PREFIX}bin/${ANDROID_NDK_ABI_NAME}") + ocv_update(OPENCV_BIN_INSTALL_PATH "${OpenCV_INSTALL_BINARIES_PREFIX}bin/${CMAKE_ANDROID_ARCH_ABI}") else() ocv_update(OPENCV_BIN_INSTALL_PATH "${OpenCV_INSTALL_BINARIES_PREFIX}bin") endif() @@ -380,10 +377,10 @@ else() endif() if(ANDROID) - set(LIBRARY_OUTPUT_PATH "${OpenCV_BINARY_DIR}/lib/${ANDROID_NDK_ABI_NAME}") - ocv_update(3P_LIBRARY_OUTPUT_PATH "${OpenCV_BINARY_DIR}/3rdparty/lib/${ANDROID_NDK_ABI_NAME}") - ocv_update(OPENCV_LIB_INSTALL_PATH sdk/native/libs/${ANDROID_NDK_ABI_NAME}) - ocv_update(OPENCV_3P_LIB_INSTALL_PATH sdk/native/3rdparty/libs/${ANDROID_NDK_ABI_NAME}) + set(LIBRARY_OUTPUT_PATH "${OpenCV_BINARY_DIR}/lib/${CMAKE_ANDROID_ARCH_ABI}") + ocv_update(3P_LIBRARY_OUTPUT_PATH "${OpenCV_BINARY_DIR}/3rdparty/lib/${CMAKE_ANDROID_ARCH_ABI}") + ocv_update(OPENCV_LIB_INSTALL_PATH sdk/native/libs/${CMAKE_ANDROID_ARCH_ABI}) + ocv_update(OPENCV_3P_LIB_INSTALL_PATH sdk/native/3rdparty/libs/${CMAKE_ANDROID_ARCH_ABI}) ocv_update(OPENCV_CONFIG_INSTALL_PATH sdk/native/jni) ocv_update(OPENCV_INCLUDE_INSTALL_PATH sdk/native/jni/include) ocv_update(OPENCV_SAMPLES_SRC_INSTALL_PATH samples/native) @@ -945,16 +942,12 @@ endif() if(ANDROID) status("") status(" Android: ") - status(" Android ABI:" ${ANDROID_ABI}) + status(" Android ABI:" ${CMAKE_ANDROID_ARCH_ABI}) status(" STL type:" ${ANDROID_STL}) - status(" Native API level:" android-${ANDROID_NATIVE_API_LEVEL}) - android_get_compatible_target(android_sdk_target_status ${ANDROID_NATIVE_API_LEVEL} ${ANDROID_SDK_TARGET} 11) + status(" Native API level:" android-${CMAKE_SYSTEM_VERSION}) + android_get_compatible_target(android_sdk_target_status ${CMAKE_SYSTEM_VERSION} ${ANDROID_SDK_TARGET} 11) status(" SDK target:" "${android_sdk_target_status}") - if(BUILD_WITH_ANDROID_NDK) - status(" Android NDK:" "${ANDROID_NDK} (toolchain: ${ANDROID_TOOLCHAIN_NAME})") - elseif(BUILD_WITH_STANDALONE_TOOLCHAIN) - status(" Android toolchain:" "${ANDROID_STANDALONE_TOOLCHAIN}") - endif() + status(" Android NDK:" "${CMAKE_ANDROID_NDK} (toolchain: ${CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION})") status(" android tool:" ANDROID_EXECUTABLE THEN "${ANDROID_EXECUTABLE} (${ANDROID_TOOLS_Pkg_Desc})" ELSE NO) status(" Google Play manager:" BUILD_ANDROID_SERVICE THEN YES ELSE NO) status(" Android examples:" BUILD_ANDROID_EXAMPLES AND CAN_BUILD_ANDROID_PROJECTS THEN YES ELSE NO) diff --git a/cmake/OpenCVDetectAndroidSDK.cmake b/cmake/OpenCVDetectAndroidSDK.cmake index c8f7cba419c1..5bf11bd07423 100644 --- a/cmake/OpenCVDetectAndroidSDK.cmake +++ b/cmake/OpenCVDetectAndroidSDK.cmake @@ -199,10 +199,10 @@ macro(add_android_project target path) endforeach() # get compatible SDK target - android_get_compatible_target(android_proj_sdk_target ${ANDROID_NATIVE_API_LEVEL} ${android_proj_SDK_TARGET}) + android_get_compatible_target(android_proj_sdk_target ${CMAKE_SYSTEM_VERSION} ${android_proj_SDK_TARGET}) if(NOT android_proj_sdk_target) - message(WARNING "Can not find any SDK target compatible with: ${ANDROID_NATIVE_API_LEVEL} ${android_proj_SDK_TARGET} + message(WARNING "Can not find any SDK target compatible with: ${CMAKE_SYSTEM_VERSION} ${android_proj_SDK_TARGET} The project ${target} will not be build") endif() @@ -217,7 +217,7 @@ macro(add_android_project target path) # find if native_app_glue is used file(STRINGS "${path}/jni/Android.mk" NATIVE_APP_GLUE REGEX ".*(call import-module,android/native_app_glue)" ) if(NATIVE_APP_GLUE) - if(ANDROID_NATIVE_API_LEVEL LESS 9 OR NOT EXISTS "${ANDROID_NDK}/sources/android/native_app_glue") + if(CMAKE_SYSTEM_VERSION LESS 9 OR NOT EXISTS "${CMAKE_ANDROID_NDK}/sources/android/native_app_glue") set(OCV_DEPENDENCIES_FOUND FALSE) endif() endif() @@ -281,8 +281,8 @@ macro(add_android_project target path) if(JNI_LIB_NAME) if(NATIVE_APP_GLUE) - include_directories(${ANDROID_NDK}/sources/android/native_app_glue) - list(APPEND android_proj_jni_files ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c) + include_directories(${CMAKE_ANDROID_NDK}/sources/android/native_app_glue) + list(APPEND android_proj_jni_files ${CMAKE_ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c) ocv_warnings_disable(CMAKE_C_FLAGS -Wstrict-prototypes -Wunused-parameter -Wmissing-prototypes) set(android_proj_NATIVE_DEPS ${android_proj_NATIVE_DEPS} android) endif() @@ -294,7 +294,7 @@ macro(add_android_project target path) set_target_properties(${JNI_LIB_NAME} PROPERTIES OUTPUT_NAME "${JNI_LIB_NAME}" - LIBRARY_OUTPUT_DIRECTORY "${android_proj_bin_dir}/libs/${ANDROID_NDK_ABI_NAME}" + LIBRARY_OUTPUT_DIRECTORY "${android_proj_bin_dir}/libs/${CMAKE_ANDROID_ARCH_ABI}" ) get_target_property(android_proj_jni_location "${JNI_LIB_NAME}" LOCATION) diff --git a/cmake/OpenCVGenAndroidMK.cmake b/cmake/OpenCVGenAndroidMK.cmake index 9cc52147af80..ade1a7d22f1f 100644 --- a/cmake/OpenCVGenAndroidMK.cmake +++ b/cmake/OpenCVGenAndroidMK.cmake @@ -45,7 +45,7 @@ if(ANDROID) set(OPENCV_3RDPARTY_LIBS_DIR_CONFIGCMAKE "\$(OPENCV_THIS_DIR)/3rdparty/lib/\$(OPENCV_TARGET_ARCH_ABI)") configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCV.mk.in" "${CMAKE_BINARY_DIR}/OpenCV.mk" @ONLY) - configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCV-abi.mk.in" "${CMAKE_BINARY_DIR}/OpenCV-${ANDROID_NDK_ABI_NAME}.mk" @ONLY) + configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCV-abi.mk.in" "${CMAKE_BINARY_DIR}/OpenCV-${CMAKE_ANDROID_ARCH_ABI}.mk" @ONLY) # ------------------------------------------------------------------------------------------- # Part 2/2: ${BIN_DIR}/unix-install/OpenCV.mk -> For use with "make install" @@ -56,7 +56,7 @@ if(ANDROID) set(OPENCV_3RDPARTY_LIBS_DIR_CONFIGCMAKE "\$(OPENCV_THIS_DIR)/../3rdparty/libs/\$(OPENCV_TARGET_ARCH_ABI)") configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCV.mk.in" "${CMAKE_BINARY_DIR}/unix-install/OpenCV.mk" @ONLY) - configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCV-abi.mk.in" "${CMAKE_BINARY_DIR}/unix-install/OpenCV-${ANDROID_NDK_ABI_NAME}.mk" @ONLY) + configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCV-abi.mk.in" "${CMAKE_BINARY_DIR}/unix-install/OpenCV-${CMAKE_ANDROID_ARCH_ABI}.mk" @ONLY) install(FILES ${CMAKE_BINARY_DIR}/unix-install/OpenCV.mk DESTINATION ${OPENCV_CONFIG_INSTALL_PATH} COMPONENT dev) - install(FILES ${CMAKE_BINARY_DIR}/unix-install/OpenCV-${ANDROID_NDK_ABI_NAME}.mk DESTINATION ${OPENCV_CONFIG_INSTALL_PATH} COMPONENT dev) + install(FILES ${CMAKE_BINARY_DIR}/unix-install/OpenCV-${CMAKE_ANDROID_ARCH_ABI}.mk DESTINATION ${OPENCV_CONFIG_INSTALL_PATH} COMPONENT dev) endif(ANDROID) diff --git a/cmake/OpenCVGenConfig.cmake b/cmake/OpenCVGenConfig.cmake index 206acfdad969..d3b331f405ac 100644 --- a/cmake/OpenCVGenConfig.cmake +++ b/cmake/OpenCVGenConfig.cmake @@ -16,10 +16,10 @@ if(HAVE_CUDA) endif() if(ANDROID) - if(NOT ANDROID_NATIVE_API_LEVEL) + if(NOT CMAKE_SYSTEM_VERSION) set(OpenCV_ANDROID_NATIVE_API_LEVEL_CONFIGCMAKE 0) else() - set(OpenCV_ANDROID_NATIVE_API_LEVEL_CONFIGCMAKE "${ANDROID_NATIVE_API_LEVEL}") + set(OpenCV_ANDROID_NATIVE_API_LEVEL_CONFIGCMAKE "${CMAKE_SYSTEM_VERSION}") endif() ocv_cmake_configure("${CMAKE_CURRENT_LIST_DIR}/templates/OpenCVConfig-ANDROID.cmake.in" ANDROID_CONFIGCMAKE @ONLY) endif() @@ -96,7 +96,7 @@ if(UNIX AND NOT ANDROID) endif() if(ANDROID) - ocv_gen_config("${CMAKE_BINARY_DIR}/unix-install" "abi-${ANDROID_NDK_ABI_NAME}" "OpenCVConfig.root-ANDROID.cmake.in") + ocv_gen_config("${CMAKE_BINARY_DIR}/unix-install" "abi-${CMAKE_ANDROID_ARCH_ABI}" "OpenCVConfig.root-ANDROID.cmake.in") install(FILES "${OpenCV_SOURCE_DIR}/platforms/android/android.toolchain.cmake" DESTINATION "${OPENCV_CONFIG_INSTALL_PATH}" COMPONENT dev) endif() diff --git a/cmake/templates/OpenCVConfig-ANDROID.cmake.in b/cmake/templates/OpenCVConfig-ANDROID.cmake.in index 1787acab3883..b2033da7951c 100644 --- a/cmake/templates/OpenCVConfig-ANDROID.cmake.in +++ b/cmake/templates/OpenCVConfig-ANDROID.cmake.in @@ -4,7 +4,7 @@ set(OpenCV_ANDROID_NATIVE_API_LEVEL "@OpenCV_ANDROID_NATIVE_API_LEVEL_CONFIGCMAK # ============================================================== # Check OpenCV availability # ============================================================== -if(OpenCV_ANDROID_NATIVE_API_LEVEL GREATER ANDROID_NATIVE_API_LEVEL) +if(OpenCV_ANDROID_NATIVE_API_LEVEL GREATER CMAKE_SYSTEM_VERSION) if(NOT OpenCV_FIND_QUIETLY) message(WARNING "Minimum required by OpenCV API level is android-${OpenCV_ANDROID_NATIVE_API_LEVEL}") endif() diff --git a/cmake/templates/OpenCVConfig.root-ANDROID.cmake.in b/cmake/templates/OpenCVConfig.root-ANDROID.cmake.in index 7ceeec4c7f93..23797b0e4a8e 100644 --- a/cmake/templates/OpenCVConfig.root-ANDROID.cmake.in +++ b/cmake/templates/OpenCVConfig.root-ANDROID.cmake.in @@ -36,7 +36,7 @@ if(CMAKE_VERSION VERSION_LESS "2.8.3") endif() if(NOT DEFINED OpenCV_CONFIG_SUBDIR) - set(OpenCV_CONFIG_SUBDIR "/abi-${ANDROID_NDK_ABI_NAME}") + set(OpenCV_CONFIG_SUBDIR "/abi-${CMAKE_ANDROID_ARCH_ABI}") endif() set(OpenCV_CONFIG_PATH "${CMAKE_CURRENT_LIST_DIR}${OpenCV_CONFIG_SUBDIR}") diff --git a/modules/java/CMakeLists.txt b/modules/java/CMakeLists.txt index ed92e0511b2c..eee249721303 100644 --- a/modules/java/CMakeLists.txt +++ b/modules/java/CMakeLists.txt @@ -2,7 +2,7 @@ # CMake file for java support # ---------------------------------------------------------------------------- if(APPLE_FRAMEWORK OR WINRT OR NOT PYTHON_DEFAULT_AVAILABLE OR NOT ANT_EXECUTABLE - OR NOT (JNI_FOUND OR (ANDROID AND ANDROID_NATIVE_API_LEVEL GREATER 7)) + OR NOT (JNI_FOUND OR (ANDROID AND CMAKE_SYSTEM_VERSION GREATER 7)) OR BUILD_opencv_world ) ocv_module_disable(java) @@ -198,7 +198,7 @@ else() list(REMOVE_ITEM handwrittren_lib_project_files_rel "${ANDROID_MANIFEST_FILE}") # calc default SDK Target - android_get_compatible_target(android_sdk_target ${ANDROID_NATIVE_API_LEVEL} ${ANDROID_SDK_TARGET} 11) + android_get_compatible_target(android_sdk_target ${CMAKE_SYSTEM_VERSION} ${ANDROID_SDK_TARGET} 11) string(REGEX REPLACE "android-" "" android_sdk_target_num ${android_sdk_target}) # filter out if( (ANDROID_SDK_TARGET AND ANDROID_SDK_TARGET LESS 21) OR (android_sdk_target_num LESS 21) ) @@ -280,7 +280,7 @@ if(ANDROID AND ANDROID_EXECUTABLE) set(lib_target_files ${ANDROID_LIB_PROJECT_FILES}) ocv_list_add_prefix(lib_target_files "${OpenCV_BINARY_DIR}/") - android_get_compatible_target(lib_target_sdk_target ${ANDROID_NATIVE_API_LEVEL} ${ANDROID_SDK_TARGET} 14) + android_get_compatible_target(lib_target_sdk_target ${CMAKE_SYSTEM_VERSION} ${ANDROID_SDK_TARGET} 14) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/android_lib/${ANDROID_MANIFEST_FILE}" "${CMAKE_CURRENT_BINARY_DIR}/${ANDROID_MANIFEST_FILE}" @ONLY) add_custom_command(OUTPUT ${lib_target_files} "${OpenCV_BINARY_DIR}/${ANDROID_MANIFEST_FILE}" diff --git a/modules/java/android_test/CMakeLists.txt b/modules/java/android_test/CMakeLists.txt index 6d69de5a0f6c..95ce7a8b9e2a 100644 --- a/modules/java/android_test/CMakeLists.txt +++ b/modules/java/android_test/CMakeLists.txt @@ -49,7 +49,7 @@ get_filename_component(java_name "${java_location}" NAME) # build java part add_custom_command( OUTPUT "${opencv_test_java_bin_dir}/bin/OpenCVTest-debug.apk" - COMMAND ${CMAKE_COMMAND} -E copy_if_different "${java_location}" "${opencv_test_java_bin_dir}/libs/${ANDROID_NDK_ABI_NAME}/${java_name}" + COMMAND ${CMAKE_COMMAND} -E copy_if_different "${java_location}" "${opencv_test_java_bin_dir}/libs/${CMAKE_ANDROID_ARCH_ABI}/${java_name}" COMMAND ${ANT_EXECUTABLE} -q -noinput -k debug -Djava.target=1.6 -Djava.source=1.6 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}" diff --git a/modules/ts/misc/run_utils.py b/modules/ts/misc/run_utils.py index 8740aa7855ca..0a05e8ed697f 100644 --- a/modules/ts/misc/run_utils.py +++ b/modules/ts/misc/run_utils.py @@ -162,8 +162,8 @@ def testSIMD(compiler, cxx_flags, compiler_arg = None): {'name': "cxx_flags_debug", 'default': "", 'pattern': re.compile(r"^CMAKE_CXX_FLAGS_DEBUG:STRING=(.*)$")}, {'name': "cxx_flags_release", 'default': "", 'pattern': re.compile(r"^CMAKE_CXX_FLAGS_RELEASE:STRING=(.*)$")}, {'name': "opencv_cxx_flags", 'default': "", 'pattern': re.compile(r"^OPENCV_EXTRA_C_FLAGS:INTERNAL=(.*)$")}, - {'name': "cxx_flags_android", 'default': None, 'pattern': re.compile(r"^ANDROID_CXX_FLAGS:INTERNAL=(.*)$")}, - {'name': "android_abi", 'default': None, 'pattern': re.compile(r"^ANDROID_ABI:STRING=(.*)$")}, + {'name': "cxx_flags_android", 'default': None, 'pattern': re.compile(r"^CMAKE_CXX_FLAGS:INTERNAL=(.*)$")}, + {'name': "android_abi", 'default': None, 'pattern': re.compile(r"^CMAKE_ANDROID_ARCH_ABI:STRING=(.*)$")}, {'name': "android_executable", 'default': None, 'pattern': re.compile(r"^ANDROID_EXECUTABLE:FILEPATH=(.*android.*)$")}, {'name': "ant_executable", 'default': None, 'pattern': re.compile(r"^ANT_EXECUTABLE:FILEPATH=(.*ant.*)$")}, {'name': "java_test_binary_dir", 'default': None, 'pattern': re.compile(r"^opencv_test_java_BINARY_DIR:STATIC=(.*)$")},