Refactored Java wrapper build scripts.
Improved Android SDK search, fixed some bugs.
This commit is contained in:
@@ -1,31 +1,47 @@
|
||||
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{ANDROID_SDK}" ANDROID_SDK_ENV_PATH)
|
||||
file(TO_CMAKE_PATH "$ENV{HOME}" HOME_ENV_PATH)
|
||||
|
||||
#find android SDK
|
||||
if(CMAKE_HOST_WIN32)
|
||||
set(ANDROID_SDK_OS windows)
|
||||
elseif(CMAKE_HOST_APPLE)
|
||||
set(ANDROID_SDK_OS mac)
|
||||
else()
|
||||
set(ANDROID_SDK_OS linux)
|
||||
endif()
|
||||
|
||||
#find android SDK: search in ANDROID_SDK first
|
||||
find_host_program(ANDROID_EXECUTABLE
|
||||
NAMES android.bat android
|
||||
PATHS "${ANDROID_SDK_ENV_PATH}/tools/"
|
||||
"${ProgramFiles_ENV_PATH}/Android/android-sdk/tools/"
|
||||
"${ProgramFiles_ENV_PATH}/Android/android-sdk-windows/tools/"
|
||||
"/opt/android-sdk-linux/tools/"
|
||||
"/opt/android-sdk-linux_x86/tools/"
|
||||
"/opt/android-sdk-linux_86/tools/"
|
||||
"/opt/android-sdk-mac/tools/"
|
||||
"/opt/android-sdk-mac_x86/tools/"
|
||||
"/opt/android-sdk-mac_86/tools/"
|
||||
"/opt/android-sdk/tools/"
|
||||
"${HOME_ENV_PATH}/NVPACK/android-sdk-linux_x86/tools/"
|
||||
"${HOME_ENV_PATH}/NVPACK/android-sdk-linux_86/tools/"
|
||||
"${HOME_ENV_PATH}/NVPACK/android-sdk-linux/tools/"
|
||||
"${HOME_ENV_PATH}/NVPACK/android-sdk-mac_x86/tools/"
|
||||
"${HOME_ENV_PATH}/NVPACK/android-sdk-mac_86/tools/"
|
||||
"${HOME_ENV_PATH}/NVPACK/android-sdk-mac/tools/"
|
||||
"$ENV{SystemDrive}/NVPACK/android-sdk-windows/tools/"
|
||||
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)
|
||||
message(STATUS " Found android tool: ${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
|
||||
@@ -42,37 +58,70 @@ if(ANDROID_EXECUTABLE)
|
||||
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 "")
|
||||
if(NOT ANDROID_TOOLS_Pkg_Revision GREATER 11)
|
||||
SET(ANDROID_TOOLS_Pkg_Desc "${ANDROID_TOOLS_Pkg_Desc} It is recommended to update your SDK tools to revision 12 or newer." CACHE INTERNAL "")
|
||||
endif()
|
||||
MARK_AS_ADVANCED(ANDROID_TOOLS_Pkg_Desc)
|
||||
endif()
|
||||
|
||||
#get installed targets
|
||||
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}")
|
||||
#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()
|
||||
|
||||
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()
|
||||
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_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_ANT_PROPERTIES_FILE} ${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()
|
||||
|
||||
if(NOT ANDROID_PROCESS EQUAL 0)
|
||||
message(ERROR "Failed to get list of installed Android targets.")
|
||||
set(ANDROID_EXECUTABLE "ANDROID_EXECUTABLE-NOTFOUND")
|
||||
endif()
|
||||
|
||||
# detect ANDROID_SDK_TARGET if no target is provided by user
|
||||
#TODO: remove this block
|
||||
if(NOT ANDROID_SDK_TARGET)
|
||||
set(desired_android_target_level ${ANDROID_NATIVE_API_LEVEL})
|
||||
if(desired_android_target_level LESS 11)
|
||||
@@ -95,8 +144,51 @@ if(ANDROID_EXECUTABLE)
|
||||
endif(NOT ANDROID_SDK_TARGET)
|
||||
|
||||
SET(ANDROID_SDK_TARGET "${ANDROID_SDK_TARGET}" CACHE STRING "SDK target for Android tests and samples")
|
||||
if(ANDROID_PROCESS EQUAL 0 AND CMAKE_VERSION VERSION_GREATER "2.8")
|
||||
set_property( CACHE ANDROID_SDK_TARGET PROPERTY STRINGS ${ANDROID_SDK_TARGETS} )
|
||||
endif()
|
||||
string(REGEX MATCH "[0-9]+$" ANDROID_SDK_TARGET_LEVEL "${ANDROID_SDK_TARGET}")
|
||||
endif(ANDROID_EXECUTABLE)
|
||||
|
||||
# finds minimal installed SDK target compatible with provided names or API levels
|
||||
# usage:
|
||||
# get_compatible_android_api_level(VARIABLE [level1] [level2] ...)
|
||||
macro(android_get_compatible_target VAR)
|
||||
set(${VAR} "${VAR}-NOTFOUND")
|
||||
if(ANDROID_SDK_TARGETS)
|
||||
list(GET ANDROID_SDK_TARGETS 1 __lvl)
|
||||
string(REGEX MATCH "[0-9]+$" __lvl "${__lvl}")
|
||||
|
||||
#find minimal level mathing to all provided levels
|
||||
foreach(lvl ${ARGN})
|
||||
string(REGEX MATCH "[0-9]+$" __level "${lvl}")
|
||||
if(__level GREATER __lvl)
|
||||
set(__lvl ${__level})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
#search for compatible levels
|
||||
foreach(lvl ${ANDROID_SDK_TARGETS})
|
||||
string(REGEX MATCH "[0-9]+$" __level "${lvl}")
|
||||
if(__level EQUAL __lvl)
|
||||
#look for exact match
|
||||
foreach(usrlvl ${ARGN})
|
||||
if("${usrlvl}" STREQUAL "${lvl}")
|
||||
set(${VAR} "${lvl}")
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
if("${${VAR}}" STREQUAL "${lvl}")
|
||||
break() #exact match was found
|
||||
elseif(NOT ${VAR})
|
||||
set(${VAR} "${lvl}")
|
||||
endif()
|
||||
elseif(__level GREATER __lvl)
|
||||
if(NOT ${VAR})
|
||||
set(${VAR} "${lvl}")
|
||||
endif()
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
unset(__lvl)
|
||||
unset(__level)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
@@ -76,20 +76,20 @@ macro(ocv_add_dependencies full_modname)
|
||||
endif()
|
||||
set(OPENCV_MODULE_${full_modname}_REQ_DEPS ${OPENCV_MODULE_${full_modname}_REQ_DEPS} CACHE INTERNAL "Required dependencies of ${full_modname} module")
|
||||
set(OPENCV_MODULE_${full_modname}_OPT_DEPS ${OPENCV_MODULE_${full_modname}_OPT_DEPS} CACHE INTERNAL "Optional dependencies of ${full_modname} module")
|
||||
|
||||
|
||||
unset(__depsvar)
|
||||
endmacro()
|
||||
|
||||
# declare new OpenCV module in current folder
|
||||
# Usage:
|
||||
# ocv_add_module(<name> [INTERNAL|BINDINGS] [REQUIRED] [<list of dependencies>] [OPTIONAL <list of optional dependencies>])
|
||||
# ocv_add_module(<name> [INTERNAL|BINDINGS] [REQUIRED] [<list of dependencies>] [OPTIONAL <list of optional dependencies>])
|
||||
# Example:
|
||||
# ocv_add_module(yaom INTERNAL opencv_core opencv_highgui NOLINK opencv_flann OPTIONAL opencv_gpu)
|
||||
macro(ocv_add_module _name)
|
||||
string(TOLOWER "${_name}" name)
|
||||
string(REGEX REPLACE "^opencv_" "" ${name} "${name}")
|
||||
set(the_module opencv_${name})
|
||||
|
||||
|
||||
# the first pass - collect modules info, the second pass - create targets
|
||||
if(OPENCV_INITIAL_PASS)
|
||||
#guard agains redefinition
|
||||
@@ -108,7 +108,7 @@ macro(ocv_add_module _name)
|
||||
set(OPENCV_MODULE_${the_module}_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}" CACHE INTERNAL "Location of ${the_module} module sources")
|
||||
unset(OPENCV_MODULE_${the_module}_REQ_DEPS CACHE)
|
||||
unset(OPENCV_MODULE_${the_module}_OPT_DEPS CACHE)
|
||||
|
||||
|
||||
#create option to enable/disable this module
|
||||
option(BUILD_${the_module} "Include ${the_module} module into the OpenCV build" ON)
|
||||
|
||||
@@ -129,7 +129,7 @@ macro(ocv_add_module _name)
|
||||
else()
|
||||
set(OPENCV_MODULES_DISABLED_USER ${OPENCV_MODULES_DISABLED_USER} "${the_module}" CACHE INTERNAL "List of OpenCV modules explicitly disabled by user")
|
||||
endif()
|
||||
|
||||
|
||||
#TODO: add submodules if any
|
||||
|
||||
#stop processing of current file
|
||||
@@ -170,7 +170,7 @@ macro(__ocv_flatten_module_required_dependencies the_module)
|
||||
set(__flattened_deps "")
|
||||
set(__resolved_deps "")
|
||||
set(__req_depends ${OPENCV_MODULE_${the_module}_REQ_DEPS})
|
||||
|
||||
|
||||
while(__req_depends)
|
||||
list(GET __req_depends 0 __dep)
|
||||
list(REMOVE_AT __req_depends 0)
|
||||
@@ -206,7 +206,7 @@ macro(__ocv_flatten_module_required_dependencies the_module)
|
||||
else()
|
||||
set(OPENCV_MODULE_${the_module}_DEPS "")
|
||||
endif()
|
||||
|
||||
|
||||
unset(__resolved_deps)
|
||||
unset(__flattened_deps)
|
||||
unset(__req_depends)
|
||||
@@ -217,7 +217,7 @@ macro(__ocv_flatten_module_optional_dependencies the_module)
|
||||
set(__flattened_deps ${OPENCV_MODULE_${the_module}_DEPS})
|
||||
set(__resolved_deps ${OPENCV_MODULE_${the_module}_DEPS})
|
||||
set(__opt_depends ${OPENCV_MODULE_${the_module}_OPT_DEPS})
|
||||
|
||||
|
||||
while(__opt_depends)
|
||||
list(GET __opt_depends 0 __dep)
|
||||
list(REMOVE_AT __opt_depends 0)
|
||||
@@ -244,7 +244,7 @@ macro(__ocv_flatten_module_optional_dependencies the_module)
|
||||
else()
|
||||
set(OPENCV_MODULE_${the_module}_DEPS "")
|
||||
endif()
|
||||
|
||||
|
||||
unset(__resolved_deps)
|
||||
unset(__flattened_deps)
|
||||
unset(__opt_depends)
|
||||
@@ -259,10 +259,10 @@ macro(__ocv_flatten_module_dependencies)
|
||||
set(HAVE_${m} ON CACHE INTERNAL "Module ${m} will not be built in current configuration")
|
||||
__ocv_flatten_module_required_dependencies(${m})
|
||||
endforeach()
|
||||
|
||||
|
||||
foreach(m ${OPENCV_MODULES_BUILD})
|
||||
__ocv_flatten_module_optional_dependencies(${m})
|
||||
|
||||
|
||||
#dependencies from other modules
|
||||
set(OPENCV_MODULE_${m}_DEPS ${OPENCV_MODULE_${m}_DEPS} CACHE INTERNAL "Flattened dependencies of ${m} module")
|
||||
#extra dependencies
|
||||
@@ -273,7 +273,7 @@ macro(__ocv_flatten_module_dependencies)
|
||||
ocv_list_filterout(OPENCV_MODULE_${m}_DEPS_EXT "^opencv_[^ ]+$")
|
||||
set(OPENCV_MODULE_${m}_DEPS_EXT ${OPENCV_MODULE_${m}_DEPS_EXT} CACHE INTERNAL "Extra dependencies of ${m} module")
|
||||
endforeach()
|
||||
|
||||
|
||||
set(OPENCV_MODULES_PUBLIC ${OPENCV_MODULES_PUBLIC} CACHE INTERNAL "List of OpenCV modules marked for export")
|
||||
set(OPENCV_MODULES_BUILD ${OPENCV_MODULES_BUILD} CACHE INTERNAL "List of OpenCV modules included into the build")
|
||||
set(OPENCV_MODULES_DISABLED_AUTO ${OPENCV_MODULES_DISABLED_AUTO} CACHE INTERNAL "List of OpenCV modules implicitly disabled due to dependencies")
|
||||
@@ -322,7 +322,7 @@ macro(ocv_glob_modules)
|
||||
|
||||
#resolve dependencies
|
||||
__ocv_flatten_module_dependencies()
|
||||
|
||||
|
||||
#order modules by dependencies
|
||||
set(OPENCV_MODULES_BUILD_ "")
|
||||
foreach(m ${OPENCV_MODULES_BUILD})
|
||||
@@ -373,7 +373,7 @@ endmacro()
|
||||
macro(ocv_set_module_sources)
|
||||
set(OPENCV_MODULE_${the_module}_HEADERS "")
|
||||
set(OPENCV_MODULE_${the_module}_SOURCES "")
|
||||
|
||||
|
||||
foreach(f "HEADERS" ${ARGN})
|
||||
if(f STREQUAL "HEADERS" OR f STREQUAL "SOURCES")
|
||||
set(__filesvar "OPENCV_MODULE_${the_module}_${f}")
|
||||
@@ -381,12 +381,15 @@ macro(ocv_set_module_sources)
|
||||
list(APPEND ${__filesvar} "${f}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
|
||||
# the hacky way to embeed any files into the OpenCV without modification of its build system
|
||||
if(COMMAND ocv_get_module_external_sources)
|
||||
ocv_get_module_external_sources()
|
||||
endif()
|
||||
|
||||
# use full paths for module to be independent from the module location
|
||||
ocv_to_full_paths(OPENCV_MODULE_${the_module}_HEADERS)
|
||||
|
||||
set(OPENCV_MODULE_${the_module}_HEADERS ${OPENCV_MODULE_${the_module}_HEADERS} CACHE INTERNAL "List of header files for ${the_module}")
|
||||
set(OPENCV_MODULE_${the_module}_SOURCES ${OPENCV_MODULE_${the_module}_SOURCES} CACHE INTERNAL "List of source files for ${the_module}")
|
||||
endmacro()
|
||||
@@ -415,11 +418,11 @@ macro(ocv_create_module)
|
||||
add_library(${the_module} ${OPENCV_MODULE_TYPE} ${OPENCV_MODULE_${the_module}_HEADERS} ${OPENCV_MODULE_${the_module}_SOURCES})
|
||||
target_link_libraries(${the_module} ${OPENCV_MODULE_${the_module}_DEPS} ${OPENCV_MODULE_${the_module}_DEPS_EXT} ${OPENCV_LINKER_LIBS} ${IPP_LIBS} ${ARGN})
|
||||
add_dependencies(opencv_modules ${the_module})
|
||||
|
||||
|
||||
if(ENABLE_SOLUTION_FOLDERS)
|
||||
set_target_properties(${the_module} PROPERTIES FOLDER "modules")
|
||||
endif()
|
||||
|
||||
|
||||
set_target_properties(${the_module} PROPERTIES
|
||||
OUTPUT_NAME "${the_module}${OPENCV_DLLVERSION}"
|
||||
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
|
||||
@@ -427,7 +430,7 @@ macro(ocv_create_module)
|
||||
RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}
|
||||
INSTALL_NAME_DIR lib
|
||||
)
|
||||
|
||||
|
||||
# For dynamic link numbering convenions
|
||||
if(NOT ANDROID)
|
||||
# Android SDK build scripts can include only .so files into final .apk
|
||||
@@ -483,7 +486,7 @@ macro(ocv_add_precompiled_headers the_target)
|
||||
SET(pch_path "src/")
|
||||
endif()
|
||||
set(pch_header "${CMAKE_CURRENT_SOURCE_DIR}/${pch_path}precomp.hpp")
|
||||
|
||||
|
||||
if(PCHSupport_FOUND AND ENABLE_PRECOMPILED_HEADERS AND EXISTS "${pch_header}")
|
||||
if(CMAKE_GENERATOR MATCHES Visual)
|
||||
set(${the_target}_pch "${CMAKE_CURRENT_SOURCE_DIR}/${pch_path}precomp.cpp")
|
||||
@@ -568,7 +571,7 @@ macro(ocv_add_perf_tests)
|
||||
if(OCV_DEPENDENCIES_FOUND)
|
||||
set(the_target "opencv_perf_${name}")
|
||||
#project(${the_target})
|
||||
|
||||
|
||||
ocv_module_include_directories(${perf_deps} "${perf_path}")
|
||||
|
||||
if(NOT OPENCV_PERF_${the_module}_SOURCES)
|
||||
@@ -619,7 +622,7 @@ macro(ocv_add_accuracy_tests)
|
||||
if(OCV_DEPENDENCIES_FOUND)
|
||||
set(the_target "opencv_test_${name}")
|
||||
#project(${the_target})
|
||||
|
||||
|
||||
ocv_module_include_directories(${test_deps} "${test_path}")
|
||||
|
||||
if(NOT OPENCV_TEST_${the_module}_SOURCES)
|
||||
@@ -629,7 +632,7 @@ macro(ocv_add_accuracy_tests)
|
||||
source_group("Include" FILES ${test_hdrs})
|
||||
set(OPENCV_TEST_${the_module}_SOURCES ${test_srcs} ${test_hdrs})
|
||||
endif()
|
||||
|
||||
|
||||
add_executable(${the_target} ${OPENCV_TEST_${the_module}_SOURCES})
|
||||
target_link_libraries(${the_target} ${OPENCV_MODULE_${the_module}_DEPS} ${test_deps} ${OPENCV_LINKER_LIBS})
|
||||
add_dependencies(opencv_tests ${the_target})
|
||||
@@ -643,7 +646,7 @@ macro(ocv_add_accuracy_tests)
|
||||
if(ENABLE_SOLUTION_FOLDERS)
|
||||
set_target_properties(${the_target} PROPERTIES FOLDER "tests accuracy")
|
||||
endif()
|
||||
|
||||
|
||||
enable_testing()
|
||||
get_target_property(LOC ${the_target} LOCATION)
|
||||
add_test(${the_target} "${LOC}")
|
||||
@@ -698,7 +701,7 @@ macro(__ocv_track_module_link_dependencies the_module optkind)
|
||||
# get_target_property(__dep_location "${__dep}" LOCATION)
|
||||
endif()
|
||||
endwhile()
|
||||
|
||||
|
||||
ocv_list_unique(${the_module}_MODULE_DEPS_${optkind})
|
||||
#ocv_list_reverse(${the_module}_MODULE_DEPS_${optkind})
|
||||
ocv_list_unique(${the_module}_EXTRA_DEPS_${optkind})
|
||||
|
||||
@@ -216,6 +216,28 @@ macro(ocv_list_sort __lst)
|
||||
endmacro()
|
||||
|
||||
|
||||
# add prefix to each item in the list
|
||||
macro(ocv_list_add_prefix LST PREFIX)
|
||||
set(__tmp "")
|
||||
foreach(item ${${LST}})
|
||||
list(APPEND __tmp "${PREFIX}${item}")
|
||||
endforeach()
|
||||
set(${LST} ${__tmp})
|
||||
unset(__tmp)
|
||||
endmacro()
|
||||
|
||||
|
||||
# add suffix to each item in the list
|
||||
macro(ocv_list_add_suffix LST SUFFIX)
|
||||
set(__tmp "")
|
||||
foreach(item ${${LST}})
|
||||
list(APPEND __tmp "${item}${SUFFIX}")
|
||||
endforeach()
|
||||
set(${LST} ${__tmp})
|
||||
unset(__tmp)
|
||||
endmacro()
|
||||
|
||||
|
||||
# simple regex escaping routine (does not cover all cases!!!)
|
||||
macro(ocv_regex_escape var regex)
|
||||
string(REGEX REPLACE "([+.*^$])" "\\\\1" ${var} "${regex}")
|
||||
@@ -230,3 +252,17 @@ macro(ocv_get_real_path VAR PATHSTR)
|
||||
get_filename_component(${VAR} "${PATHSTR}" REALPATH)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
|
||||
# convert list of paths to full paths
|
||||
macro(ocv_to_full_paths VAR)
|
||||
if(${VAR})
|
||||
set(__tmp "")
|
||||
foreach(path ${${VAR}})
|
||||
get_filename_component(${VAR} "${path}" ABSOLUTE)
|
||||
list(APPEND __tmp "${${VAR}}")
|
||||
endforeach()
|
||||
set(${VAR} ${__tmp})
|
||||
unset(__tmp)
|
||||
endif()
|
||||
endmacro()
|
||||
Reference in New Issue
Block a user