Added benchmarking function for building benchmarks #3

added an explicit approach for adding benchmarks since we are now using the new cmake style
This commit is contained in:
Matthew Letter 2017-11-08 15:24:02 -07:00
parent 79ef8f4b47
commit 4c039d2817

@ -18,23 +18,34 @@
## this software. ## this software.
##============================================================================ ##============================================================================
set(benchmark_srcs set(benchmarks
BenchmarkArrayTransfer.cxx BenchmarkArrayTransfer
BenchmarkCopySpeeds.cxx BenchmarkCopySpeeds
BenchmarkDeviceAdapter.cxx BenchmarkDeviceAdapter
BenchmarkFieldAlgorithms.cxx BenchmarkFieldAlgorithms
BenchmarkTopologyAlgorithms.cxx BenchmarkTopologyAlgorithms
) )
set(benchmark_headers #set(benchmark_headers
Benchmarker.h # Benchmarker.h
) # )
vtkm_benchmarks(BACKEND SERIAL SOURCES ${benchmark_srcs} ${benchmark_headers}) function(add_benchmark name files)
if (VTKm_ENABLE_CUDA) add_executable(${name}_SERIAL ${files})
vtkm_benchmarks(BACKEND CUDA SOURCES ${benchmark_srcs} ${benchmark_headers}) target_link_libraries(${name}_SERIAL PRIVATE vtkm_cont)
endif()
if (VTKm_ENABLE_TBB)
vtkm_benchmarks(BACKEND TBB SOURCES ${benchmark_srcs} ${benchmark_headers})
endif()
if (TARGET vtkm::tbb)
add_executable(${name}_TBB ${files})
target_link_libraries(${name}_TBB PRIVATE vtkm_cont)
endif()
if (TARGET vtkm::cuda)
set_source_files_properties(${files} PROPERTIES LANGUAGE "CUDA")
add_executable(${name}_CUDA ${files})
target_link_libraries(${name}_CUDA PRIVATE vtkm_cont)
endif()
endfunction()
foreach (benchmark ${benchmarks})
add_benchmark(${benchmark} ${benchmark}.cxx)
endforeach ()