+++ /dev/null
-#####
-##
-## Copyright (C) 2012 by the deal.II authors
-##
-## This file is part of the deal.II library.
-##
-## <TODO: Full License information>
-## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later
-## version of the LGPL license.
-##
-## Author: Matthias Maier <matthias.maier@iwr.uni-heidelberg.de>
-##
-#####
-
-#
-# Try to find the AMD library
-#
-# This is a helper module for FindUMFPACK.cmake
-#
-# This module exports
-#
-# AMD_LIBRARY
-# AMD_INCLUDE_DIR
-#
-
-INCLUDE(FindPackageHandleStandardArgs)
-
-SET_IF_EMPTY(AMD_DIR "$ENV{AMD_DIR}")
-SET_IF_EMPTY(UMFPACK_DIR "$ENV{UMFPACK_DIR}")
-
-FIND_PATH(AMD_INCLUDE_DIR amd.h
- HINTS
- ${AMD_DIR}
- ${UMFPACK_DIR}
- ${UMFPACK_DIR}/../AMD/
- PATH_SUFFIXES
- amd include/amd include Include AMD/Include
- )
-
-FIND_LIBRARY(AMD_LIBRARY
- NAMES amd
- HINTS
- ${AMD_DIR}
- ${UMFPACK_DIR}
- ${UMFPACK_DIR}/../AMD
- PATH_SUFFIXES
- lib${LIB_SUFFIX} lib64 lib Lib AMD/Lib
- )
-
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(AMD DEFAULT_MSG
- AMD_LIBRARY
- AMD_INCLUDE_DIR
- )
-
-IF(AMD_FOUND)
- MARK_AS_ADVANCED(
- AMD_LIBRARY
- AMD_INCLUDE_DIR
- AMD_DIR
- )
-ELSE()
- SET(AMD_DIR "" CACHE STRING
- "An optional hint to an AMD directory"
- )
-ENDIF()
-
+++ /dev/null
-#####
-##
-## Copyright (C) 2012 by the deal.II authors
-##
-## This file is part of the deal.II library.
-##
-## <TODO: Full License information>
-## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later
-## version of the LGPL license.
-##
-## Author: Matthias Maier <matthias.maier@iwr.uni-heidelberg.de>
-##
-#####
-
-#
-# Try to find the SuiteSparse_config package
-#
-# This is a helper module for FindUMFPACK.cmake
-#
-# This module exports
-#
-# SUITESPARSECONFIG_LIBRARY
-# SUITESPARSECONFIG_INCLUDE_DIR
-#
-
-INCLUDE(FindPackageHandleStandardArgs)
-
-SET_IF_EMPTY(UMFPACK_DIR "$ENV{UMFPACK_DIR}")
-SET_IF_EMPTY(SUITESPARSE_DIR "$ENV{SUITESPARSECONFIG_DIR}")
-
-FIND_PATH(SUITESPARSECONFIG_INCLUDE_DIR SuiteSparse_config.h
- HINTS
- ${SUITESPARSECONFIG_DIR}
- ${UMFPACK_DIR}
- ${UMFPACK_DIR}/../SuiteSparse_config
- PATH_SUFFIXES
- include SuiteSparse_config
- )
-
-FIND_LIBRARY(SUITESPARSECONFIG_LIBRARY
- NAMES suitesparseconfig
- HINTS
- ${SUITESPARSECONFIG_DIR}
- ${UMFPACK_DIR}
- ${UMFPACK_DIR}/../SuiteSparse_config
- PATH_SUFFIXES
- lib${LIB_SUFFIX} lib64 lib SuiteSparse_config
- )
-
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(SUITESPARSECONFIG DEFAULT_MSG
- SUITESPARSECONFIG_LIBRARY
- SUITESPARSECONFIG_INCLUDE_DIR
- )
-
-IF(SUITESPARSECONFIG_FOUND)
- MARK_AS_ADVANCED(
- SUITESPARSECONFIG_LIBRARY
- SUITESPARSECONFIG_INCLUDE_DIR
- SUITESPARSECONFIG_DIR
- )
-ELSE()
- SET(SUITESPARSECONFIG_DIR "" CACHE STRING
- "An optional hint to a SuiteSparse_config directory"
- )
-ENDIF()
-
#####
##
-## Copyright (C) 2012 by the deal.II authors
+## Copyright (C) 2012, 2013 by the deal.II authors
##
## This file is part of the deal.II library.
##
INCLUDE(FindPackageHandleStandardArgs)
-SET_IF_EMPTY(UMFPACK_DIR "$ENV{UMFPACK_DIR}")
+FOREACH(_comp SUITESPARSE SUITESPARSE_CONFIG UMFPACK AMD CHOLMOD COLAMD)
+ SET_IF_EMPTY(${_comp}_DIR "$ENV{${_comp}_DIR}")
+ENDFOREACH()
+
#
-# UMFPACK depends on AMD and BLAS, so search for them:
+# UMFPACK depends on BLAS and LAPACK, so search for them:
+# TODO: There might be an external dependency for metis, ignore this for
+# now.
#
-FIND_PACKAGE(AMD)
+
FIND_PACKAGE(BLAS)
+FIND_PACKAGE(LAPACK)
-FIND_PATH(UMFPACK_INCLUDE_DIR umfpack.h
- HINTS
- ${UMFPACK_DIR}
- PATH_SUFFIXES
- umfpack include/umfpack include Include UMFPACK/Include
- )
-FIND_LIBRARY(UMFPACK_LIBRARY
- NAMES umfpack
- HINTS
- ${UMFPACK_DIR}
- PATH_SUFFIXES
- lib${LIB_SUFFIX} lib64 lib Lib UMFPACK/Lib
- )
+#
+# Two macros to make life easier:
+#
-SET(required_variables
- BLAS_FOUND
- AMD_FOUND
- UMFPACK_INCLUDE_DIRS
- UMFPACK_LIBRARY
- )
+MACRO(FIND_UMFPACK_PATH _comp _file)
+ STRING(TOLOWER ${_comp} _comp_lowercase)
+ STRING(TOUPPER ${_comp} _comp_uppercase)
+ FIND_PATH(${_comp}_INCLUDE_DIR ${_file}
+ HINTS
+ ${${_comp_uppercase}_DIR}
+ ${SUITESPARSE_DIR}/${_comp}
+ ${UMFPACK_DIR}/../${_comp}
+ ${UMFPACK_DIR}/${_comp}
+ ${UMFPACK_DIR}
+ PATH_SUFFIXES
+ ${_comp_lowercase} include/${_comp_lowercase} include Include ${_comp}/Include
+ )
+ENDMACRO()
+
+MACRO(FIND_UMFPACK_LIBRARY _comp _name)
+ STRING(TOUPPER ${_comp} _comp_uppercase)
+ FIND_LIBRARY(${_comp}_LIBRARY
+ NAMES ${_name}
+ HINTS
+ ${${_comp_uppercase}_DIR}
+ ${SUITESPARSE_DIR}/${_comp}
+ ${UMFPACK_DIR}/../${_comp}
+ ${UMFPACK_DIR}/${_comp}
+ ${UMFPACK_DIR}
+ PATH_SUFFIXES
+ lib${LIB_SUFFIX} lib64 lib Lib ${_comp}/Lib
+ )
+ IF(NOT "${ARGN}" STREQUAL "REQUIRED")
+ IF(${_comp}_LIBRARY MATCHES "-NOTFOUND")
+ SET(${_comp}_LIBRARY "")
+ ENDIF()
+ ENDIF()
+ENDMACRO()
+
+
+#
+# Search for include directories:
+#
+FIND_UMFPACK_PATH(UMFPACK umfpack.h)
+FIND_UMFPACK_PATH(AMD amd.h)
#
-# Well, recent versions of UMFPACK >= 5.6 include SuiteSparse_config.h, if so,
+# Well, recent versions of UMFPACK include SuiteSparse_config.h, if so,
# ensure that we'll find these headers as well.
#
IF(NOT UMFPACK_INCLUDE_DIR MATCHES "-NOTFOUND")
FILE(STRINGS "${UMFPACK_INCLUDE_DIR}/umfpack.h" UMFPACK_SUITESPARSE_STRING
REGEX "#include \"SuiteSparse_config.h\"")
IF(NOT "${UMFPACK_SUITESPARSE_STRING}" STREQUAL "")
- FIND_PACKAGE(SUITESPARSECONFIG)
- LIST(APPEND required_variables
- SUITESPARSECONFIG_FOUND
- )
+ FIND_UMFPACK_PATH(SuiteSparse_config SuiteSparse_config.h)
+ LIST(APPEND required_variables SuiteSparse_config_INCLUDE_DIR)
ENDIF()
ENDIF()
-#
-# Otherwise, we're lazy for the moment.
-#
#
-# UMFPACK may need to be linked with cholmod as well.
+# Link against everything we can find to avoid underlinkage:
#
-FIND_LIBRARY(CHOLMOD_LIBRARY
- NAMES cholmod
- HINTS
- ${UMFPACK_DIR}
- PATH_SUFFIXES
- lib${LIB_SUFFIX} lib64 lib Lib UMFPACK/Lib
- )
-IF(CHOLMOD_LIBRARY MATCHES "-NOTFOUND")
- SET(CHOLMOD_LIBRARY "")
-ENDIF()
+FIND_UMFPACK_LIBRARY(UMFPACK umfpack REQUIRED)
+FIND_UMFPACK_LIBRARY(AMD amd REQUIRED)
+FIND_UMFPACK_LIBRARY(CHOLMOD cholmod)
+FIND_UMFPACK_LIBRARY(COLAMD colamd)
+FIND_UMFPACK_LIBRARY(SuiteSparse_config suitesparseconfig)
SET(UMFPACK_LIBRARIES
${UMFPACK_LIBRARY}
${CHOLMOD_LIBRARY} # may be empty
+ ${COLAMD_LIBRARY} # may be empty
${AMD_LIBRARY}
- ${SUITESPARSECONFIG_LIBRARY} # may be empty
+ ${SuiteSparse_config_LIBRARY} # may be empty
+ ${LAPACK_LIBRARIES}
${BLAS_LIBRARIES}
)
SET(UMFPACK_INCLUDE_DIRS
${UMFPACK_INCLUDE_DIR}
- ${SUITESPARSECONFIG_INCLUDE_DIR} # may be empty
${AMD_INCLUDE_DIR}
+ ${SuiteSparse_config_INCLUDE_DIR} # may be empty
)
SET(UMFPACK_LINKER_FLAGS
${BLAS_LINKER_FLAGS}
+ ${LAPACK_LINKER_FLAGS}
)
-
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(UMFPACK DEFAULT_MSG ${required_variables})
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(UMFPACK DEFAULT_MSG UMFPACK_LIBRARIES UMFPACK_INCLUDE_DIRS)
IF(UMFPACK_FOUND)
MARK_AS_ADVANCED(
+ atlas_LIBRARY
+ blas_LIBRARY
UMFPACK_LIBRARY
+ AMD_LIBRARY
+ CHOLMOD_LIBRARY
+ COLAMD_LIBRARY
+ SuiteSparse_config_LIBRARY
UMFPACK_INCLUDE_DIR
+ AMD_INCLUDE_DIR
+ SuiteSparse_config_INCLUDE_DIR
UMFPACK_DIR
- CHOLMOD_LIBRARY
- atlas_LIBRARY
- blas_LIBRARY
+ SUITESPARSE_DIR
)
ELSE()
SET(UMFPACK_DIR "" CACHE STRING
"An optional hint to an UMFPACK directory"
)
+ SET(SUITESPARSE_DIR "" CACHE STRING
+ "An optional hint to a SUITESPARSE directory"
+ )
ENDIF()