mirror of https://github.com/opencv/opencv.git
- properly detect Android SDK support of Ant/Gradle projects - divide processing of And/Gradle based projectspull/11200/head
parent
f93c1b942a
commit
6abfc6761e
6 changed files with 343 additions and 141 deletions
@ -0,0 +1,210 @@ |
||||
if(EXISTS "${ANDROID_EXECUTABLE}") |
||||
set(ANDROID_SDK_DETECT_QUIET TRUE) |
||||
endif() |
||||
|
||||
# fixup for https://github.com/android-ndk/ndk/issues/596 |
||||
if(DEFINED ANDROID_NDK_REVISION AND ANDROID_NDK_REVISION MATCHES "(1[56])([0-9]+)\\.([^\n]+)\n") |
||||
set(ANDROID_NDK_REVISION "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}.${CMAKE_MATCH_3}") |
||||
set(ANDROID_NDK_REVISION "${ANDROID_NDK_REVISION}" CACHE INTERNAL "Android NDK revision") |
||||
endif() |
||||
|
||||
# https://developer.android.com/studio/command-line/variables.html |
||||
ocv_check_environment_variables(ANDROID_SDK_ROOT ANDROID_HOME ANDROID_SDK) |
||||
|
||||
set(__msg_BUILD_ANDROID_PROJECTS "Use BUILD_ANDROID_PROJECTS=OFF to prepare Android project files without building them") |
||||
|
||||
macro(ocv_detect_android_sdk) |
||||
if(NOT DEFINED ANDROID_SDK) |
||||
if(DEFINED ANDROID_SDK AND EXISTS "${ANDROID_SDK}") |
||||
set(ANDROID_SDK "${ANDROID_SDK}" CACHE INTERNAL "Android SDK path") |
||||
elseif(DEFINED ANDROID_HOME AND EXISTS "${ANDROID_HOME}") |
||||
set(ANDROID_SDK "${ANDROID_HOME}" CACHE INTERNAL "Android SDK path") |
||||
elseif(DEFINED ANDROID_SDK_ROOT AND EXISTS "${ANDROID_SDK_ROOT}") |
||||
set(ANDROID_SDK "${ANDROID_SDK_ROOT}" CACHE INTERNAL "Android SDK path") |
||||
endif() |
||||
if(DEFINED ANDROID_SDK) |
||||
message(STATUS "Android SDK: using location: ${ANDROID_SDK}") |
||||
endif() |
||||
endif() |
||||
if(NOT DEFINED ANDROID_SDK) |
||||
message(FATAL_ERROR "Android SDK: specify path to Android SDK via ANDROID_SDK_ROOT / ANDROID_HOME / ANDROID_SDK variables") |
||||
endif() |
||||
if(NOT EXISTS "${ANDROID_SDK}") |
||||
message(FATAL_ERROR "Android SDK: specified path doesn't exist: ${ANDROID_SDK}") |
||||
endif() |
||||
endmacro() |
||||
|
||||
macro(ocv_detect_android_sdk_tools) |
||||
# https://developer.android.com/studio/releases/sdk-tools.html |
||||
if(NOT DEFINED ANDROID_SDK_TOOLS) |
||||
if(DEFINED ANDROID_SDK AND EXISTS "${ANDROID_SDK}/tools") |
||||
set(ANDROID_SDK_TOOLS "${ANDROID_SDK}/tools" CACHE INTERNAL "Android SDK Tools path") |
||||
endif() |
||||
endif() |
||||
if(NOT DEFINED ANDROID_SDK_TOOLS) |
||||
message(FATAL_ERROR "Android SDK Tools: can't automatically find Android SDK Tools. Specify path via ANDROID_SDK_TOOLS variable") |
||||
endif() |
||||
if(NOT EXISTS "${ANDROID_SDK_TOOLS}") |
||||
message(FATAL_ERROR "Android SDK Tools: specified path doesn't exist: ${ANDROID_SDK_TOOLS}") |
||||
endif() |
||||
|
||||
if(NOT DEFINED ANDROID_SDK_TOOLS_VERSION) |
||||
ocv_parse_properties_file("${ANDROID_SDK_TOOLS}/source.properties" |
||||
ANDROID_TOOLS CACHE Pkg_Revision |
||||
MSG_PREFIX "Android SDK Tools: " |
||||
) |
||||
|
||||
if(NOT DEFINED ANDROID_TOOLS_Pkg_Revision) |
||||
message(FATAL_ERROR "Android SDK Tools: Can't determine package version: ANDROID_SDK_TOOLS=${ANDROID_SDK_TOOLS}\n" |
||||
"Check specified parameters or force version via 'ANDROID_SDK_TOOLS_VERSION' variable.\n" |
||||
"${__msg_BUILD_ANDROID_PROJECTS}") |
||||
elseif(NOT ANDROID_SDK_DETECT_QUIET) |
||||
set(__info "") |
||||
if(DEFINED ANDROID_TOOLS_Pkg_Desc) |
||||
set(__info " (description: '${ANDROID_TOOLS_Pkg_Desc}')") |
||||
endif() |
||||
message(STATUS "Android SDK Tools: ver. ${ANDROID_TOOLS_Pkg_Revision}${__info}") |
||||
endif() |
||||
set(ANDROID_SDK_TOOLS_VERSION "${ANDROID_TOOLS_Pkg_Revision}" CACHE INTERNAL "Android SDK Tools version") |
||||
endif() |
||||
if(NOT DEFINED ANDROID_TOOLS_Pkg_Revision) |
||||
set(ANDROID_TOOLS_Pkg_Revision "${ANDROID_SDK_TOOLS_VERSION}" CACHE INTERNAL "Android SDK Tools version (deprecated)") |
||||
endif() |
||||
set(ANDROID_SDK_TOOLS_PATH "${ANDROID_SDK_TOOLS}" CACHE INTERNAL "Android SDK Tools path (deprecated)") |
||||
endmacro() # ocv_detect_android_sdk_tools |
||||
|
||||
macro(ocv_detect_android_sdk_build_tools) |
||||
# https://developer.android.com/studio/releases/build-tools.html |
||||
if(NOT DEFINED ANDROID_SDK_BUILD_TOOLS_VERSION) |
||||
if(NOT DEFINED ANDROID_SDK_BUILD_TOOLS) |
||||
set(__search_dir ${ANDROID_SDK}/build-tools) |
||||
if(NOT EXISTS "${__search_dir}") |
||||
message(FATAL_ERROR "Android SDK Build Tools: directory doesn't exist: ${__search_dir} " |
||||
"${__msg_BUILD_ANDROID_PROJECTS}") |
||||
endif() |
||||
|
||||
if(NOT DEFINED ANDROID_SDK_BUILD_TOOLS_SUBDIR) |
||||
file(GLOB __found RELATIVE "${__search_dir}" ${__search_dir}/*) |
||||
set(__dirlist "") |
||||
set(__selected 0) |
||||
set(__versions "") |
||||
foreach(d ${__found}) |
||||
if(IS_DIRECTORY "${__search_dir}/${d}") |
||||
list(APPEND __dirlist ${d}) |
||||
if(d MATCHES "[0-9]+(\\.[0-9]+)*") |
||||
list(APPEND __versions "${d}") |
||||
endif() |
||||
if(__selected VERSION_LESS d) |
||||
set(__selected "${d}") |
||||
endif() |
||||
endif() |
||||
endforeach() |
||||
if(__selected VERSION_GREATER 0) |
||||
set(ANDROID_SDK_BUILD_TOOLS_SUBDIR "${__selected}") |
||||
elseif(__dirlist) |
||||
set(__versions "") |
||||
foreach(d ${__dirlist}) |
||||
if(EXISTS "${__search_dir}/${d}/source.properties") |
||||
ocv_clear_vars(ANDROID_BUILD_TOOLS_Pkg_Revision) |
||||
ocv_parse_properties_file("${__search_dir}/${d}/source.properties" |
||||
ANDROID_BUILD_TOOLS |
||||
MSG_PREFIX "Android SDK Tools: " |
||||
) |
||||
if(DEFINED ANDROID_BUILD_TOOLS_Pkg_Revision) |
||||
list(APPEND __versions "${ANDROID_BUILD_TOOLS_Pkg_Revision}") |
||||
if(__selected VERSION_LESS ANDROID_BUILD_TOOLS_Pkg_Revision) |
||||
set(ANDROID_SDK_BUILD_TOOLS_SUBDIR "${d}") |
||||
set(__selected "${ANDROID_BUILD_TOOLS_Pkg_Revision}") |
||||
endif() |
||||
endif() |
||||
endif() |
||||
endforeach() |
||||
endif() |
||||
if(DEFINED ANDROID_SDK_BUILD_TOOLS_SUBDIR) |
||||
set(ANDROID_SDK_BUILD_TOOLS_VERSION "${__selected}" CACHE STRING "Android SDK Build Tools version") |
||||
set_property(CACHE ANDROID_SDK_BUILD_TOOLS_VERSION PROPERTY STRINGS ${__versions}) |
||||
set(ANDROID_SDK_BUILD_TOOLS "${__search_dir}/${d}" CACHE INTERNAL "Android SDK Build Tools path") |
||||
message(STATUS "Android SDK Build Tools: ver. ${ANDROID_SDK_BUILD_TOOLS_VERSION} (subdir ${ANDROID_SDK_BUILD_TOOLS_SUBDIR} from ${__dirlist})") |
||||
else() |
||||
message(FATAL_ERROR "Android SDK Build Tools: autodetection failed. " |
||||
"Specify ANDROID_SDK_BUILD_TOOLS_VERSION / ANDROID_SDK_BUILD_TOOLS_SUBDIR / ANDROID_SDK_BUILD_TOOLS variable to bypass autodetection.\n" |
||||
"${__msg_BUILD_ANDROID_PROJECTS}") |
||||
endif() |
||||
endif() |
||||
else() |
||||
ocv_parse_properties_file("${ANDROID_SDK_BUILD_TOOLS}/source.properties" |
||||
ANDROID_BUILD_TOOLS |
||||
MSG_PREFIX "Android SDK Tools: " |
||||
) |
||||
if(NOT DEFINED ANDROID_BUILD_TOOLS_Pkg_Revision) |
||||
message(FATAL_ERROR "Android SDK Build Tools: Can't detect version: ANDROID_SDK_BUILD_TOOLS=${ANDROID_SDK_BUILD_TOOLS}\n" |
||||
"Specify ANDROID_SDK_BUILD_TOOLS_VERSION variable to bypass autodetection.\n" |
||||
"${__msg_BUILD_ANDROID_PROJECTS}") |
||||
else() |
||||
set(ANDROID_SDK_BUILD_TOOLS_VERSION "${ANDROID_BUILD_TOOLS_Pkg_Revision}" CACHE INTERNAL "Android SDK Build Tools version") |
||||
message(STATUS "Android SDK Build Tools: ver. ${ANDROID_SDK_BUILD_TOOLS_VERSION} (ANDROID_SDK_BUILD_TOOLS=${ANDROID_SDK_BUILD_TOOLS})") |
||||
endif() |
||||
endif() # ANDROID_SDK_BUILD_TOOLS |
||||
endif() # ANDROID_SDK_BUILD_TOOLS_VERSION |
||||
endmacro() # ocv_detect_android_sdk_build_tools |
||||
|
||||
|
||||
if(BUILD_ANDROID_PROJECTS) |
||||
ocv_detect_android_sdk() |
||||
ocv_detect_android_sdk_tools() |
||||
ocv_detect_android_sdk_build_tools() |
||||
|
||||
if(ANDROID_SDK_TOOLS_VERSION VERSION_LESS 14) |
||||
message(FATAL_ERROR "Android SDK Tools: OpenCV requires Android SDK Tools revision 14 or newer.\n" |
||||
"${__msg_BUILD_ANDROID_PROJECTS}") |
||||
endif() |
||||
|
||||
if(NOT ANDROID_SDK_TOOLS_VERSION VERSION_LESS 25.3.0) |
||||
message(STATUS "Android SDK Tools: Ant (Eclipse) builds are NOT supported by Android SDK") |
||||
ocv_update(ANDROID_PROJECTS_SUPPORT_ANT OFF) |
||||
if(NOT ANDROID_SDK_BUILD_TOOLS_VERSION VERSION_LESS 26.0.2) |
||||
# https://developer.android.com/studio/releases/gradle-plugin.html |
||||
message(STATUS "Android SDK Build Tools: Gradle 3.0.0+ builds support is available") |
||||
ocv_update(ANDROID_PROJECTS_SUPPORT_GRADLE ON) |
||||
endif() |
||||
else() |
||||
include(${CMAKE_CURRENT_LIST_DIR}/../OpenCVDetectApacheAnt.cmake) |
||||
if(ANT_EXECUTABLE AND NOT ANT_VERSION VERSION_LESS 1.7) |
||||
message(STATUS "Android SDK Tools: Ant (Eclipse) builds are supported") |
||||
ocv_update(ANDROID_PROJECTS_SUPPORT_ANT ON) |
||||
endif() |
||||
endif() |
||||
|
||||
if(NOT DEFINED ANDROID_PROJECTS_BUILD_TYPE) |
||||
if(ANDROID_PROJECTS_SUPPORT_ANT) |
||||
ocv_update(ANDROID_PROJECTS_BUILD_TYPE "ANT") |
||||
elseif(ANDROID_PROJECTS_SUPPORT_GRADLE) |
||||
ocv_update(ANDROID_PROJECTS_BUILD_TYPE "GRADLE") |
||||
else() |
||||
message(FATAL_ERROR "Android SDK: Can't build Android projects as requested by BUILD_ANDROID_PROJECTS=ON variable.\n" |
||||
"${__msg_BUILD_ANDROID_PROJECTS}") |
||||
endif() |
||||
endif() |
||||
|
||||
if(ANDROID_PROJECTS_BUILD_TYPE STREQUAL "ANT") |
||||
message(STATUS "Android SDK Tools: Prepare Android projects for using Ant build scripts (deprecated)") |
||||
elseif(ANDROID_PROJECTS_BUILD_TYPE STREQUAL "GRADLE") |
||||
message(STATUS "Android SDK Tools: Prepare Android projects for using Gradle 3.0.0+ build scripts") |
||||
endif() |
||||
|
||||
else() |
||||
message("Android: Projects builds are DISABLED") |
||||
macro(add_android_project) |
||||
endmacro() |
||||
endif() # BUILD_ANDROID_PROJECTS |
||||
|
||||
if(ANDROID_PROJECTS_BUILD_TYPE STREQUAL "ANT") |
||||
include(${CMAKE_CURRENT_LIST_DIR}/android_ant_projects.cmake) |
||||
elseif(ANDROID_PROJECTS_BUILD_TYPE STREQUAL "GRADLE") |
||||
include(${CMAKE_CURRENT_LIST_DIR}/android_gradle_projects.cmake) |
||||
elseif(BUILD_ANDROID_PROJECTS) |
||||
message(FATAL_ERROR "Internal error") |
||||
else() |
||||
# TODO |
||||
#include(${CMAKE_CURRENT_LIST_DIR}/android_disabled_projects.cmake) |
||||
endif() |
@ -1,133 +1,44 @@ |
||||
if(EXISTS "${ANDROID_EXECUTABLE}") |
||||
set(ANDROID_SDK_DETECT_QUIET TRUE) |
||||
endif() |
||||
|
||||
file(TO_CMAKE_PATH "$ENV{ProgramFiles}" ProgramFiles_ENV_PATH) |
||||
file(TO_CMAKE_PATH "$ENV{HOME}" HOME_ENV_PATH) |
||||
|
||||
if(CMAKE_HOST_WIN32) |
||||
set(ANDROID_SDK_OS windows) |
||||
elseif(CMAKE_HOST_APPLE) |
||||
set(ANDROID_SDK_OS macosx) |
||||
else() |
||||
set(ANDROID_SDK_OS linux) |
||||
endif() |
||||
|
||||
#find android SDK: search in ANDROID_SDK first |
||||
find_host_program(ANDROID_EXECUTABLE |
||||
NAMES android.bat android |
||||
PATH_SUFFIXES tools |
||||
PATHS |
||||
ENV ANDROID_SDK |
||||
DOC "Android SDK location" |
||||
NO_DEFAULT_PATH |
||||
) |
||||
|
||||
# Now search default paths |
||||
find_host_program(ANDROID_EXECUTABLE |
||||
NAMES android.bat android |
||||
PATH_SUFFIXES android-sdk-${ANDROID_SDK_OS}/tools |
||||
android-sdk-${ANDROID_SDK_OS}_x86/tools |
||||
android-sdk-${ANDROID_SDK_OS}_86/tools |
||||
android-sdk/tools |
||||
PATHS /opt |
||||
"${HOME_ENV_PATH}/NVPACK" |
||||
"$ENV{SystemDrive}/NVPACK" |
||||
"${ProgramFiles_ENV_PATH}/Android" |
||||
DOC "Android SDK location" |
||||
) |
||||
|
||||
if(ANDROID_EXECUTABLE) |
||||
if(NOT ANDROID_SDK_DETECT_QUIET) |
||||
message(STATUS "Found android tool: ${ANDROID_EXECUTABLE}") |
||||
endif() |
||||
|
||||
get_filename_component(ANDROID_SDK_TOOLS_PATH "${ANDROID_EXECUTABLE}" PATH) |
||||
|
||||
#read source.properties |
||||
if(EXISTS "${ANDROID_SDK_TOOLS_PATH}/source.properties") |
||||
file(STRINGS "${ANDROID_SDK_TOOLS_PATH}/source.properties" ANDROID_SDK_TOOLS_SOURCE_PROPERTIES_LINES REGEX "^[ ]*[^#].*$") |
||||
foreach(line ${ANDROID_SDK_TOOLS_SOURCE_PROPERTIES_LINES}) |
||||
string(REPLACE "\\:" ":" line ${line}) |
||||
string(REPLACE "=" ";" line ${line}) |
||||
list(GET line 0 line_name) |
||||
list(GET line 1 line_value) |
||||
string(REPLACE "." "_" line_name ${line_name}) |
||||
SET(ANDROID_TOOLS_${line_name} "${line_value}" CACHE INTERNAL "from ${ANDROID_SDK_TOOLS_PATH}/source.properties") |
||||
MARK_AS_ADVANCED(ANDROID_TOOLS_${line_name}) |
||||
endforeach() |
||||
endif() |
||||
|
||||
#fix missing revision (SDK tools before r9 don't set revision number correctly) |
||||
if(NOT ANDROID_TOOLS_Pkg_Revision) |
||||
SET(ANDROID_TOOLS_Pkg_Revision "Unknown" CACHE INTERNAL "") |
||||
MARK_AS_ADVANCED(ANDROID_TOOLS_Pkg_Revision) |
||||
endif() |
||||
|
||||
#fix missing description |
||||
if(NOT ANDROID_TOOLS_Pkg_Desc) |
||||
SET(ANDROID_TOOLS_Pkg_Desc "Android SDK Tools, revision ${ANDROID_TOOLS_Pkg_Revision}." CACHE INTERNAL "") |
||||
MARK_AS_ADVANCED(ANDROID_TOOLS_Pkg_Desc) |
||||
endif() |
||||
PATHS "${ANDROID_SDK_TOOLS}" |
||||
DOC "Android 'android' tool location" |
||||
) |
||||
|
||||
#warn about outdated SDK |
||||
if(NOT ANDROID_TOOLS_Pkg_Revision GREATER 13) |
||||
SET(ANDROID_TOOLS_Pkg_Desc "${ANDROID_TOOLS_Pkg_Desc} It is recommended to update your SDK tools to revision 14 or newer." CACHE INTERNAL "") |
||||
endif() |
||||
if(NOT ANDROID_EXECUTABLE) |
||||
message(FATAL_ERROR "Android SDK Tools: Can't find 'android' tool") |
||||
elseif(NOT ANDROID_SDK_DETECT_QUIET) |
||||
message(STATUS "Android SDK Tools: Found 'android' tool: ${ANDROID_EXECUTABLE}") |
||||
endif() |
||||
|
||||
if(ANDROID_TOOLS_Pkg_Revision GREATER 13) |
||||
SET(ANDROID_PROJECT_PROPERTIES_FILE project.properties) |
||||
SET(ANDROID_ANT_PROPERTIES_FILE ant.properties) |
||||
else() |
||||
SET(ANDROID_PROJECT_PROPERTIES_FILE default.properties) |
||||
SET(ANDROID_ANT_PROPERTIES_FILE build.properties) |
||||
endif() |
||||
set(ANDROID_PROJECT_PROPERTIES_FILE project.properties) |
||||
set(ANDROID_ANT_PROPERTIES_FILE ant.properties) |
||||
|
||||
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_LIB_PROJECT_FILES}) |
||||
|
||||
#get installed targets |
||||
if(ANDROID_TOOLS_Pkg_Revision GREATER 11) |
||||
execute_process(COMMAND ${ANDROID_EXECUTABLE} list target -c |
||||
RESULT_VARIABLE ANDROID_PROCESS |
||||
OUTPUT_VARIABLE ANDROID_SDK_TARGETS |
||||
ERROR_VARIABLE ANDROID_PROCESS_ERRORS |
||||
OUTPUT_STRIP_TRAILING_WHITESPACE |
||||
) |
||||
string(REGEX MATCHALL "[^\n]+" ANDROID_SDK_TARGETS "${ANDROID_SDK_TARGETS}") |
||||
else() |
||||
#old SDKs (r11 and older) don't provide compact list |
||||
execute_process(COMMAND ${ANDROID_EXECUTABLE} list target |
||||
RESULT_VARIABLE ANDROID_PROCESS |
||||
OUTPUT_VARIABLE ANDROID_SDK_TARGETS_FULL |
||||
ERROR_VARIABLE ANDROID_PROCESS_ERRORS |
||||
OUTPUT_STRIP_TRAILING_WHITESPACE |
||||
) |
||||
string(REGEX MATCHALL "(^|\n)id: [0-9]+ or \"([^\n]+[0-9+])\"(\n|$)" ANDROID_SDK_TARGETS_FULL "${ANDROID_SDK_TARGETS_FULL}") |
||||
|
||||
SET(ANDROID_SDK_TARGETS "") |
||||
if(ANDROID_PROCESS EQUAL 0) |
||||
foreach(line ${ANDROID_SDK_TARGETS_FULL}) |
||||
string(REGEX REPLACE "(^|\n)id: [0-9]+ or \"([^\n]+[0-9+])\"(\n|$)" "\\2" line "${line}") |
||||
list(APPEND ANDROID_SDK_TARGETS "${line}") |
||||
endforeach() |
||||
endif() |
||||
endif() |
||||
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_LIB_PROJECT_FILES}) |
||||
|
||||
if(NOT ANDROID_PROCESS EQUAL 0) |
||||
message(ERROR "Failed to get list of installed Android targets.") |
||||
set(ANDROID_EXECUTABLE "ANDROID_EXECUTABLE-NOTFOUND") |
||||
endif() |
||||
execute_process(COMMAND ${ANDROID_EXECUTABLE} list target -c |
||||
RESULT_VARIABLE ANDROID_PROCESS |
||||
OUTPUT_VARIABLE ANDROID_SDK_TARGETS |
||||
ERROR_VARIABLE ANDROID_PROCESS_ERRORS |
||||
OUTPUT_STRIP_TRAILING_WHITESPACE |
||||
) |
||||
if(NOT ANDROID_PROCESS EQUAL 0) |
||||
set(ANDROID_EXECUTABLE "ANDROID_EXECUTABLE-NOTFOUND" CACHE INTERNAL) |
||||
message(FATAL_ERROR "Android: Failed to get list of installed Android targets.") |
||||
endif() |
||||
string(REGEX MATCHALL "[^\n]+" ANDROID_SDK_TARGETS "${ANDROID_SDK_TARGETS}") |
||||
|
||||
# clear ANDROID_SDK_TARGET if no target is provided by user |
||||
if(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) |
||||
set_property( CACHE ANDROID_SDK_TARGET PROPERTY STRINGS ${ANDROID_SDK_TARGETS} ) |
||||
endif() |
||||
endif(ANDROID_EXECUTABLE) |
||||
# clear ANDROID_SDK_TARGET if no target is provided by user |
||||
if(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) |
||||
message(STATUS "Android SDK Tools: Available targets: ${ANDROID_SDK_TARGETS}") |
||||
set_property(CACHE ANDROID_SDK_TARGET PROPERTY STRINGS ${ANDROID_SDK_TARGETS} ) |
||||
else() |
||||
message(FATAL_ERROR "Android: List of installed Android targets is empty") |
||||
endif() |
||||
|
||||
# finds minimal installed SDK target compatible with provided names or API levels |
||||
# usage: |
@ -0,0 +1,5 @@ |
||||
message(FATAL_ERROR " |
||||
Android gradle-based build/projects are not supported in this version of OpenCV. |
||||
You need to downgrade Android SDK Tools to version 25.2.5. |
||||
Details: https://github.com/opencv/opencv/issues/8460 |
||||
") |
Loading…
Reference in new issue