Adding test support for WINRT

This commit is contained in:
Evgeny Agafonchikov
2015-05-18 11:57:18 +03:00
parent 8869150649
commit 6a6d58d389
19 changed files with 303 additions and 21 deletions

View File

@@ -684,6 +684,28 @@ macro(ocv_create_module)
_ocv_create_module(${ARGN})
set(the_module_target ${the_module})
endif()
if(WINRT)
# removing APPCONTAINER from modules to run from console
# in case of usual starting of WinRT test apps output is missing
# so starting of console version w/o APPCONTAINER is required to get test results
# also this allows to use opencv_extra test data for these tests
if(NOT "${the_module}" STREQUAL "opencv_ts" AND NOT "${the_module}" STREQUAL "opencv_hal")
add_custom_command(TARGET ${the_module}
POST_BUILD
COMMAND link.exe /edit /APPCONTAINER:NO $(TargetPath))
endif()
if("${the_module}" STREQUAL "opencv_ts")
# copy required dll files; WinRT apps need these dlls that are usually substituted by Visual Studio
# however they are not on path and need to be placed with executables to run from console w/o APPCONTAINER
add_custom_command(TARGET ${the_module}
POST_BUILD
COMMAND copy /y "\"$(VCInstallDir)redist\\$(PlatformTarget)\\Microsoft.VC$(PlatformToolsetVersion).CRT\\msvcp$(PlatformToolsetVersion).dll\"" "\"${CMAKE_BINARY_DIR}\\bin\\$(Configuration)\\msvcp$(PlatformToolsetVersion)_app.dll\""
COMMAND copy /y "\"$(VCInstallDir)redist\\$(PlatformTarget)\\Microsoft.VC$(PlatformToolsetVersion).CRT\\msvcr$(PlatformToolsetVersion).dll\"" "\"${CMAKE_BINARY_DIR}\\bin\\$(Configuration)\\msvcr$(PlatformToolsetVersion)_app.dll\""
COMMAND copy /y "\"$(VCInstallDir)redist\\$(PlatformTarget)\\Microsoft.VC$(PlatformToolsetVersion).CRT\\vccorlib$(PlatformToolsetVersion).dll\"" "\"${CMAKE_BINARY_DIR}\\bin\\$(Configuration)\\vccorlib$(PlatformToolsetVersion)_app.dll\"")
endif()
endif()
endmacro()
macro(_ocv_create_module)
@@ -902,6 +924,10 @@ endmacro()
function(ocv_add_perf_tests)
ocv_debug_message("ocv_add_perf_tests(" ${ARGN} ")")
if(WINRT)
set(OPENCV_DEBUG_POSTFIX "")
endif()
set(perf_path "${CMAKE_CURRENT_LIST_DIR}/perf")
if(BUILD_PERF_TESTS AND EXISTS "${perf_path}")
__ocv_parse_test_sources(PERF ${ARGN})
@@ -936,11 +962,18 @@ function(ocv_add_perf_tests)
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
RUNTIME_OUTPUT_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}"
)
if(ENABLE_SOLUTION_FOLDERS)
set_target_properties(${the_target} PROPERTIES FOLDER "tests performance")
endif()
if(WINRT)
# removing APPCONTAINER from tests to run from console
# look for detailed description inside of ocv_create_module macro above
add_custom_command(TARGET "opencv_perf_${name}"
POST_BUILD
COMMAND link.exe /edit /APPCONTAINER:NO $(TargetPath))
endif()
if(NOT BUILD_opencv_world)
_ocv_add_precompiled_headers(${the_target})
endif()
@@ -958,6 +991,10 @@ endfunction()
function(ocv_add_accuracy_tests)
ocv_debug_message("ocv_add_accuracy_tests(" ${ARGN} ")")
if(WINRT)
set(OPENCV_DEBUG_POSTFIX "")
endif()
set(test_path "${CMAKE_CURRENT_LIST_DIR}/test")
if(BUILD_TESTS AND EXISTS "${test_path}")
__ocv_parse_test_sources(TEST ${ARGN})
@@ -1000,6 +1037,14 @@ function(ocv_add_accuracy_tests)
get_target_property(LOC ${the_target} LOCATION)
add_test(${the_target} "${LOC}")
if(WINRT)
# removing APPCONTAINER from tests to run from console
# look for detailed description inside of ocv_create_module macro above
add_custom_command(TARGET "opencv_test_${name}"
POST_BUILD
COMMAND link.exe /edit /APPCONTAINER:NO $(TargetPath))
endif()
if(NOT BUILD_opencv_world)
_ocv_add_precompiled_headers(${the_target})
endif()