# Configuration for the SUNDIALS library:
#
+MACRO(FEATURE_SUNDIALS_FIND_EXTERNAL var)
+ FIND_PACKAGE(SUNDIALS)
+
+ IF(SUNDIALS_FOUND)
+ SET(${var} TRUE)
+
+ #
+ # We don't support version 4.0.0 or later yet.
+ #
+ SET(_first_unsupported_sundials_version 4.0.0)
+ IF(NOT SUNDIALS_VERSION VERSION_LESS ${_first_unsupported_sundials_version})
+ MESSAGE(STATUS
+ "Insufficient SUNDIALS installation found: "
+ "version ${_first_unsupported_sundials_version} "
+ "or later is not yet supported, "
+ "but version ${SUNDIALS_VERSION} was found."
+ )
+ SET(SUNDIALS_ADDITIONAL_ERROR_STRING
+ "Insufficient SUNDIALS installation found!\n"
+ "Version ${_first_unsupported_sundials_version} "
+ "or later is not yet supported, "
+ "but version ${SUNDIALS_VERSION} was found.\n"
+ )
+ SET(${var} FALSE)
+ ENDIF()
+ ENDIF()
+ENDMACRO()
+
MACRO(FEATURE_SUNDIALS_CONFIGURE_EXTERNAL)
SET(DEAL_II_SUNDIALS_WITH_IDAS ${SUNDIALS_WITH_IDAS})
ENDMACRO()
# SUNDIALS_LIBRARIES
# SUNDIALS_INCLUDE_DIR
# SUNDIALS_WITH_IDAS
+# SUNDIALS_VERSION
+# SUNDIALS_VERSION_MAJOR
+# SUNDIALS_VERSION_MINOR
+# SUNDIALS_VERSION_PATCH
#
# Note that sundials headers are typically installed in several directories,
# e.g.,
SET(SUNDIALS_WITH_IDAS FALSE)
ENDIF()
+#
+# Extract SUNDIALS version.
+#
+DEAL_II_FIND_FILE(SUNDIALS_CONFIG_H
+ NAMES sundials_config.h
+ HINTS ${SUNDIALS_INCLUDE_DIR}/sundials
+ )
+IF(NOT SUNDIALS_CONFIG_H MATCHES "-NOTFOUND")
+ FILE(STRINGS "${SUNDIALS_CONFIG_H}" SUNDIALS_VERSION_MAJOR_STRING
+ REGEX "#define.*SUNDIALS_VERSION_MAJOR"
+ )
+ STRING(REGEX REPLACE "^.*SUNDIALS_VERSION_MAJOR.*([0-9]+).*" "\\1"
+ SUNDIALS_VERSION_MAJOR "${SUNDIALS_VERSION_MAJOR_STRING}"
+ )
+ FILE(STRINGS "${SUNDIALS_CONFIG_H}" SUNDIALS_VERSION_MINOR_STRING
+ REGEX "#define.*SUNDIALS_VERSION_MINOR"
+ )
+ STRING(REGEX REPLACE "^.*SUNDIALS_VERSION_MINOR.*([0-9]+).*" "\\1"
+ SUNDIALS_VERSION_MINOR "${SUNDIALS_VERSION_MINOR_STRING}"
+ )
+ FILE(STRINGS "${SUNDIALS_CONFIG_H}" SUNDIALS_VERSION_PATCH_STRING
+ REGEX "#define.*SUNDIALS_VERSION_PATCH"
+ )
+ STRING(REGEX REPLACE "^.*SUNDIALS_VERSION_PATCH.*([0-9]+).*" "\\1"
+ SUNDIALS_VERSION_PATCH "${SUNDIALS_VERSION_PATCH_STRING}"
+ )
+ENDIF()
+IF(NOT "${SUNDIALS_VERSION_MAJOR}")
+ SET(SUNDIALS_VERSION_MAJOR "0")
+ENDIF()
+IF(NOT "${SUNDIALS_VERSION_MINOR}")
+ SET(SUNDIALS_VERSION_MINOR "0")
+ENDIF()
+IF(NOT "${SUNDIALS_VERSION_PATCH}")
+ SET(SUNDIALS_VERSION_PATCH "0")
+ENDIF()
+SET(SUNDIALS_VERSION
+ "${SUNDIALS_VERSION_MAJOR}.${SUNDIALS_VERSION_MINOR}.${SUNDIALS_VERSION_PATCH}"
+ )
DEAL_II_PACKAGE_HANDLE(SUNDIALS
LIBRARIES REQUIRED
- ${_sundials_lib_ida} SUNDIALS_LIB_ARKODE
- SUNDIALS_LIB_KINSOL SUNDIALS_LIB_SER ${_sundials_lib_par}
+ ${_sundials_lib_ida}
+ SUNDIALS_LIB_ARKODE
+ SUNDIALS_LIB_KINSOL
+ SUNDIALS_LIB_SER
+ ${_sundials_lib_par}
INCLUDE_DIRS REQUIRED
SUNDIALS_INCLUDE_DIR
USER_INCLUDE_DIRS REQUIRED
SUNDIALS_INCLUDE_DIR
CLEAR
- SUNDIALS_LIB_IDA SUNDIALS_LIB_IDAS SUNDIALS_LIB_ARKODE
- SUNDIALS_LIB_KINSOL SUNDIALS_LIB_SER ${_sundials_lib_par}
+ SUNDIALS_LIB_IDA
+ SUNDIALS_LIB_IDAS
+ SUNDIALS_LIB_ARKODE
+ SUNDIALS_LIB_KINSOL
+ SUNDIALS_LIB_SER
+ ${_sundials_lib_par}
+ SUNDIALS_INCLUDE_DIR
+ SUNDIALS_CONFIG_H
)
(major)*1000000 + (minor)*10000 + (subminor)*100 + (patch))
#endif
- /*
- * SUNDIALS:
- *
- * Note: The following definitions will be set in sundials_config.h,
- * so we don't repeat them here.
- *
- * SUNDIALS_VERSION_MAJOR
- * SUNDIALS_VERSION_MINOR
- * SUNDIALS_VERSION_PATCH
- */
-
- #define DEAL_II_SUNDIALS_VERSION_GTE(major,minor,subminor) \
- ((SUNDIALS_VERSION_MAJOR * 10000 + \
- SUNDIALS_VERSION_MINOR * 100 + \
- SUNDIALS_VERSION_SUBMINOR) \
+/*
+ * SUNDIALS:
+ */
+
+#ifdef DEAL_II_WITH_SUNDIALS
+ # define DEAL_II_SUNDIALS_VERSION_MAJOR @SUNDIALS_VERSION_MAJOR@
+ # define DEAL_II_SUNDIALS_VERSION_MINOR @SUNDIALS_VERSION_MINOR@
+ # define DEAL_II_SUNDIALS_VERSION_PATCH @SUNDIALS_VERSION_PATCH@
+
+ #define DEAL_II_SUNDIALS_VERSION_GTE(major,minor,patch) \
+ ((DEAL_II_SUNDIALS_VERSION_MAJOR * 10000 + \
+ DEAL_II_SUNDIALS_VERSION_MINOR * 100 + \
+ DEAL_II_SUNDIALS_VERSION_PATCH) \
>= \
- (major)*10000 + (minor)*100 + (subminor))
+ (major)*10000 + (minor)*100 + (patch))
- #define DEAL_II_SUNDIALS_VERSION_LT(major,minor,subminor) \
- ((SUNDIALS_VERSION_MAJOR * 10000 + \
- SUNDIALS_VERSION_MINOR * 100 + \
- SUNDIALS_VERSION_SUBMINOR) \
+ #define DEAL_II_SUNDIALS_VERSION_LT(major,minor,patch) \
+ ((DEAL_II_SUNDIALS_VERSION_MAJOR * 10000 + \
+ DEAL_II_SUNDIALS_VERSION_MINOR * 100 + \
+ DEAL_II_SUNDIALS_VERSION_PATCH) \
< \
- (major)*10000 + (minor)*100 + (subminor))
+ (major)*10000 + (minor)*100 + (patch))
+#endif
/*
* PETSc: