In-package linking to RAJA

Introduced RAJA_IN_PACKAGE to allow for linking to an in-package dependency of RAJA (eg. Spack)
This commit is contained in:
Rob Jones 2022-09-15 11:32:23 +01:00 committed by GitHub
parent 1d8e383a29
commit 407d6701df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,18 +1,19 @@
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://raja.readthedocs.io/en/main/getting_started.html#build-and-install" See https://raja.readthedocs.io/en/main/getting_started.html#build-and-install"
"c++") "c++")
register_flag_required(RAJA_IN_TREE register_flag_optional(RAJA_IN_TREE
"Absolute path to the *source* distribution directory of RAJA. "Absolute path to the *source* distribution directory of RAJA.
Make sure to use the release version of RAJA or clone RAJA recursively with submodules. Make sure to use the release version of RAJA or clone RAJA recursively with submodules.
Remember to append RAJA specific flags as well, for example: Remember to append RAJA specific flags as well, for example:
-DRAJA_IN_TREE=... -DENABLE_OPENMP=ON -DENABLE_CUDA=ON ... -DRAJA_IN_TREE=... -DENABLE_OPENMP=ON -DENABLE_CUDA=ON ...
See https://github.com/LLNL/RAJA/blob/08cbbafd2d21589ebf341f7275c229412d0fe903/CMakeLists.txt#L44 for all available options See https://github.com/LLNL/RAJA/blob/08cbbafd2d21589ebf341f7275c229412d0fe903/CMakeLists.txt#L44 for all available options
") " "")
register_flag_optional(RAJA_IN_PACKAGE
"Use if Raja is part of a package dependency:
Path to installation" "")
register_flag_optional(TARGET register_flag_optional(TARGET
"Target offload device, implemented values are CPU, NVIDIA" "Target offload device, implemented values are CPU, NVIDIA"
@ -76,8 +77,14 @@ macro(setup)
register_link_library(RAJA) register_link_library(RAJA)
# RAJA's cmake screws with where the binary will end up, resetting it here: # RAJA's cmake screws with where the binary will end up, resetting it here:
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
elseif (EXISTS "${RAJA_IN_PACKAGE}")
message(STATUS "Building using packaged Raja at `${RAJA_IN_PACKAGE}`")
find_package(RAJA REQUIRED)
register_link_library(RAJA)
else () else ()
message(FATAL_ERROR "`${RAJA_IN_TREE}` does not exist") message(FATAL_ERROR "Neither `${RAJA_IN_TREE}` or `${RAJA_IN_PACKAGE}` exists")
endif () endif ()