Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STK: Snapshot 09-07-23 09:29 from Sierra 5.15.5-39-g00862c40 #12224

Merged
merged 1 commit into from
Sep 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
130 changes: 97 additions & 33 deletions packages/stk/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,101 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#

#
# A) Define the package
#
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)

TRIBITS_PACKAGE_DECL( STK )
IF(COMMAND TRIBITS_PACKAGE_DECL)
SET(HAVE_STK_Trilinos ON)
TRIBITS_PACKAGE_DECL(STK)
MESSAGE("*** Building STK as a Trilinos package. ***")
ELSE()
SET(HAVE_STK_Trilinos OFF)
project(STK CXX)

TRIBITS_ADD_DEBUG_OPTION()
TRIBITS_ADD_SHOW_DEPRECATED_WARNINGS_OPTION()
SET(PACKAGE_NAME "STK")

#
# B) Set up package-specific options
#
MESSAGE("*** Building STK as a stand-alone cmake package. ***")
ENDIF()

SET(STK_TOPLEVEL_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
SET(STK_TOPLEVEL_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})

INCLUDE(${STK_TOPLEVEL_SOURCE_DIR}/cmake/stk_wrappers.cmake)

if(CMAKE_INSTALL_INCLUDE_DIR)
SET(STK_INSTALL_INCLUDE_DIR ${CMAKE_INSTALL_INCLUDE_DIR})
elseif(INSTALL_INCLUDE_DIR)
SET(STK_INSTALL_INCLUDE_DIR ${INSTALL_INCLUDE_DIR})
else()
SET(STK_INSTALL_INCLUDE_DIR "include")
endif()

if(CMAKE_INSTALL_LIBDIR)
SET(STK_INSTALL_LIBDIR ${CMAKE_INSTALL_LIBDIR})
elseif(INSTALL_LIBDIR)
SET(STK_INSTALL_LIBDIR ${INSTALL_LIBDIR})
else()
SET(STK_INSTALL_LIBDIR "lib")
endif()

if(CMAKE_INSTALL_BINDIR)
SET(STK_INSTALL_BINDIR ${CMAKE_INSTALL_BINDIR})
elseif(INSTALL_BINDIR)
SET(STK_INSTALL_BINDIR ${INSTALL_BINDIR})
else()
SET(STK_INSTALL_BINDIR "bin")
endif()

STK_ADD_DEBUG_AND_DEPRECATED_OPTIONS()

MESSAGE("\nPROJECT_NAME: '${PROJECT_NAME}'")
MESSAGE("PACKAGE_NAME: '${PACKAGE_NAME}'")
MESSAGE("${PACKAGE_NAME}_SOURCE_DIR: '${${PACKAGE_NAME}_SOURCE_DIR}'\n")

IF (HAVE_STK_Trilinos)
SET(STK_HAVE_KOKKOS ON)
if (TPL_ENABLE_MPI OR HAVE_MPI)
message("STK_HAS_MPI is true")
SET(STK_HAS_MPI ON)
else()
message("STK_HAS_MPI is false")
SET(STK_HAS_MPI OFF)
endif()
ELSE()
if(STK_ENABLE_TESTS)
enable_testing()
endif()

IF (${${PROJECT_NAME}_ENABLE_Kokkos})
find_package(Kokkos REQUIRED)
SET(STK_HAVE_KOKKOS ON)

IF(DEFINED STK_ENABLE_MPI)
IF(STK_ENABLE_MPI)
MESSAGE("MPI requested via STK_ENABLE_MPI=ON")
ELSE()
MESSAGE("MPI disabled via STK_ENABLE_MPI=OFF")
ENDIF()
ELSE()
MESSAGE("MPI defaulting to off. (STK_ENABLE_MPI not defined)")
ENDIF()

