Merge topic 'cmake-guard-testing-directories'

b719911d1 cmake: use `if (TEST)` to detect tests that are enabled
4c7fe13a9 cmake: avoid adding testing directories if testing is disabled

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Vicente Bolea <vicente.bolea@kitware.com>
Merge-request: !2508
This commit is contained in:
Ben Boeckel 2021-06-02 22:05:54 +00:00 committed by Kitware Robot
commit 7e576483cb
28 changed files with 73 additions and 42 deletions

@ -112,10 +112,6 @@ endfunction()
# backends at runtime. # backends at runtime.
# #
function(vtkm_unit_tests) function(vtkm_unit_tests)
if (NOT VTKm_ENABLE_TESTING)
return()
endif()
set(options) set(options)
set(global_options ${options} USE_VTKM_JOB_POOL MPI ALL_BACKENDS) set(global_options ${options} USE_VTKM_JOB_POOL MPI ALL_BACKENDS)
set(oneValueArgs BACKEND NAME LABEL) set(oneValueArgs BACKEND NAME LABEL)

@ -89,7 +89,9 @@ endif()
add_subdirectory(thirdparty/optionparser) add_subdirectory(thirdparty/optionparser)
add_subdirectory(thirdparty/lcl) add_subdirectory(thirdparty/lcl)
add_subdirectory(testing) if (VTKm_ENABLE_TESTING)
add_subdirectory(testing)
endif ()
add_subdirectory(internal) add_subdirectory(internal)
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------

@ -311,4 +311,6 @@ if(TARGET vtkm_loguru)
endif() endif()
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
add_subdirectory(testing) if (VTKm_ENABLE_TESTING)
add_subdirectory(testing)
endif ()

@ -42,4 +42,6 @@ vtkm_declare_headers(${headers})
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
add_subdirectory(testing) if (VTKm_ENABLE_TESTING)
add_subdirectory(testing)
endif ()

@ -19,7 +19,7 @@ add_subdirectory(internal)
vtkm_declare_headers(${headers}) vtkm_declare_headers(${headers})
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
if (TARGET vtkm::cuda) if (TARGET vtkm::cuda AND VTKm_ENABLE_TESTING)
add_subdirectory(testing) add_subdirectory(testing)
endif() endif()

@ -52,4 +52,6 @@ vtkm_declare_headers(${headers})
# internal and which are part of the external interface. # internal and which are part of the external interface.
#add_custom_target(vtkmContInternal ALL DEPENDS vtkmCont) #add_custom_target(vtkmContInternal ALL DEPENDS vtkmCont)
add_subdirectory(testing) if (VTKm_ENABLE_TESTING)
add_subdirectory(testing)
endif ()

@ -17,6 +17,6 @@ add_subdirectory(internal)
vtkm_declare_headers(${headers}) vtkm_declare_headers(${headers})
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
if (TARGET vtkm::kokkos) if (TARGET vtkm::kokkos AND VTKm_ENABLE_TESTING)
add_subdirectory(testing) add_subdirectory(testing)
endif() endif()

@ -17,6 +17,6 @@ add_subdirectory(internal)
vtkm_declare_headers(${headers}) vtkm_declare_headers(${headers})
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
if (TARGET vtkm::openmp) if (TARGET vtkm::openmp AND VTKm_ENABLE_TESTING)
add_subdirectory(testing) add_subdirectory(testing)
endif() endif()

@ -36,15 +36,16 @@ vtkm_unit_tests(SOURCES ${unit_tests}
DEFINES VTKM_NO_ERROR_ON_MIXED_CUDA_CXX_TAG DEFINES VTKM_NO_ERROR_ON_MIXED_CUDA_CXX_TAG
LIBRARIES vtkm_worklet) LIBRARIES vtkm_worklet)
if (VTKm_ENABLE_TESTING) #We need to have all OpenMP tests run serially as they
#We need to have all OpenMP tests run serially as they #will uses all the system cores, and we will cause a N*N thread
#will uses all the system cores, and we will cause a N*N thread #explosion which causes the tests to run slower than when run
#explosion which causes the tests to run slower than when run #serially
#serially foreach (test ${unit_tests})
foreach (test ${unit_tests}) if (NOT TEST "${test}")
get_filename_component(tname ${test} NAME_WE) continue ()
set_tests_properties(${tname} PROPERTIES endif ()
RUN_SERIAL True get_filename_component(tname ${test} NAME_WE)
) set_tests_properties(${tname} PROPERTIES
endforeach() RUN_SERIAL True
endif() )
endforeach()

@ -17,4 +17,6 @@ add_subdirectory(internal)
vtkm_declare_headers(${headers}) vtkm_declare_headers(${headers})
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
add_subdirectory(testing) if (VTKm_ENABLE_TESTING)
add_subdirectory(testing)
endif ()

@ -17,6 +17,6 @@ add_subdirectory(internal)
vtkm_declare_headers(${headers}) vtkm_declare_headers(${headers})
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
if (TARGET vtkm::tbb) if (TARGET vtkm::tbb AND VTKm_ENABLE_TESTING)
add_subdirectory(testing) add_subdirectory(testing)
endif() endif()

@ -63,4 +63,6 @@ add_subdirectory(cuda)
add_subdirectory(kokkos) add_subdirectory(kokkos)
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
add_subdirectory(testing) if (VTKm_ENABLE_TESTING)
add_subdirectory(testing)
endif ()

