Commit 011be7d8 authored by Sreekanth Arikatla's avatar Sreekanth Arikatla

REFAC: remove the resource download test from example cmakelists

parent 1228108a
#-----------------------------------------------------------------------------
# Add ExternalData
#-----------------------------------------------------------------------------
# Remove the data if already here
set(hashStampPath "${ExternalData_BINARY_ROOT}/Data/Testing/ExternalDataTest.txt-hash-stamp")
if(EXISTS hashStampPath)
file(READ hashStampPath hash)
string(STRIP "${hash}" hash)
endif()
execute_process(
COMMAND rm ${ExternalData_BINARY_ROOT}/Data/Testing/ExternalDataTest.txt
COMMAND rm ${ExternalData_BINARY_ROOT}/Data/Testing/ExternalDataTest.txt-hash-stamp
COMMAND rm ${ExternalData_BINARY_ROOT}/Objects/SHA512/${hash}
OUTPUT_QUIET
ERROR_QUIET)
# Download the data
imstk_add_data(ExternalDataTest "Testing/ExternalDataTest.txt")
#-----------------------------------------------------------------------------
# Add Test
#-----------------------------------------------------------------------------
# Check if the data has been correctly downloaded
add_test(
NAME imstkExternalDataTest
COMMAND ${CMAKE_COMMAND}
-DFileToCheck=${ExternalData_BINARY_ROOT}/Data/Testing/ExternalDataTest.txt
-P ${CMAKE_SOURCE_DIR}/CMake/Utilities/imstkCheckFileExists.cmake
)
\ No newline at end of file
...@@ -377,11 +377,30 @@ install( ...@@ -377,11 +377,30 @@ install(
Devel Devel
) )
#--------------------------------------------------------------------------
# Test data download
#--------------------------------------------------------------------------
include(imstkExternalDataDownloadTest)
#--------------------------------------------------------------------------
# Append external data needed for testing to be downloaded later
#--------------------------------------------------------------------------
list(APPEND FILE_LIST
asianDragon/,REGEX:.*
human/,REGEX:.*
oneTet/,REGEX:.*)
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
# Add Examples subdirectories # Add Examples subdirectories
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
add_subdirectory(Examples) if(BUILD_EXAMPLES)
add_subdirectory(Examples)
endif()
#-----------------------------------------------------------------------------
# Download the external data needed for both testing and examples
#-----------------------------------------------------------------------------
imstk_add_data(${PROJECT_NAME} ${FILE_LIST})
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
# Innerbuild dummy test # Innerbuild dummy test
...@@ -389,4 +408,4 @@ add_subdirectory(Examples) ...@@ -389,4 +408,4 @@ add_subdirectory(Examples)
add_test( add_test(
NAME imstkDummyTest NAME imstkDummyTest
COMMAND ${CMAKE_COMMAND} -E echo "Success" COMMAND ${CMAKE_COMMAND} -E echo "Success"
) )
\ No newline at end of file
#-----------------------------------------------------------------------------
# Add ExternalData
#-----------------------------------------------------------------------------
# Remove the data if already here
set(hashStampPath "${ExternalData_BINARY_ROOT}/Data/Testing/ExternalDataTest.txt-hash-stamp")
if(EXISTS hashStampPath)
file(READ hashStampPath hash)
string(STRIP "${hash}" hash)
endif()
execute_process(
COMMAND rm ${ExternalData_BINARY_ROOT}/Data/Testing/ExternalDataTest.txt
COMMAND rm ${ExternalData_BINARY_ROOT}/Data/Testing/ExternalDataTest.txt-hash-stamp
COMMAND rm ${ExternalData_BINARY_ROOT}/Objects/SHA512/${hash}
OUTPUT_QUIET
ERROR_QUIET)
# Download the data
imstk_add_data(ExternalDataTest "Testing/ExternalDataTest.txt")
#-----------------------------------------------------------------------------
# Add Test
#-----------------------------------------------------------------------------
# Check if the data has been correctly downloaded
add_test(
NAME imstkExternalDataTest
COMMAND ${CMAKE_COMMAND}
-DFileToCheck=${ExternalData_BINARY_ROOT}/Data/Testing/ExternalDataTest.txt
-P ${CMAKE_SOURCE_DIR}/CMake/Utilities/imstkCheckFileExists.cmake
)
# Associate external data needed for testing
list(APPEND FILE_LIST
asianDragon/,REGEX:.*,
human/,REGEX:.*,
oneTet/,REGEX:.*)
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# Add Example subdirectories # Add Example subdirectories
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
if(BUILD_EXAMPLES) macro(listOfSubDir result curdir)
macro(listOfSubDir result curdir)
file(GLOB children RELATIVE ${curdir} ${curdir}/*) file(GLOB children RELATIVE ${curdir} ${curdir}/*)
set(dirlist "") set(dirlist "")
foreach(child ${children}) foreach(child ${children})
...@@ -53,10 +16,6 @@ if(BUILD_EXAMPLES) ...@@ -53,10 +16,6 @@ if(BUILD_EXAMPLES)
foreach(subdir ${subDirs}) foreach(subdir ${subDirs})
add_subdirectory(${subdir}) add_subdirectory(${subdir})
endforeach() endforeach()
endif()
#-----------------------------------------------------------------------------
# Add external data
#-----------------------------------------------------------------------------
imstk_add_data(${PROJECT_NAME} ${FILE_LIST})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment