Skip to content

Commit

Permalink
Export Kokkos_<info> vars in KokkosConfig.cmake (#11545)
Browse files Browse the repository at this point in the history
This makes the native Kokkos CMake build-system generated KokkosConfig.cmake
TriBITS-compliant for Kokkos itself.

This is needed by downstream packages downstream Trilinos packages like
Tpetra.
  • Loading branch information
bartlettroscoe committed May 5, 2023
1 parent d848e38 commit ecc5609
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
4 changes: 4 additions & 0 deletions packages/kokkos/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ endif()

if (COMMAND TRIBITS_PACKAGE)
TRIBITS_PACKAGE(Kokkos)
else()
INCLUDE(${CMAKE_CURRENT_LIST_DIR}/cmake/TribitsPkgExportCacheVars.cmake)
set(PACKAGE_NAME Kokkos)
tribits_pkg_init_exported_vars(Kokkos)
endif()

# We want to determine if options are given with the wrong case
Expand Down
4 changes: 4 additions & 0 deletions packages/kokkos/cmake/KokkosConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,7 @@ ELSEIF(@Kokkos_ENABLE_CUDA@ AND NOT "separable_compilation" IN_LIST Kokkos_FIND_
ENDIF()

set(Kokkos_COMPILE_LANGUAGE @KOKKOS_COMPILE_LANGUAGE@)

# Kokkos_<INFO> vars

@KOKKOS_OPTION_SET_STATEMENTS_STR@
6 changes: 2 additions & 4 deletions packages/kokkos/cmake/kokkos_functions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,8 @@ FUNCTION(kokkos_option CAMEL_SUFFIX DEFAULT TYPE DOCSTRING)
# Make sure this appears in the cache with the appropriate DOCSTRING
SET(${CAMEL_NAME} ${DEFAULT} CACHE ${TYPE} ${DOCSTRING})

IF (KOKKOS_HAS_TRILINOS)
IF (NOT CAMEL_NAME IN_LIST Kokkos_OPTIONS_NOT_TO_EXPORT)
TRIBITS_PKG_EXPORT_CACHE_VAR(${CAMEL_NAME})
ENDIF()
IF (NOT CAMEL_NAME IN_LIST Kokkos_OPTIONS_NOT_TO_EXPORT)
TRIBITS_PKG_EXPORT_CACHE_VAR(${CAMEL_NAME})
ENDIF()

#I don't love doing it this way because it's N^2 in number options, but c'est la vie
Expand Down
3 changes: 3 additions & 0 deletions packages/kokkos/cmake/kokkos_install.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ IF (NOT KOKKOS_HAS_TRILINOS AND NOT Kokkos_INSTALL_TESTING)
GET_PROPERTY(KOKKOS_PROP_LIBS GLOBAL PROPERTY KOKKOS_LIBRARIES_NAMES)
SET(KOKKOS_LIBRARIES ${KOKKOS_PROP_LIBS})

tribits_pkg_append_set_commands_for_exported_vars(Kokkos
KOKKOS_OPTION_SET_STATEMENTS_STR)

INCLUDE(CMakePackageConfigHelpers)
CONFIGURE_PACKAGE_CONFIG_FILE(
cmake/KokkosConfig.cmake.in
Expand Down

0 comments on commit ecc5609

Please sign in to comment.