IF(STK_ENABLE_MPI)
find_package(MPI)
IF(MPI_FOUND)
SET(STK_HAS_MPI ON)
include_directories(SYSTEM ${MPI_INCLUDE_PATH})
message("MPI_INCLUDE_PATH: ${MPI_INCLUDE_PATH}")
ELSE()
MESSAGE(FATAL_ERROR "MPI enabled by '-DSTK_ENABLE_MPI' but not found.")
ENDIF()
ELSE()
MESSAGE("Building serial without MPI. (To enable MPI, use '-DSTK_ENABLE_MPI:BOOL=ON')")
ENDIF()
ENDIF()

if(NOT HAVE_STK_Trilinos)
stk_process_enables()
endif()

IF (TPL_ENABLE_Boost)
SET(STK_HAVE_BOOST ON)
ENDIF()
Expand All @@ -72,13 +150,6 @@ IF (NOT ${PROJECT_NAME}_ENABLE_SEACASAprepro_lib)
SET(NOT_HAVE_STK_SEACASAPREPRO_LIB TRUE)
ENDIF()

TRIBITS_ADD_OPTION_AND_DEFINE(
${PACKAGE_NAME}_Trilinos
HAVE_STK_Trilinos
"Building as a Trilinos package"
ON
)

# set fortran mangling options

IF("${FC_FN_UNDERSCORE}" STREQUAL "NO_UNDER")
Expand All @@ -92,24 +163,17 @@ ELSE()
SET(FORTRAN_ONE_UNDERSCORE ON)
ENDIF()

TRIBITS_CONFIGURE_FILE(STK_Trilinos_config.h)
TRIBITS_INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
MESSAGE("\nCMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}")
MESSAGE("${PROJECT_NAME}_INSTALL_INCLUDE_DIR: ${${PROJECT_NAME}_INSTALL_INCLUDE_DIR}")
MESSAGE("${PROJECT_NAME}_INSTALL_LIBDIR: ${${PROJECT_NAME}_INSTALL_LIBDIR}")
MESSAGE("${PROJECT_NAME}_INSTALL_BINDIR: ${${PROJECT_NAME}_INSTALL_BINDIR}\n")

INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/STK_Trilinos_config.h DESTINATION
${${PROJECT_NAME}_INSTALL_INCLUDE_DIR}/)
#
# C) Add the libraries, tests, and examples
TRIBITS_PROCESS_SUBPACKAGES()
STK_CONFIGURE_FILE(STK_Trilinos_config.h)

TRIBITS_PACKAGE_DEF()
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/STK_Trilinos_config.h DESTINATION
${${PROJECT_NAME}_INSTALL_INCLUDE_DIR}/stk_util)

#need to find out what to exclude
#TRIBITS_EXCLUDE_FILES(
# )

#
# D) Do standard postprocessing
#
STK_SUBPACKAGES()

TRIBITS_PACKAGE_POSTPROCESS()
STK_PACKAGE_POSTPROCESS()

