Skip to content

Commit

Permalink
Add CMake logic to support HIP test build
Browse files Browse the repository at this point in the history
  • Loading branch information
crtrott committed Jan 27, 2023
1 parent 5bbee18 commit fe6df2a
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ option(MDSPAN_ENABLE_EXAMPLES "Build examples." Off)
option(MDSPAN_ENABLE_BENCHMARKS "Enable benchmarks." Off)
option(MDSPAN_ENABLE_COMP_BENCH "Enable compilation benchmarks." Off)
option(MDSPAN_ENABLE_CUDA "Enable Cuda tests/benchmarks/examples if tests/benchmarks/examples are enabled." Off)
option(MDSPAN_ENABLE_HIP "Enable HIP tests/benchmarks/examples if tests/benchmarks/examples are enabled." Off)
option(MDSPAN_ENABLE_OPENMP "Enable OpenMP benchmarks if benchmarks are enabled." On)
option(MDSPAN_USE_SYSTEM_GTEST "Use system-installed GoogleTest library for tests." Off)

Expand Down Expand Up @@ -115,6 +116,22 @@ if(MDSPAN_ENABLE_CUDA)
endif()
endif()

if(MDSPAN_ENABLE_HIP)
include(CheckLanguage)
check_language(HIP)
if(CMAKE_HIP_COMPILER)
message(STATUS "Using ${CMAKE_CXX_STANDARD} as CMAKE_HIP_STANDARD")
set(CMAKE_HIP_STANDARD ${CMAKE_CXX_STANDARD})
set(CMAKE_HIP_STANDARD_REQUIRED ON)
enable_language(HIP)
else()
message(FATAL_ERROR "Requested HIP support, but no CMAKE_HIP_COMPILER available")
endif()
if(MDSPAN_ENABLE_TESTS)
set(MDSPAN_TEST_LANGUAGE HIP)
endif()
endif()

################################################################################

add_library(mdspan INTERFACE)
Expand Down

0 comments on commit fe6df2a

Please sign in to comment.