From 27782d6020b4f5108e79f55971c2049ebff9f1bb Mon Sep 17 00:00:00 2001
From: Abhishek Yenpure <abhishek.yenpure@hotmail.com>
Date: Wed, 13 Mar 2024 12:36:15 -0700
Subject: [PATCH] Changes to initialization of Kokkos backend

-- Instead of initializing kokkos backend for every specific backend,
   move the initialization based on `VTK_USE_KOKKOS` flag using CMAKE compile
   definition
---
 Accelerators/Vtkm/Core/CMakeLists.txt | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/Accelerators/Vtkm/Core/CMakeLists.txt b/Accelerators/Vtkm/Core/CMakeLists.txt
index 51f7ccfdc6b..64114890100 100644
--- a/Accelerators/Vtkm/Core/CMakeLists.txt
+++ b/Accelerators/Vtkm/Core/CMakeLists.txt
@@ -43,6 +43,9 @@ vtkm_add_target_information(${vtkm_accel_target}
                             DEVICE_SOURCES ${sources})
 
 list(TRANSFORM nowrap_classes APPEND ".cxx" OUTPUT_VARIABLE device_sources)
+if(VTK_USE_KOKKOS)
+  add_compile_definitions(VTK_USE_KOKKOS)
+endif()
 if (TARGET vtkm::cuda)
   # Temporarily suppress "has address taken but no possible call to it" warnings,
   # until we figure out its implications.
@@ -53,14 +56,13 @@ if (TARGET vtkm::cuda)
   vtk_module_set_properties(VTK::AcceleratorsVTKmCore CUDA_SEPARABLE_COMPILATION ON)
 
 elseif (TARGET vtkm::kokkos_cuda)
-  add_compile_definitions(VTK_USE_KOKKOS)
   set_source_files_properties(${device_sources} PROPERTIES LANGUAGE CUDA)
   kokkos_compilation(SOURCE ${device_sources})
 
 elseif (TARGET vtkm::kokkos_hip)
-  add_compile_definitions(VTK_USE_KOKKOS)
   set_source_files_properties(${device_sources} PROPERTIES LANGUAGE HIP)
   kokkos_compilation(SOURCE ${device_sources})
+
 endif ()
 
 if (MSVC)
-- 
GitLab