Skip to content

Commit

Permalink
Merge pull request #3896 from vicentebolea/correct-example-findpackage
Browse files Browse the repository at this point in the history
examples,hip: use find_package(hip) once in proj
  • Loading branch information
vicentebolea authored Nov 7, 2023
2 parents 2ab1124 + 3adf20a commit e8fd4e6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
3 changes: 1 addition & 2 deletions examples/hello/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ add_subdirectory(bpStepsWriteRead)
if(ADIOS2_HAVE_CUDA OR ADIOS2_HAVE_Kokkos_CUDA)
add_subdirectory(bpStepsWriteReadCuda)
endif()
find_package(hip QUIET)
if(ADIOS2_HAVE_Kokkos_HIP OR hip_FOUND)
if(ADIOS2_HAVE_Kokkos_HIP)
add_subdirectory(bpStepsWriteReadHip)
endif()
if(ADIOS2_HAVE_Kokkos)
Expand Down
22 changes: 9 additions & 13 deletions examples/hello/bpStepsWriteReadHip/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,15 @@ cmake_minimum_required(VERSION 3.12)
project(ADIOS2HelloBPStepsWriteReadHipExample)

if(NOT TARGET adios2_core)
set(_components CXX)
find_package(ADIOS2 REQUIRED COMPONENTS CXX)
endif()

find_package(hip QUIET)
if(hip_FOUND)
enable_language(HIP)
endif()
enable_language(HIP)

find_package(ADIOS2 REQUIRED COMPONENTS ${_components})
endif()
# Needed for the hip cmake targets
find_package(hip REQUIRED)

if(ADIOS2_HAVE_Kokkos_HIP OR hip_FOUND)
add_executable(adios2_hello_bpStepsWriteReadHip bpStepsWriteReadHip.cpp)
target_link_libraries(adios2_hello_bpStepsWriteReadHip adios2::cxx11 hip::device)
set_source_files_properties(bpStepsWriteReadHip.cpp PROPERTIES LANGUAGE HIP)
install(TARGETS adios2_hello_bpStepsWriteReadHip RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
add_executable(adios2_hello_bpStepsWriteReadHip bpStepsWriteReadHip.cpp)
target_link_libraries(adios2_hello_bpStepsWriteReadHip adios2::cxx11 hip::device)
set_source_files_properties(bpStepsWriteReadHip.cpp PROPERTIES LANGUAGE HIP)
install(TARGETS adios2_hello_bpStepsWriteReadHip RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})

0 comments on commit e8fd4e6

Please sign in to comment.