6 changes: 3 additions & 3 deletions packages/stk/cmake/Dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ SET(SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS
Math stk_math PT OPTIONAL
Simd stk_simd PT OPTIONAL
NGP_TEST stk_ngp_test PT OPTIONAL
ExprEval stk_expreval PT OPTIONAL
Topology stk_topology PT OPTIONAL
Mesh stk_mesh PT OPTIONAL
IO stk_io PT OPTIONAL
Search stk_search PT OPTIONAL
Middle_mesh stk_middle_mesh EX OPTIONAL
Transfer stk_transfer PT OPTIONAL
Mesh stk_mesh PT OPTIONAL
IO stk_io PT OPTIONAL
Tools stk_tools PT OPTIONAL
Balance stk_balance PT OPTIONAL
Unit_test_utils stk_unit_test_utils PT OPTIONAL
ExprEval stk_expreval PT OPTIONAL
SearchUtil stk_search_util EX OPTIONAL
TransferUtil stk_transfer_util EX OPTIONAL
Unit_tests stk_unit_tests PT OPTIONAL
Expand Down
2 changes: 1 addition & 1 deletion packages/stk/cmake/STK_Trilinos_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

#cmakedefine STK_HAVE_STKNGP_TEST

#cmakedefine HAVE_MPI
#cmakedefine STK_HAS_MPI

#cmakedefine STK_VOLATILE_SIMD

Expand Down
180 changes: 180 additions & 0 deletions packages/stk/cmake/stk_wrappers.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@

macro(STK_ADD_DEBUG_AND_DEPRECATED_OPTIONS)
if(HAVE_STK_Trilinos)
TRIBITS_ADD_DEBUG_OPTION()
TRIBITS_ADD_SHOW_DEPRECATED_WARNINGS_OPTION()
else()
# what should we do here?
endif()
endmacro()

macro(STK_CONFIGURE_FILE filename)
if(HAVE_STK_Trilinos)
TRIBITS_CONFIGURE_FILE(${filename})
TRIBITS_INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
else()
configure_file(${STK_TOPLEVEL_SOURCE_DIR}/cmake/${filename}.in ${CMAKE_CURRENT_BINARY_DIR}/${filename})
endif()
endmacro()

function(stk_process_enables)
if(STK_ENABLE_ALL)
set(STK_ENABLE_STKUtil ON PARENT_SCOPE)

if (DEFINED STK_ENABLE_STKCoupling AND NOT STK_ENABLE_STK_Coupling)
message("STKCoupling explicitly disabled.")
elseif(NOT STK_HAS_MPI)
message("STKCoupling disabled because MPI not enabled.")
else()
set(STK_ENABLE_STKCoupling ON PARENT_SCOPE)
endif()

if (DEFINED STK_ENABLE_STKMath AND NOT STK_ENABLE_STK_Math)
message("STKMath explicitly disabled.")
else()
set(STK_ENABLE_STKMath ON PARENT_SCOPE)
endif()

if (DEFINED STK_ENABLE_STKSimd AND NOT STK_ENABLE_STK_Simd)
message("STKSimd explicitly disabled.")
else()
set(STK_ENABLE_STKSimd ON PARENT_SCOPE)
endif()

if (DEFINED STK_ENABLE_STKNGP_TEST AND NOT STK_ENABLE_STK_NGP_TEST)
message("STKNGP_TEST explicitly disabled.")
else()
set(STK_ENABLE_STKNGP_TEST ON PARENT_SCOPE)
endif()

if (DEFINED STK_ENABLE_STKExprEval AND NOT STK_ENABLE_STKExprEval)
message("STKExprEval explicitly disabled.")
else()
set(STK_ENABLE_STKExprEval ON PARENT_SCOPE)
endif()

if (DEFINED STK_ENABLE_STKTopology AND NOT STK_ENABLE_STK_Topology)
message("STKTopology explicitly disabled.")
else()
set(STK_ENABLE_STKTopology ON PARENT_SCOPE)
endif()

if (DEFINED STK_ENABLE_STKSearch AND NOT STK_ENABLE_STK_Search)
message("STKSearch explicitly disabled.")
elseif(NOT STK_HAS_MPI)
message("STKSearch disabled because MPI not enabled.")
else()
set(STK_ENABLE_STKSearch ON PARENT_SCOPE)
endif()

if (DEFINED STK_ENABLE_STKMiddle_mesh AND NOT STK_ENABLE_STK_Middle_mesh)
message("STKMiddle_mesh explicitly disabled.")
else()
set(STK_ENABLE_STKMiddle_mesh ON PARENT_SCOPE)
endif()

if (DEFINED STK_ENABLE_STKTransfer AND NOT STK_ENABLE_STK_Transfer)
message("STKTransfer explicitly disabled.")
elseif(NOT STK_ENABLE_STKSearch)
message("STKTransfer disabled because STKSearch not enabled.")
else()
set(STK_ENABLE_STKTransfer ON PARENT_SCOPE)
endif()
endif()

if(STK_ENABLE_TESTS)
set(STK_ENABLE_STKUnit_tests ON PARENT_SCOPE)
set(STK_ENABLE_STKDoc_tests ON PARENT_SCOPE)
endif()
endfunction()

macro(STK_SUBPACKAGES)
if(HAVE_STK_Trilinos)
TRIBITS_PROCESS_SUBPACKAGES()
else()
add_subdirectory(stk_util)
message("STKUtil is always enabled.")

if(STK_ENABLE_STKCoupling)
add_subdirectory(stk_coupling)
endif()

if(STK_ENABLE_STKMath)
add_subdirectory(stk_math)
message("STKMath is enabled.")
endif()

if(STK_ENABLE_STKSimd)
add_subdirectory(stk_simd)
message("STKSimd is enabled.")
endif()

if(STK_ENABLE_STKNGP_TEST)
add_subdirectory(stk_ngp_test)
message("STKNGP_TEST is enabled.")
endif()

if(STK_ENABLE_STKExprEval)
add_subdirectory(stk_expreval)
message("STKExprEval is enabled.")
endif()

if(STK_ENABLE_STKTopology)
add_subdirectory(stk_topology)
message("STKTopology is enabled.")
endif()

if(STK_ENABLE_STKSearch)
add_subdirectory(stk_search)
message("STKSearch is enabled.")
endif()

if(STK_ENABLE_STKMiddle_mesh)
add_subdirectory(stk_middle_mesh)
message("STKMiddle_mesh is enabled.")
endif()

if(STK_ENABLE_STKTransfer)
add_subdirectory(stk_transfer)
message("STKTransfer is enabled.")
endif()

if(STK_ENABLE_TESTS)
add_subdirectory(stk_unit_test_utils)
message("STKUnit_test_utils is enabled.")

add_subdirectory(stk_unit_tests)
message("STKUnit_tests is enabled.")
endif()
endif()
endmacro()

macro(STK_SUBPACKAGE subpkg)
if(HAVE_STK_Trilinos)
TRIBITS_SUBPACKAGE($subpkg)
else()
endif()
endmacro()

macro(STK_ADD_TEST_DIRECTORIES subdir)
if(HAVE_STK_Trilinos)
TRIBITS_ADD_TEST_DIRECTORIES(${subdir})
else()
add_subdirectory(${subdir})
endif()
endmacro()

macro(STK_SUBPACKAGE_POSTPROCESS)
if(HAVE_STK_Trilinos)
TRIBITS_SUBPACKAGE_POSTPROCESS()
else()
endif()
endmacro()

macro(STK_PACKAGE_POSTPROCESS)
if(HAVE_STK_Trilinos)
TRIBITS_PACKAGE_DEF()
TRIBITS_PACKAGE_POSTPROCESS()
else()
endif()
endmacro()
7 changes: 5 additions & 2 deletions packages/stk/stk_balance/stk_balance/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ SET(SOURCES "")
SET(HEADERS_IMPL "")
SET(SOURCES_IMPL "")

TRIBITS_INCLUDE_DIRECTORIES(${${PACKAGE_NAME}_SOURCE_DIR})

#
# Core headers
#
Expand Down Expand Up @@ -97,6 +95,11 @@ TRIBITS_ADD_LIBRARY(
SOURCES ${SOURCES} ${SOURCES_INTERNAL} ${SOURCES_M2N} ${SOURCES_SETUP} ${SOURCES_SEARCH_TOLERANCE_ALGS}
)

target_include_directories(stk_balance_lib PUBLIC
$<BUILD_INTERFACE:${STK_TOPLEVEL_SOURCE_DIR}/stk_balance>
$<INSTALL_INTERFACE:include>
)

TRIBITS_ADD_EXECUTABLE(
stk_balance
SOURCES ${SOURCES_MAIN}
Expand Down
Loading