Skip to content

Commit

Permalink
WIP: Have Kokkos TriBITS build properly export options to package con…
Browse files Browse the repository at this point in the history
…fig files (trilinos#11545)

Just need to move where tribits_package_decl() is call and call
tribits_pkg_export_cache_var() inside of kokkos_option().
  • Loading branch information
bartlettroscoe committed Feb 7, 2023
1 parent 8001753 commit 2d56274
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/kokkos/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@ if( "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}" )
message( FATAL_ERROR "FATAL: In-source builds are not allowed. You should create a separate directory for build files and delete CMakeCache.txt." )
endif()

if (COMMAND TRIBITS_PACKAGE_DECL)
TRIBITS_PACKAGE_DECL(Kokkos)
endif()

# We want to determine if options are given with the wrong case
# In order to detect which arguments are given to compare against
# the list of valid arguments, at the beginning here we need to
# form a list of all the given variables. If it begins with any
# case of KoKkOS, we add it to the list.


GET_CMAKE_PROPERTY(_variableNames VARIABLES)
SET(KOKKOS_GIVEN_VARIABLES)
FOREACH (var ${_variableNames})
Expand Down Expand Up @@ -270,8 +273,6 @@ IF (KOKKOS_HAS_TRILINOS)
$<$<COMPILE_LANGUAGE:CXX>:${KOKKOS_ALL_COMPILE_OPTIONS}>)
ENDIF()

KOKKOS_PACKAGE_DECL()


#------------------------------------------------------------------------------
#
Expand All @@ -287,6 +288,7 @@ KOKKOS_PROCESS_SUBPACKAGES()

KOKKOS_PACKAGE_DEF()
KOKKOS_EXCLUDE_AUTOTOOLS_FILES()
#print_var(${PACKAGE_NAME}_PKG_VARS_TO_EXPORT)
KOKKOS_PACKAGE_POSTPROCESS()
KOKKOS_CONFIGURE_CORE()

Expand Down
5 changes: 5 additions & 0 deletions packages/kokkos/cmake/kokkos_functions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ 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)
#message("-- ${PACKAGE_NAME}: calling TRIBITS_PKG_EXPORT_CACHE_VAR(${CAMEL_NAME})")
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
FOREACH(opt ${KOKKOS_GIVEN_VARIABLES})
STRING(TOUPPER ${opt} OPT_UC)
Expand Down

0 comments on commit 2d56274

Please sign in to comment.