In-package Kokkos builds
Updating kokkos/model.cmake to allow for in-package builds (eg. Spack)
This commit is contained in:
parent
1b679996fc
commit
1d8e383a29
@ -1,16 +1,17 @@
|
|||||||
|
|
||||||
register_flag_optional(CMAKE_CXX_COMPILER
|
register_flag_optional(CMAKE_CXX_COMPILER
|
||||||
"Any CXX compiler that is supported by CMake detection and RAJA.
|
"Any CXX compiler that is supported by CMake detection and RAJA.
|
||||||
See https://github.com/kokkos/kokkos#primary-tested-compilers-on-x86-are"
|
See https://github.com/kokkos/kokkos#primary-tested-compilers-on-x86-are"
|
||||||
"c++")
|
"c++")
|
||||||
|
|
||||||
register_flag_required(KOKKOS_IN_TREE
|
register_flag_optional(KOKKOS_IN_TREE
|
||||||
"Absolute path to the *source* distribution directory of Kokkos.
|
"Absolute path to the *source* distribution directory of Kokkos.
|
||||||
Remember to append Kokkos specific flags as well, for example:
|
Remember to append Kokkos specific flags as well, for example:
|
||||||
|
|
||||||
-DKOKKOS_IN_TREE=... -DKokkos_ENABLE_OPENMP=ON -DKokkos_ARCH_ZEN=ON ...
|
-DKOKKOS_IN_TREE=... -DKokkos_ENABLE_OPENMP=ON -DKokkos_ARCH_ZEN=ON ...
|
||||||
|
See https://github.com/kokkos/kokkos/blob/master/BUILD.md for all available options" "")
|
||||||
|
|
||||||
See https://github.com/kokkos/kokkos/blob/master/BUILD.md for all available options")
|
register_flag_optional(KOKKOS_IN_PACKAGE
|
||||||
|
"Use if Kokkos is part of a package dependency:
|
||||||
|
Path to package R-Path containing Kokkos libs" "")
|
||||||
|
|
||||||
# compiler vendor and arch specific flags
|
# compiler vendor and arch specific flags
|
||||||
set(KOKKOS_FLAGS_CPU_INTEL -qopt-streaming-stores=always)
|
set(KOKKOS_FLAGS_CPU_INTEL -qopt-streaming-stores=always)
|
||||||
@ -20,13 +21,18 @@ macro(setup)
|
|||||||
set(CMAKE_CXX_STANDARD 14)
|
set(CMAKE_CXX_STANDARD 14)
|
||||||
cmake_policy(SET CMP0074 NEW) #see https://github.com/kokkos/kokkos/blob/master/BUILD.md
|
cmake_policy(SET CMP0074 NEW) #see https://github.com/kokkos/kokkos/blob/master/BUILD.md
|
||||||
|
|
||||||
message(STATUS "Building using in-tree Kokkos source at `${KOKKOS_IN_TREE}`")
|
|
||||||
|
|
||||||
if (EXISTS "${KOKKOS_IN_TREE}")
|
if (EXISTS "${KOKKOS_IN_TREE}")
|
||||||
|
message(STATUS "Building using in-tree Kokkos source at `${KOKKOS_IN_TREE}`")
|
||||||
add_subdirectory(${KOKKOS_IN_TREE} ${CMAKE_BINARY_DIR}/kokkos)
|
add_subdirectory(${KOKKOS_IN_TREE} ${CMAKE_BINARY_DIR}/kokkos)
|
||||||
register_link_library(Kokkos::kokkos)
|
register_link_library(Kokkos::kokkos)
|
||||||
else ()
|
elseif (EXISTS "${KOKKOS_IN_PACKAGE}")
|
||||||
message(FATAL_ERROR "`${KOKKOS_IN_TREE}` does not exist")
|
message(STATUS "Building using packaged Kokkos at `${KOKKOS_IN_PACKAGE}`")
|
||||||
|
set (Kokkos_DIR "${KOKKOS_IN_PACKAGE}/lib64/cmake/Kokkos")
|
||||||
|
find_package(Kokkos REQUIRED)
|
||||||
|
register_link_library(Kokkos::kokkos)
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "Neither `${KOKKOS_IN_TREE}`, or `${KOKKOS_IN_PACKAGE}` exists")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
register_append_compiler_and_arch_specific_cxx_flags(
|
register_append_compiler_and_arch_specific_cxx_flags(
|
||||||
@ -36,5 +42,3 @@ macro(setup)
|
|||||||
)
|
)
|
||||||
|
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user