Skip to content
Snippets Groups Projects
Commit 5305bca7 authored by Markus Blatt's avatar Markus Blatt
Browse files

[umfack] Moved build system tests for umfpack to dune-common

This patch removed the tests for umfpack from dune-istl as they
are already needed in dune-common. There are modules using umfpack
that do not require dune-istl. Therefore dune-common seems to be the
more appropriate place for the test.
parent a21b96d9
No related branches found
No related tags found
No related merge requests found
# module providing convenience mehtods for compiling bianries with UMFPack support
#
# Provides the following functions:
#
# add_dune_umfpack_flags(target1 target2...)
#
# adds UMFPack flags to the targets for compilation and linking
function(add_dune_umfpack_flags _targets)
if(UMFPACK_FOUND)
foreach(_target ${_targets})
target_link_libraries(${_target} ${UMFPACK_DUNE_LIBRARIES})
get_target_property(_props ${_target} COMPILE_FLAGS)
string(REPLACE "_props-NOTFOUND" "" _props "${_props}")
set_target_properties(${_target} PROPERTIES COMPILE_FLAGS
"${_props} ${UMFPACK_DUNE_COMPILE_FLAGS} -DENABLE_UMFPACK")
endforeach(_target ${_targets})
endif(UMFPACK_FOUND)
endfunction(add_dune_umfpack_flags)
\ No newline at end of file
set(modules
AddSuperLUFlags.cmake
AddUMFPackFlags.cmake
DuneIstlMacros.cmake
FindSuperLU.cmake
FindUMFPack.cmake)
FindSuperLU.cmake)
install(FILES ${modules} DESTINATION
${DUNE_INSTALL_MODULEDIR})
# Module that checks whether UMFPack is available.
#
# Variables used by this module which you may want to set:
# UMFPACK_ROOT Path list to search for UMFPack
#
# Sets the following variables
#
# UMFPACK_FOUND True if UMFPack was found and usable
# UMFPACK_INCLUDE_DIRS Path to the UMFPack include dirs
# UMFPACK_LIBRARIES Name of the UMFPack libraries
#
find_package(BLAS QUIET REQUIRED)
if(NOT BLAS_FOUND)
message(WARNING "UMFPack requires BLAS which was not found, skipping the test.")
return()
endif()
find_library(AMD_LIBRARY
NAMES "amd"
PATHS ${UMFPACK_ROOT}
PATH_SUFFIXES "lib" "lib32" "lib64" "AMD" "AMD/Lib"
NO_DEFAULT_PATH
)
find_library(AMD_LIBRARY
NAMES "amd"
PATH_SUFFIXES "lib" "lib32" "lib64" "AMD" "AMD/Lib"
)
if(NOT AMD_LIBRARY)
message(WARNING "UMFPack requires AMD which was not found, skipping the test.")
return()
endif()
#look for header files at positions given by the user
find_path(UMFPACK_INCLUDE_DIR
NAMES "umfpack.h"
PATHS ${UMFPACK_ROOT}
PATH_SUFFIXES "umfpack" "include/umfpack" "suitesparse" "include" "src" "UMFPACK" "UMFPACK/Include"
NO_DEFAULT_PATH
)
#now also look for default paths
find_path(UMFPACK_INCLUDE_DIR
NAMES "umfpack.h"
PATH_SUFFIXES "umfpack" "include/umfpack" "suitesparse" "include" "UMFPACK" "UMFPACK/Include"
)
#look for library at positions given by the user
find_library(UMFPACK_LIBRARY
NAMES "umfpack"
PATHS ${UMFPACK_ROOT}
PATH_SUFFIXES "lib" "lib32" "lib64" "UMFPACK" "UMFPACK/Lib"
NO_DEFAULT_PATH
)
#now also include the deafult paths
find_library(UMFPACK_LIBRARY
NAMES "umfpack"
PATH_SUFFIXES "lib" "lib32" "lib64" "UMFPACK" "UMFPACK/Lib"
)
if(UMFPACK_INCLUDE_DIR)
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${UMFPACK_INCLUDE_DIR} ${AMD_INCLUDE_DIR})
endif()
if(UMFPACK_LIBRARY)
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${UMFPACK_LIBRARY})
endif()
if(BLAS_LIBRARIES)
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${BLAS_LIBRARIES})
endif()
if(AMD_LIBRARY)
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${AMD_LIBRARY})
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
"UMFPack"
DEFAULT_MSG
UMFPACK_INCLUDE_DIR
UMFPACK_LIBRARY
)
mark_as_advanced(UMFPACK_INCLUDE_DIR UMFPACK_LIBRARY)
if(UMFPACK_FOUND)
set(UMFPACK_INCLUDE_DIRS ${UMFPACK_INCLUDE_DIR})
set(UMFPACK_LIBRARIES ${UMFPACK_LIBRARY})
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining location of UMFPack succeded:\n"
"Include directory: ${UMFPACK_INCLUDE_DIRS}\n"
"Library directory: ${UMFPACK_LIBRARIES}\n\n")
set(UMFPACK_DUNE_COMPILE_FLAGS "-I${UMFPACK_INCLUDE_DIRS}"
CACHE STRING "Compile Flags used by DUNE when compiling with UMFPack programs")
set(UMFPACK_DUNE_LIBRARIES ${UMFPACK_LIBRARIES} ${BLAS_LIBRARIES} ${AMD_LIBRARY}
CACHE STRING "LIbraries used by DUNE when linking UMFPack programs")
else(UMFPACK_FOUND)
file(APPEND ${CMAKE_BINARY_DIR}${CMAKES_FILES_DIRECTORY}/CMakeError.log
"Determing location of UMFPack failed:\n"
"Include directory: ${UMFPACK_INCLUDE_DIRS}\n"
"Library directory: ${UMFPACK_LIBRARIES}\n\n")
endif(UMFPACK_FOUND)
#set HAVE_UMFPACK for config.h
set(HAVE_UMFPACK UMFPACK_FOUND)
#add all umfpack related flags to ALL_PKG_FLAGS, this must happen regardless of a target using add_dune_umfpack_flags
if(UMFPACK_FOUND)
set_property(GLOBAL APPEND PROPERTY ALL_PKG_FLAGS "${UMFPACK_DUNE_COMPILE_FLAGS}")
foreach(dir "${UMFPACK_INCLUDE_DIRS}")
set_property(GLOBAL APPEND PROPERTY ALL_PKG_FLAGS "-I${dir}")
endforeach()
endif()
\ No newline at end of file
MODULES = AddSuperLUFlags.cmake \
AddUMFPackFlags.cmake \
DuneIstlMacros.cmake \
FindSuperLU.cmake \
FindUMFPack.cmake
FindSuperLU.cmake
modulesdir= $(datadir)/cmake/modules
dist_modules_DATA = ${MODULES}
......
# courtesy of the dune-fem maintainers
AC_DEFUN([DUNE_PATH_UMFPACK],[
AC_REQUIRE([AC_PROG_CC])
AC_ARG_WITH(umfpack,
AC_HELP_STRING([--with-umfpack=PATH],[directory with UMFPACK inside]))
AC_ARG_WITH(umfpack-includedir,
AC_HELP_STRING([--with-umfpack-includedir=PATH],[directory with UMFPACK headers inside]))
AC_ARG_WITH(umfpack-libdir,
AC_HELP_STRING([--with-umfpack-libdir=PATH],[directory with UMFPACK libraries inside]))
# store old values
ac_save_LDFLAGS="$LDFLAGS"
ac_save_CPPFLAGS="$CPPFLAGS"
ac_save_LIBS="$LIBS"
UMFPACKYES=0
## do nothing if no --with-umfpack was supplied
if test x$with_umfpack != x && test x$with_umfpack != xno ; then
UMFPACKYES=1
fi
if test x$with_umfpack_includedir != x && test x$with_umfpack_includedir != xno ; then
UMFPACKYES=1
fi
if test x$with_umfpack_libdir != x && test x$with_umfpack_libdir != xno ; then
UMFPACKYES=1
fi
if test x$UMFPACKYES = x1 ; then
# is --with-umfpack=bla used?
if test "x$with_umfpack" != x ; then
UMFPACKROOT=`cd $with_umfpack && pwd`
if ! test -d $UMFPACKROOT; then
AC_MSG_WARN([UMFPACK directory $with_umfpack does not exist])
fi
if test "x$UMFPACKROOT" = x; then
# use some default value...
UMFPACKROOT="/usr/local/umfpack"
fi
UMFAMD_LIB_PATH="$UMFPACKROOT/AMD/Lib"
UMFPACK_LIB_PATH="$UMFPACKROOT/UMFPACK/Lib"
UMFPACK_INCLUDE_PATH="$UMFPACKROOT/UMFPACK/Include"
else
if test "x$with_umfpack_includedir" != x ; then
UMFPACK_INCLUDE_PATH=`cd $with_umfpack_includedir && pwd`
if ! test -d $UMFPACK_INCLUDE_PATH; then
AC_MSG_WARN([UMFPACK directory $with_umfpack_includedir does not exist])
fi
fi
if test "x$with_umfpack_libdir" != x ; then
UMFPACK_LIB_PATH=`cd $with_umfpack_libdir && pwd`
if ! test -d $UMFPACK_LIB_PATH; then
AC_MSG_WARN([UMFPACK directory $with_umfpack_libdir does not exist])
fi
fi
UMFAMD_LIB_PATH=$UMFPACK_LIB_PATH
fi
# set variables so that tests can use them
REM_CPPFLAGS=$CPPFLAGS
LDFLAGS="$LDFLAGS -L$UMFPACK_LIB_PATH -L$UMFAMD_LIB_PATH"
UMFPACK_INC_FLAG="-I$UMFPACK_INCLUDE_PATH -I$UMFPACKROOT/UFconfig -I$UMFPACKROOT/AMD/Include -I$UMFPACKROOT/SuiteSparse_config -DENABLE_UMFPACK=1"
CPPFLAGS="$CPPFLAGS $UMFPACK_INC_FLAG $MPI_CPPFLAGS"
# check for header
AC_LANG_PUSH([C])
AC_CHECK_HEADERS([umfpack.h],
[UMFPACK_CPPFLAGS="$UMFPACK_INC_FLAG"
HAVE_UMFPACK="1"],
AC_MSG_WARN([umfpack.h not found in $UMFPACK_INCLUDE_PATH]))
CPPFLAGS="$REM_CPPFLAGS"
REM_CPPFLAGS=
REM_LDFLAGS=$LDFLAGS
# if header is found...
if test x$HAVE_UMFPACK = x1 ; then
AC_CHECK_LIB(umfpack,[main],
[UMFPACK_LIBS="-lumfpack"
UMFPACK_LDFLAGS="-L$UMFPACK_LIB_PATH"],
[HAVE_UMFPACK="0"
AC_MSG_WARN(libumfpack not found!)])
fi
# if lib is found...
if test x$HAVE_UMFPACK = x1 ; then
AC_CHECK_LIB(amd,[main],
[UMFPACK_LIBS="$UMFPACK_LIBS -lamd"
UMFPACK_LDFLAGS="$UMFPACK_LDFLAGS -L$UMFAMD_LIB_PATH"
LIBS="$LIBS $UMFPACK_LIBS"],
[HAVE_UMFPACK="0"
AC_MSG_WARN(libamd not found!)])
fi
LDFLAGS=$REM_LDFLAGS
AC_LANG_POP
## end of umfpack check (--without wasn't set)
fi
# survived all tests?
if test x$HAVE_UMFPACK = x1 ; then
AC_SUBST(UMFPACK_LIBS, $UMFPACK_LIBS)
AC_SUBST(UMFPACK_LDFLAGS, $UMFPACK_LDFLAGS)
AC_SUBST(UMFPACK_CPPFLAGS, $UMFPACK_CPPFLAGS)
AC_DEFINE(HAVE_UMFPACK, ENABLE_UMFPACK,
[This is only true if umfpack-library was found by configure
_and_ if the application uses the UMFPACK_CPPFLAGS])
# add to global list
DUNE_ADD_ALL_PKG([UMFPACK], [\${UMFPACK_CPPFLAGS}],
[\${UMFPACK_LDFLAGS}], [\${UMFPACK_LIBS}])
# set variable for summary
with_umfpack="yes"
else
AC_SUBST(UMFPACK_LIBS, "")
AC_SUBST(UMFPACK_LDFLAGS, "")
AC_SUBST(UMFPACK_CPPFLAGS, "")
# set variable for summary
with_umfpack="no"
fi
# also tell automake
AM_CONDITIONAL(UMFPACK, test x$HAVE_UMFPACK = x1)
# reset old values
LIBS="$ac_save_LIBS"
CPPFLAGS="$ac_save_CPPFLAGS"
LDFLAGS="$ac_save_LDFLAGS"
DUNE_ADD_SUMMARY_ENTRY([UMFPACK],[$with_umfpack])
])
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment