From: Matthias Maier Date: Thu, 24 Nov 2022 16:07:24 +0000 (-0600) Subject: CMake: Bugfix: only configure arborx with matching MPI configuration X-Git-Tag: v9.5.0-rc1~811^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F14468%2Fhead;p=dealii.git CMake: Bugfix: only configure arborx with matching MPI configuration --- diff --git a/cmake/configure/configure_50_arborx.cmake b/cmake/configure/configure_50_arborx.cmake index c9d08aca80..5fc0bbd2b0 100644 --- a/cmake/configure/configure_50_arborx.cmake +++ b/cmake/configure/configure_50_arborx.cmake @@ -17,6 +17,39 @@ # Configuration for ArborX support in deal.II: # +set(FEATURE_ARBORX_AFTER MPI) set(FEATURE_ARBORX_DEPENDS KOKKOS) +macro(FEATURE_ARBORX_FIND_EXTERNAL var) + find_package(ARBORX) + + if(ARBORX_FOUND) + # + # So, we have a library. Let's see whether we can use it: + # + set(${var} TRUE) + + # + # ArborX has to be configured with the same MPI configuration as + # deal.II. + # + if((NOT ARBORX_WITH_MPI AND DEAL_II_WITH_MPI) OR (ARBORX_WITH_MPI AND NOT DEAL_II_WITH_MPI)) + message(STATUS "Could not find a sufficient ArborX installation: " + "ArborX has to be configured with the same MPI configuration as deal.II." + ) + set(ARBORX_ADDITIONAL_ERROR_STRING + ${ARBORX_ADDITIONAL_ERROR_STRING} + "Could not find a sufficient ArborX installation:\n" + "ArborX has to be configured with the same MPI configuration as deal.II, but found:\n" + " DEAL_II_WITH_MPI = ${DEAL_II_WITH_MPI}\n" + " ARBORX_WITH_MPI = ${ARBORX_WITH_MPI}\n" + ) + set(${var} FALSE) + endif() + endif() + + set(DEAL_II_ARBORX_WITH_MPI ${ARBORX_WITH_MPI}) +endmacro() + configure_feature(ARBORX) + diff --git a/cmake/modules/FindARBORX.cmake b/cmake/modules/FindARBORX.cmake index bce8085066..b1587ab9a6 100644 --- a/cmake/modules/FindARBORX.cmake +++ b/cmake/modules/FindARBORX.cmake @@ -20,6 +20,7 @@ # # ARBORX_INCLUDE_DIRS # ARBORX_INTERFACE_LINK_FLAGS +# ARBORX_WITH_MPI # set(ARBORX_DIR "" CACHE PATH "An optional hint to an ArborX installation") @@ -56,9 +57,10 @@ if(ArborX_FOUND) file(STRINGS "${ARBORX_CONFIG_HPP}" ARBORX_MPI_STRING REGEX "#define ARBORX_ENABLE_MPI") if("${ARBORX_MPI_STRING}" STREQUAL "") + set(ARBORX_WITH_MPI FALSE) message(STATUS "ArborX has no MPI support") else() - set(DEAL_II_ARBORX_WITH_MPI TRUE) + set(ARBORX_WITH_MPI TRUE) message(STATUS "ArborX has MPI support") endif() endif()