Skip to content
This repository has been archived by the owner on Mar 22, 2020. It is now read-only.

Commit

Permalink
Merge pull request #15 from xsacha/hunter-3.2.0
Browse files Browse the repository at this point in the history
Rename ANDROID_ vars to CMAKE_ vars.
  • Loading branch information
ruslo authored Apr 4, 2017
2 parents 5b0cc90 + 555605f commit dc0a7c2
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 39 deletions.
2 changes: 1 addition & 1 deletion 3rdparty/ippicv/downloader.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
29 changes: 11 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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()
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
12 changes: 6 additions & 6 deletions cmake/OpenCVDetectAndroidSDK.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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()
Expand Down Expand Up @@ -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()
Expand All @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions cmake/OpenCVGenAndroidMK.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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)
6 changes: 3 additions & 3 deletions cmake/OpenCVGenConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion cmake/templates/OpenCVConfig-ANDROID.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion cmake/templates/OpenCVConfig.root-ANDROID.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down
6 changes: 3 additions & 3 deletions modules/java/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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) )
Expand Down Expand Up @@ -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}"
Expand Down
2 changes: 1 addition & 1 deletion modules/java/android_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
4 changes: 2 additions & 2 deletions modules/ts/misc/run_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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=(.*)$")},
Expand Down

0 comments on commit dc0a7c2

Please sign in to comment.