From 8071e7b17e299f2592ed324c5dbf62f4b46e270a Mon Sep 17 00:00:00 2001 From: Luca Heltai Date: Mon, 14 Aug 2017 15:13:02 -0600 Subject: [PATCH] Sundials detection mechanism. --- cmake/configure/configure_sundials.cmake | 20 ++++++ cmake/modules/FindSUNDIALS.cmake | 87 ++++++++++++++++++++++++ doc/doxygen/options.dox.in | 1 + include/deal.II/base/config.h.in | 1 + 4 files changed, 109 insertions(+) create mode 100644 cmake/configure/configure_sundials.cmake create mode 100644 cmake/modules/FindSUNDIALS.cmake diff --git a/cmake/configure/configure_sundials.cmake b/cmake/configure/configure_sundials.cmake new file mode 100644 index 0000000000..aec7794275 --- /dev/null +++ b/cmake/configure/configure_sundials.cmake @@ -0,0 +1,20 @@ +## --------------------------------------------------------------------- +## +## Copyright (C) 2017 by the deal.II authors +## +## This file is part of the deal.II library. +## +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. +## +## --------------------------------------------------------------------- + +# +# Configuration for the SUNDIALS library: +# + +CONFIGURE_FEATURE(SUNDIALS) diff --git a/cmake/modules/FindSUNDIALS.cmake b/cmake/modules/FindSUNDIALS.cmake new file mode 100644 index 0000000000..731d93aec7 --- /dev/null +++ b/cmake/modules/FindSUNDIALS.cmake @@ -0,0 +1,87 @@ +## --------------------------------------------------------------------- +## +## Copyright (C) 2015-2016 by the deal.II authors +## +## This file is part of the deal.II library. +## +## The deal2lkit library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. +## +## --------------------------------------------------------------------- + +# +# Try to find the SUNDIALS libraries +# +# This module exports +# +# SUNDIALS_LIBRARIES +# SUNDIALS_INCLUDE_DIRS +# + +SET(SUNDIALS_DIR "" CACHE PATH "An optional hint to a SUNDIALS_DIR installation") +SET_IF_EMPTY(SUNDIALS_DIR "$ENV{SUNDIALS_DIR}") + +DEAL_II_FIND_LIBRARY(SUNDIALS_LIB_IDA NAMES sundials_ida + HINTS ${SUNDIALS_DIR} + PATH_SUFFIXES lib + ) + +DEAL_II_FIND_LIBRARY(SUNDIALS_LIB_KINSOL NAMES sundials_kinsol + HINTS ${SUNDIALS_DIR} + PATH_SUFFIXES lib + ) + +DEAL_II_FIND_LIBRARY(SUNDIALS_LIB_SER NAMES sundials_nvecserial + HINTS ${SUNDIALS_DIR} + PATH_SUFFIXES lib + ) + +SET(SUN_INC "${SUNDIALS_DIR}/include") + +IF(DEAL_II_WITH_MPI) + DEAL_II_FIND_LIBRARY(SUNDIALS_LIB_PAR NAMES sundials_nvecparallel + HINTS ${SUNDIALS_DIR} + PATH_SUFFIXES lib + ) + + DEAL_II_PACKAGE_HANDLE(SUNDIALS + LIBRARIES REQUIRED + SUNDIALS_LIB_IDA + SUNDIALS_LIB_KINSOL + SUNDIALS_LIB_SER + SUNDIALS_LIB_PAR + INCLUDE_DIRS + REQUIRED SUN_INC + USER_INCLUDE_DIRS + REQUIRED SUN_INC + CLEAR + SUNDIALS_LIB_IDA + SUNDIALS_LIB_KINSOL + SUNDIALS_LIB_SER + SUNDIALS_LIB_PAR + SUN_INC + ) + +ELSE() + + DEAL_II_PACKAGE_HANDLE(SUNDIALS + LIBRARIES REQUIRED + SUNDIALS_LIB_IDA + SUNDIALS_LIB_KINSOL + SUNDIALS_LIB_SER + INCLUDE_DIRS + REQUIRED SUN_INC + USER_INCLUDE_DIRS + REQUIRED SUN_INC + CLEAR + SUNDIALS_LIB_IDA + SUNDIALS_LIB_KINSOL + SUNDIALS_LIB_SER + SUN_INC + ) + +ENDIF() diff --git a/doc/doxygen/options.dox.in b/doc/doxygen/options.dox.in index b01d714ecc..4a2ebca021 100644 --- a/doc/doxygen/options.dox.in +++ b/doc/doxygen/options.dox.in @@ -186,6 +186,7 @@ PREDEFINED = DOXYGEN=1 \ DEAL_II_WITH_P4EST=1 \ DEAL_II_WITH_PETSC=1 \ DEAL_II_WITH_SLEPC=1 \ + DEAL_II_WITH_SUNDIALS=1 \ DEAL_II_WITH_THREADS=1 \ DEAL_II_WITH_TRILINOS=1 \ DEAL_II_WITH_UMFPACK=1 \ diff --git a/include/deal.II/base/config.h.in b/include/deal.II/base/config.h.in index 2755ae740a..6a922060c4 100644 --- a/include/deal.II/base/config.h.in +++ b/include/deal.II/base/config.h.in @@ -52,6 +52,7 @@ #cmakedefine DEAL_II_WITH_P4EST #cmakedefine DEAL_II_WITH_PETSC #cmakedefine DEAL_II_WITH_SLEPC +#cmakedefine DEAL_II_WITH_SUNDIALS #cmakedefine DEAL_II_WITH_THREADS #cmakedefine DEAL_II_WITH_TRILINOS #cmakedefine DEAL_II_WITH_UMFPACK -- 2.39.5