Skip to content

Commit

Permalink
CMake: clean up TPetra warnings:
Browse files Browse the repository at this point in the history
 - use our CMake indent style
 - avoid declaring unused DEAL_II* variables
 - make Tpetra status message shorter
  • Loading branch information
tamiko committed Jul 23, 2024
1 parent ebb6dda commit f8659e1
Showing 1 changed file with 31 additions and 52 deletions.
83 changes: 31 additions & 52 deletions cmake/configure/configure_20_trilinos.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -263,60 +263,32 @@ macro(feature_trilinos_find_external var)
TRILINOS_TPETRA_IS_FUNCTIONAL
)

if(TRILINOS_TPETRA_IS_FUNCTIONAL)
check_cxx_symbol_exists(HAVE_TPETRA_INST_FLOAT "TpetraCore_config.h" DEAL_II_HAVE_TPETRA_INST_FLOAT)
check_cxx_symbol_exists(HAVE_TPETRA_INST_DOUBLE "TpetraCore_config.h" DEAL_II_HAVE_TPETRA_INST_DOUBLE)
check_cxx_symbol_exists(HAVE_TPETRA_INST_COMPLEX_FLOAT "TpetraCore_config.h" DEAL_II_HAVE_TPETRA_INST_COMPLEX_FLOAT)
check_cxx_symbol_exists(HAVE_TPETRA_INST_COMPLEX_DOUBLE "TpetraCore_config.h" DEAL_II_HAVE_TPETRA_INST_COMPLEX_DOUBLE)
else()
message(
STATUS
"Tpetra was found but is not usable! Disabling Tpetra support and searching for common errors."
)
if(NOT TRILINOS_TPETRA_IS_FUNCTIONAL)
message(STATUS "Tpetra was found but is not usable due to a mismatch in ordinal number types.")
set(TRILINOS_WITH_TPETRA OFF)

check_cxx_symbol_exists(HAVE_TPETRA_INT_INT "TpetraCore_config.h" DEAL_II_HAVE_TPETRA_INT_INT)
check_cxx_symbol_exists(HAVE_TPETRA_INT_LONG "TpetraCore_config.h" DEAL_II_HAVE_TPETRA_INT_LONG)
check_cxx_symbol_exists(HAVE_TPETRA_INT_LONG_LONG "TpetraCore_config.h" DEAL_II_HAVE_TPETRA_INT_LONG_LONG)

if(NOT DEAL_II_HAVE_TPETRA_INT_LONG_LONG AND DEAL_II_WITH_64BIT_INDICES)
message(
STATUS
" Tpetra wasn't configured with support for 64-bit global indices\n"
" but deal.II is configured to use 64-bit global indices.\n"
" Either reconfigure deal.II with -DDEAL_II_WITH_64BIT_INDICES=OFF\n"
" or rebuild Trilinos with -DTpetra_INST_INT_LONG_LONG=ON"
)
if(DEAL_II_HAVE_TPETRA_INT_LONG)
message(
STATUS
" and -DTpetra_INST_INT_LONG=OFF."
check_cxx_symbol_exists(HAVE_TPETRA_INT_INT "TpetraCore_config.h"_tpetra_int_int)
check_cxx_symbol_exists(HAVE_TPETRA_INT_LONG_LONG "TpetraCore_config.h" _tpetra_int_long_long)

if(NOT _tpetra_int_long_long AND DEAL_II_WITH_64BIT_INDICES)
message( STATUS
" Tpetra was configured *without* support for 64-bit global indices"
"but deal.II is configured to use 64-bit global indices."
)
elseif(DEAL_II_HAVE_TPETRA_INT_INT)
message(
STATUS
" and -DTpetra_INST_INT_INT=OFF."
message(STATUS
" Either reconfigure deal.II with -DDEAL_II_WITH_64BIT_INDICES=OFF"
" or rebuild Trilinos with -DTpetra_INST_INT_LONG_LONG=ON"
)
endif()
elseif(NOT DEAL_II_HAVE_TPETRA_INT_INT AND NOT DEAL_II_WITH_64BIT_INDICES)
message(
STATUS
" Tpetra wasn't configured with support for 32-bit global indices\n"
" but deal.II is configured to use 32-bit global indices.\n"
" Either reconfigure deal.II with -DDEAL_II_WITH_64BIT_INDICES=ON\n"
" or rebuild Trilinos with -DTpetra_INST_INT_INT=ON"
)
if(DEAL_II_HAVE_TPETRA_INT_LONG)
message(
STATUS
" and -DTpetra_INST_INT_LONG=OFF."

elseif(NOT _tpetra_int_int AND NOT DEAL_II_WITH_64BIT_INDICES)
message( STATUS
" Tpetra was configured *without* support for 32-bit global indices"
"but deal.II is configured to use 32-bit global indices."
)
elseif(DEAL_II_HAVE_TPETRA_INT_LONG_LONG)
message(
STATUS
" and -DTpetra_INST_INT_LONG_LONG=OFF."
message(STATUS
" Either reconfigure deal.II with -DDEAL_II_WITH_64BIT_INDICES=ON"
" or rebuild Trilinos with -DTpetra_INST_INT_INT=ON"
)
endif()
endif()

reset_cmake_required()
Expand Down Expand Up @@ -462,18 +434,25 @@ macro(feature_trilinos_configure_external)
set(DEAL_II_EXPAND_EPETRA_VECTOR "LinearAlgebra::EpetraWrappers::Vector")

if(${DEAL_II_TRILINOS_WITH_TPETRA})
if(DEAL_II_HAVE_TPETRA_INST_DOUBLE)
check_cxx_symbol_exists(HAVE_TPETRA_INST_DOUBLE "TpetraCore_config.h" _tpetra_inst_double)
if(_tpetra_inst_double)
set(DEAL_II_EXPAND_TPETRA_TYPES "double")
set(DEAL_II_EXPAND_TPETRA_VECTOR_DOUBLE "LinearAlgebra::TpetraWrappers::Vector<double>")
endif()
if(DEAL_II_HAVE_TPETRA_INST_FLOAT)

check_cxx_symbol_exists(HAVE_TPETRA_INST_FLOAT "TpetraCore_config.h" _tpetra_inst_float)
if(_tpetra_inst_float)
set(DEAL_II_EXPAND_TPETRA_VECTOR_FLOAT "LinearAlgebra::TpetraWrappers::Vector<float>")
endif()

if(${DEAL_II_WITH_COMPLEX_NUMBERS})
if(DEAL_II_HAVE_TPETRA_INST_COMPLEX_DOUBLE)
check_cxx_symbol_exists(HAVE_TPETRA_INST_COMPLEX_DOUBLE "TpetraCore_config.h" _tpetra_inst_complex_double)
if(_tpetra_inst_complex_double)
set(DEAL_II_EXPAND_TPETRA_VECTOR_COMPLEX_DOUBLE "LinearAlgebra::TpetraWrappers::Vector<std::complex<double>>")
endif()
if(DEAL_II_HAVE_TPETRA_INST_COMPLEX_FLOAT)

check_cxx_symbol_exists(HAVE_TPETRA_INST_COMPLEX_FLOAT "TpetraCore_config.h" _tpetra_inst_complex_float)
if(_tpetra_inst_complex_float)
set(DEAL_II_EXPAND_TPETRA_VECTOR_COMPLEX_FLOAT "LinearAlgebra::TpetraWrappers::Vector<std::complex<float>>")
endif()
endif()
Expand Down

0 comments on commit f8659e1

Please sign in to comment.