diff --git a/CMakeLists.txt b/CMakeLists.txt index 69abff9f..6086cd04 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) @@ -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)