diff --git a/CMakeLists.txt b/CMakeLists.txt index 8fb4acf205d4cb15fbf46c89bcdd224876b5f80c..ab93b921ee896a250c6a7e480b1eb3d784aa1847 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -110,6 +110,22 @@ else() endif() endif() +include(FetchContent) +# configure kokkos 4.4 repository link +FetchContent_Declare(kokkos + URL https://github.com/kokkos/kokkos/releases/download/4.4.01/kokkos-4.4.01.tar.gz + URL_HASH MD5=eafd0d42c9831858aa84fde78576644c +) + +# disable build of C++23 mdspan experimental support for now +set(Kokkos_ENABLE_IMPL_MDSPAN OFF CACHE BOOL "Experimental mdspan support") + +# by default, build the Kokkos serial backend for CPU +set(Kokkos_ENABLE_SERIAL ON CACHE BOOL "Kokkos Serial backend") +set(Kokkos_ARCH_NATIVE ON CACHE BOOL "Kokkos native architecture optimisations") + +FetchContent_MakeAvailable(kokkos) + add_subdirectory(src) # Allow for 'make test' even if the tests are disabled: diff --git a/src/support/CMakeLists.txt b/src/support/CMakeLists.txt index b4ceb378b509071326a2ae752658b610a2753ed6..9f56017022c391e95381da1ee3edb8eea65e0a0d 100644 --- a/src/support/CMakeLists.txt +++ b/src/support/CMakeLists.txt @@ -57,9 +57,6 @@ if(IM_ENABLE_OPENACC) endif() endif() -message(STATUS "iconmath-support enabling Kokkos") -find_package(Kokkos REQUIRED) - target_include_directories( iconmath-support PUBLIC @@ -77,7 +74,12 @@ target_include_directories( # https://cmake.org/cmake/help/latest/manual/cmake-generator-expressions.7.html $<BUILD_INTERFACE:$<$<COMPILE_LANGUAGE:C,CXX>:${CMAKE_CURRENT_BINARY_DIR}>>) -target_link_libraries(iconmath-support PUBLIC fortran-support::fortran-support Kokkos::kokkos) +target_link_libraries(iconmath-support + PUBLIC + fortran-support::fortran-support + PRIVATE + Kokkos::kokkos +) install(TARGETS iconmath-support EXPORT "${PROJECT_NAME}-targets")