Skip to content

Commit

Permalink
examples,hip: use find_package(hip) once in proj
Browse files Browse the repository at this point in the history
  • Loading branch information
vicentebolea committed Nov 6, 2023
1 parent 80e4739 commit b2718a9
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 @@ -19,8 +19,7 @@ if(ADIOS2_HAVE_CUDA OR ADIOS2_HAVE_Kokkos_CUDA)
add_subdirectory(bpWriteReadCuda)
endif()

find_package(hip QUIET)
if(ADIOS2_HAVE_Kokkos_HIP OR hip_FOUND)
if(ADIOS2_HAVE_Kokkos_HIP)
add_subdirectory(bpWriteReadHip)
endif()

Expand Down
22 changes: 9 additions & 13 deletions examples/hello/bpWriteReadHip/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(ADIOS2HelloBPWriteReadHipExample)

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_bpWriteReadHip bpWriteReadHip.cpp)
target_link_libraries(adios2_hello_bpWriteReadHip adios2::cxx11 hip::device)
set_source_files_properties(bpWriteReadHip.cpp PROPERTIES LANGUAGE HIP)
install(TARGETS adios2_hello_bpWriteReadHip RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
add_executable(adios2_hello_bpWriteReadHip bpWriteReadHip.cpp)
target_link_libraries(adios2_hello_bpWriteReadHip adios2::cxx11 hip::device)
set_source_files_properties(bpWriteReadHip.cpp PROPERTIES LANGUAGE HIP)
install(TARGETS adios2_hello_bpWriteReadHip RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})

0 comments on commit b2718a9

Please sign in to comment.