@ -49,4 +49,6 @@ vtkm_declare_headers(${headers})
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
add_subdirectory(testing) if (VTKm_ENABLE_TESTING)
add_subdirectory(testing)
endif ()

@ -25,6 +25,6 @@ set_source_files_properties(ThrustPatches.h
PROPERTIES VTKm_CANT_BE_HEADER_TESTED TRUE) PROPERTIES VTKm_CANT_BE_HEADER_TESTED TRUE)
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
if (TARGET vtkm::cuda) if (TARGET vtkm::cuda AND VTKm_ENABLE_TESTING)
add_subdirectory(testing) add_subdirectory(testing)
endif() endif()

@ -22,4 +22,6 @@ vtkm_declare_headers(${headers})
vtkm_pyexpander_generated_file(WorkletInvokeFunctorDetail.h) vtkm_pyexpander_generated_file(WorkletInvokeFunctorDetail.h)
add_subdirectory(testing) if (VTKm_ENABLE_TESTING)
add_subdirectory(testing)
endif ()

@ -15,6 +15,6 @@ set(headers
vtkm_declare_headers(${headers}) vtkm_declare_headers(${headers})
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
if (VTKm_ENABLE_OPENMP) if (VTKm_ENABLE_OPENMP AND VTKm_ENABLE_TESTING)
add_subdirectory(testing) add_subdirectory(testing)
endif() endif()

@ -15,4 +15,6 @@ set(headers
vtkm_declare_headers(${headers}) vtkm_declare_headers(${headers})
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
add_subdirectory(testing) if (VTKm_ENABLE_TESTING)
add_subdirectory(testing)
endif ()

@ -15,6 +15,6 @@ set(headers
vtkm_declare_headers(${headers}) vtkm_declare_headers(${headers})
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
if (TARGET vtkm::tbb) if (TARGET vtkm::tbb AND VTKm_ENABLE_TESTING)
add_subdirectory(testing) add_subdirectory(testing)
endif() endif()

@ -281,4 +281,6 @@ add_subdirectory(internal)
add_subdirectory(particleadvection) add_subdirectory(particleadvection)
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
add_subdirectory(testing) if (VTKm_ENABLE_TESTING)
add_subdirectory(testing)
endif ()

@ -88,4 +88,6 @@ vtkm_pyexpander_generated_file(FunctionInterfaceDetailPost.h)
vtkm_pyexpander_generated_file(VariantImplDetail.h) vtkm_pyexpander_generated_file(VariantImplDetail.h)
vtkm_pyexpander_generated_file(VecOperators.h) vtkm_pyexpander_generated_file(VecOperators.h)
add_subdirectory(testing) if (VTKm_ENABLE_TESTING)
add_subdirectory(testing)
endif ()

@ -17,6 +17,6 @@ vtkm_declare_headers(${headers})
add_subdirectory(internal) add_subdirectory(internal)
if(VTKm_ENABLE_OPENGL_TESTS) if(VTKm_ENABLE_OPENGL_TESTS AND VTKm_ENABLE_TESTING)
add_subdirectory(testing) add_subdirectory(testing)
endif() endif()

@ -18,6 +18,6 @@ set(headers
vtkm_declare_headers(${headers}) vtkm_declare_headers(${headers})
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
if(TARGET vtkm_rendering) if(TARGET vtkm_rendering AND VTKm_ENABLE_TESTING)
add_subdirectory(testing) add_subdirectory(testing)
endif() endif()

@ -98,4 +98,6 @@ endif()
add_subdirectory(internal) add_subdirectory(internal)
add_subdirectory(reader) add_subdirectory(reader)
add_subdirectory(writer) add_subdirectory(writer)
add_subdirectory(testing) if (VTKm_ENABLE_TESTING)
add_subdirectory(testing)
endif ()

@ -14,4 +14,6 @@ set(headers
vtkm_declare_headers(${headers}) vtkm_declare_headers(${headers})
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
add_subdirectory(testing) if (VTKm_ENABLE_TESTING)
add_subdirectory(testing)
endif ()

@ -155,4 +155,6 @@ endif()
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
add_subdirectory(internal) add_subdirectory(internal)
add_subdirectory(raytracing) add_subdirectory(raytracing)
add_subdirectory(testing) if (VTKm_ENABLE_TESTING)
add_subdirectory(testing)
endif ()

@ -30,4 +30,6 @@ vtkm_library(NAME vtkm_source
target_link_libraries(vtkm_source PUBLIC vtkm_cont) target_link_libraries(vtkm_source PUBLIC vtkm_cont)
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
add_subdirectory(testing) if (VTKm_ENABLE_TESTING)
add_subdirectory(testing)
endif ()

@ -158,4 +158,6 @@ target_link_libraries(vtkm_worklet PUBLIC vtkm_cont)
set_source_files_properties(${sources_device} PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON) set_source_files_properties(${sources_device} PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON)
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
add_subdirectory(testing) if (VTKm_ENABLE_TESTING)
add_subdirectory(testing)
endif ()

@ -19,4 +19,6 @@ set(headers
vtkm_declare_headers(${headers}) vtkm_declare_headers(${headers})
add_subdirectory(testing) if (VTKm_ENABLE_TESTING)
add_subdirectory(testing)
endif ()