# always an exception, isn't it?) DEAL_II_FORCE_CONTRIB_<library> forces
# the use of the bundled contrib library.
#
+#
+# Autoconfiguration: If the option DEAL_II_FEATURE_AUTODETECTION is enabled
+# the DEAL_II_WITH_<feature> toggles will be automatically set (overwriting
+# any previous configuration) depending on whether they can be supported or
+# not.
+# (Note: DEAL_II_FEATURE_AUTODETECTION will respect DEAL_II_ALLOW_CONTRIB
+# and DEAL_II_FORCE_CONTRIB_<library>)
+#
+#
# The option DEAL_II_FORCE_CONTRIB_<library> forces the use of the bundled
# contrib library regardless whether DEAL_II_ALLOW_CONTRIB is set to OFF or
# an external library is found.
# #
###########################################################################
+#
+# Feature selection:
+#
+
+OPTION(DEAL_II_FEATURE_AUTODETECTION
+ "Enables feature autodetection. This will automatically overwrite all
+ DEAL_II_WITH_<...> toggles depending on whether they can be supported or
+ not."
+ OFF)
+
+OPTION(DEAL_II_WITH_BLAS
+ "Build deal.II with support for BLAS."
+ ON)
+
OPTION(DEAL_II_WITH_FUNCTIONPARSER
"Build deal.II with support for functionparser."
+ OFF)
+
+OPTION(DEAL_II_WITH_LAPACK
+ "Build deal.II with support for LAPACK."
ON)
OPTION(DEAL_II_WITH_METIS
"Build deal.II with support for netcdf."
OFF)
-OPTION(DEAL_II_WITH_THREADS
- "Build deal.II with support for threads. This pulls in libtbb as a dependency."
+OPTION(DEAL_II_WITH_TBB
+ "Build deal.II with support for tbb. This will enable thread support in deal.II."
ON)
OPTION(DEAL_II_WITH_UMFPACK
- "Build deal.II with support for UMFPACK, BLAS and LAPACK."
+ "Build deal.II with support for UMFPACK."
ON)
OPTION(DEAL_II_WITH_ZLIB
packages, so to ensure that only external libraries are used
DEAL_II_ALLOW_CONTRIB as well as all DEAL_II_FORCE_CONTRIB_* have to be
OFF"
- OFF)
+ ON)
OPTION(DEAL_II_FORCE_CONTRIB_FUNCTIONPARSER
"Always use the bundled functionparser library instead of an external one."
- ON)
+ OFF)
OPTION(DEAL_II_FORCE_CONTRIB_BOOST
"Always use the bundled boost library instead of an external one."
OPTION(DEAL_II_FORCE_CONTRIB_TBB
"Always use the bundled tbb library instead of an external one."
- ON)
+ OFF)
OPTION(DEAL_II_FORCE_CONTRIB_UMFPACK
"Always use the bundled umfpack library instead of an external one."
- ON)
+ OFF)
#
# Compatibility support:
# Run all system checks:
#
-FILE(GLOB macro_files "contrib/cmake/check/*.cmake")
-FOREACH(file ${macro_files})
- MESSAGE(STATUS "Include ${file}")
- INCLUDE(${file})
-ENDFOREACH()
+#FILE(GLOB check_files "contrib/cmake/check/*.cmake")
+#FOREACH(file ${check_files})
+# MESSAGE(STATUS "Include ${file}")
+# INCLUDE(${file})
+#ENDFOREACH()
#
# Feature configuration:
#
-IF(DEAL_II_WITH_FUNCTIONPARSER)
- INCLUDE(configure_functionparser)
-ENDIF()
-IF(DEAL_II_WITH_MPI)
- INCLUDE(configure_mpi)
-ENDIF()
-IF(DEAL_II_WITH_NETCDF)
- INCLUDE(configure_netcdf)
-ENDIF()
-IF(DEAL_II_WITH_THREADS)
- INCLUDE(configure_threads)
-ENDIF()
-# Boost depends on configuration variables set in configure_threads.cmake
+INCLUDE(configure_blas)
+INCLUDE(configure_lapack)
+INCLUDE(configure_umfpack)
+
+INCLUDE(configure_functionparser)
+
+INCLUDE(configure_mpi)
+
+INCLUDE(configure_netcdf)
+
+INCLUDE(configure_tbb)
+
+# Boost has to be incluted after threads because it depends on the thread
+# configuration
INCLUDE(configure_boost)
-IF(DEAL_II_WITH_UMFPACK)
- INCLUDE(configure_umfpack)
-ENDIF()
-IF(DEAL_II_WITH_ZLIB)
- INCLUDE(configure_zlib)
-ENDIF()
+INCLUDE(configure_zlib)
ADD_SUBDIRECTORY(include)
ADD_SUBDIRECTORY(source)
+
+MESSAGE(STATUS "Configured features:")
+GET_CMAKE_PROPERTY(res VARIABLES)
+FOREACH(var ${res})
+ IF(var MATCHES "DEAL_II_WITH")
+ MESSAGE(STATUS "${var} : ${${var}}")
+ ENDIF()
+ENDFOREACH()
--- /dev/null
+#
+# Configuration for the blas library:
+#
+
+# TODO:
+# - include dir?
+# - unit checks and definitions.
+
+MACRO(FIND_FEATURE_BLAS_EXTERNAL var)
+
+ FIND_PACKAGE(BLAS)
+
+ IF(BLAS_FOUND)
+ SET(${var} TRUE)
+ ENDIF()
+
+ENDMACRO()
+
+
+MACRO(CONFIGURE_FEATURE_BLAS_EXTERNAL var)
+
+ SET(CMAKE_SHARED_LINKER_FLAGS
+ "${CMAKE_SHARED_LINKER_FLAGS} ${BLAS_LINKER_FLAGS}"
+ )
+
+ LIST(APPEND deal_ii_external_libraries
+ ${BLAS_LIBRARIES}
+ )
+
+ SET(HAVE_LIBBLAS TRUE)
+
+ SET(${var} TRUE)
+ENDMACRO()
+
+
+MACRO(CONFIGURE_FEATURE_BLAS_ERROR_MESSAGE)
+ MESSAGE(SEND_ERROR "
+Could not find the blas library!
+
+Please ensure that the blas library is installed on your computer.
+If the library is not at a default location, either provide some hints
+for the autodetection, or set the relevant variables by hand in ccmake.
+
+")
+ENDMACRO()
+
+
+CONFIGURE_FEATURE(BLAS)
-IF(NOT DEAL_II_FORCE_CONTRIB_BOOST)
+#
+# Configuration for the boost library:
+#
+
+# Always true. We need it :-]
+SET(DEAL_II_WITH_BOOST "ON"
+ CACHE STRING "Build deal.II with support for boost." FORCE
+ )
+
+
+MACRO(FIND_FEATURE_BOOST_EXTERNAL var)
FIND_PACKAGE (Boost COMPONENTS serialization thread)
- IF(NOT DEAL_II_ALLOW_CONTRIB)
- IF(NOT Boost_THREAD_FOUND OR NOT Boost_SERIALIZATION_FOUND)
- macro_message_not_found("boost" "Boost")
- ENDIF()
- ELSE()
+ IF(Boost_THREAD_FOUND AND Boost_SERIALIZATION_FOUND)
+ SET(${var} TRUE)
+
# Get rid of this annoying unimportant variable:
MARK_AS_ADVANCED(Boost_DIR)
ENDIF()
-ENDIF()
+ENDMACRO()
-IF( NOT DEAL_II_FORCE_CONTRIB_BOOST AND
- Boost_THREAD_FOUND AND
- Boost_SERIALIZATION_FOUND )
+MACRO(CONFIGURE_FEATURE_BOOST_EXTERNAL var)
INCLUDE_DIRECTORIES (${Boost_INCLUDE_DIR})
)
ENDIF()
-ELSE()
+ SET(${var} TRUE)
+ENDMACRO()
+
+
+SET(HAVE_CONTRIB_FEATURE_BOOST TRUE)
+
+
+MACRO(CONFIGURE_FEATURE_BOOST_CONTRIB var)
# compile the necessary parts of boost out of ./contrib
)
ENDIF()
-ENDIF()
+ SET(${var} TRUE)
+ENDMACRO()
+
+
+MACRO(CONFIGURE_FEATURE_BOOST_ERROR_MESSAGE)
+ MESSAGE(SEND_ERROR "
+Could not find the boost library!
+
+Please ensure that the boost library is installed on your computer.
+If the library is not at a default location, either provide some hints
+for the autodetection, or set the relevant variables by hand in ccmake.
+
+Alternatively you may choose to compile the bundled contrib library of
+boost by setting DEAL_II_ALLOW_CONTRIB=on or
+DEAL_II_FORCE_CONTRIB_BOOST=on.
+
+")
+ENDMACRO()
+
+
+CONFIGURE_FEATURE(BOOST)
-IF(NOT DEAL_II_FORCE_CONTRIB_FUNCTIONPARSER)
+MACRO(FIND_FEATURE_FUNCTIONPARSER_EXTERNAL var)
+ENDMACRO()
- IF(NOT DEAL_II_ALLOW_CONTRIB)
- MESSAGE(FATAL_ERROR "FindFunctionparser.cmake not written, yet. :-[")
- ENDIF()
-ENDIF()
+MACRO(CONFIGURE_FEATURE_FUNCTIONPARSER_EXTERNAL var)
+ENDMACRO()
-IF(DEAL_II_FORCE_CONTRIB_FUNCTIONPARSER OR NOT Functionparser_FOUND)
+
+SET(HAVE_CONTRIB_FEATURE_FUNCTIONPARSER TRUE)
+
+
+MACRO(CONFIGURE_FEATURE_FUNCTIONPARSER_CONTRIB var)
+
+ # compile the necessary parts of functionparser out of ./contrib
INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/contrib/functionparser/
$<TARGET_OBJECTS:obj_functionparser>
)
-ELSE()
+ SET(HAVE_FUNCTIONPARSER TRUE)
+
+ SET(${var} TRUE)
+ENDMACRO()
+
+
+MACRO(CONFIGURE_FEATURE_FUNCTIONPARSER_ERROR_MESSAGE)
+ MESSAGE(SEND_ERROR "
+Could not find the functionparser library!
+
+Module not written, yet...
- INCLUDE_DIRECTORIES(${Functionparser_INCLUDE_DIR})
+You may want to choose to compile the bundled contrib library of
+functionparser by setting DEAL_II_ALLOW_CONTRIB=on or
+DEAL_II_FORCE_CONTRIB_FUNCTIONPARSER=on.
- LIST(APPEND deal_ii_external_libraries ${Functionparser_LIBRARY})
+")
+ENDMACRO()
-ENDIF()
-SET(HAVE_FUNCTIONPARSER TRUE)
+CONFIGURE_FEATURE(FUNCTIONPARSER)
--- /dev/null
+#
+# Configuration for the lapack library:
+#
+
+# TODO:
+# - include dir?
+# - unit checks and definitions.
+
+MACRO(FIND_FEATURE_LAPACK_EXTERNAL var)
+
+ FIND_PACKAGE(LAPACK)
+
+ IF(LAPACK_FOUND)
+ SET(${var} TRUE)
+ ENDIF()
+
+ENDMACRO()
+
+
+MACRO(CONFIGURE_FEATURE_LAPACK_EXTERNAL var)
+
+ SET(CMAKE_SHARED_LINKER_FLAGS
+ "${CMAKE_SHARED_LINKER_FLAGS} ${LAPACK_LINKER_FLAGS}"
+ )
+
+ LIST(APPEND deal_ii_external_libraries
+ ${LAPACK_LIBRARIES}
+ )
+
+ SET(HAVE_LIBLAPACK TRUE)
+
+ SET(${var} TRUE)
+
+ENDMACRO()
+
+
+MACRO(CONFIGURE_FEATURE_BLAS_ERROR_MESSAGE)
+ MESSAGE(SEND_ERROR "
+Could not find the lapack library!
+
+Please ensure that the lapack library is installed on your computer.
+If the library is not at a default location, either provide some hints
+for the autodetection, or set the relevant variables by hand in ccmake.
+
+")
+ENDMACRO()
+
+
+CONFIGURE_FEATURE(LAPACK)
-FIND_PACKAGE(MPI REQUIRED CXX)
+#
+# Configuration for mpi support:
+#
-# TODO: A deal.II specific error message if mpi is not found
+MACRO(FIND_FEATURE_MPI_EXTERNAL var)
-INCLUDE_DIRECTORIES(${MPI_CXX_INCLUDE_PATH})
+ FIND_PACKAGE(MPI)
-SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${MPI_CXX_LINK_FLAGS}")
+ IF(MPI_CXX_FOUND)
+ SET(${var} TRUE)
+ ENDIF()
-LIST(APPEND deal_ii_external_libraries ${MPI_CXX_LIBRARIES})
+ENDMACRO()
-SET(DEAL_II_COMPILER_SUPPORTS_MPI TRUE)
+MACRO(CONFIGURE_FEATURE_MPI_EXTERNAL var)
-# MPI_CXX_COMPILER MPI Compiler wrapper for CXX
-# MPI_CXX_COMPILE_FLAGS Compilation flags for MPI programs
+ INCLUDE_DIRECTORIES(${MPI_CXX_INCLUDE_PATH})
+ SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${MPI_CXX_LINK_FLAGS}")
+ LIST(APPEND deal_ii_external_libraries ${MPI_CXX_LIBRARIES})
+ SET(DEAL_II_COMPILER_SUPPORTS_MPI TRUE)
-# MPIEXEC Executable for running MPI programs
-# MPIEXEC_NUMPROC_FLAG Flag to pass to MPIEXEC before giving
-# it the number of processors to run on
-# MPIEXEC_PREFLAGS Flags to pass to MPIEXEC directly
-# before the executable to run.
-# MPIEXEC_POSTFLAGS Flags to pass to MPIEXEC after other flags
+
+ #MPI_CXX_COMPILER MPI Compiler wrapper for CXX
+ #MPI_CXX_COMPILE_FLAGS Compilation flags for MPI programs
+
+
+ #MPIEXEC Executable for running MPI programs
+ #MPIEXEC_NUMPROC_FLAG Flag to pass to MPIEXEC before giving
+ # it the number of processors to run on
+ #MPIEXEC_PREFLAGS Flags to pass to MPIEXEC directly
+ # before the executable to run.
+ #MPIEXEC_POSTFLAGS Flags to pass to MPIEXEC after other flags
+
+ SET(${var} TRUE)
+ENDMACRO()
+
+
+MACRO(CONFIGURE_FEATURE_MPI_ERROR_MESSAGE)
+ MESSAGE(SEND_ERROR "
+Could not find any suitable mpi library!
+
+Please ensure that an mpi library is installed on your computer.
+If the library is not at a default location, either provide some hints
+for the autodetection, or set the relevant variables by hand in ccmake.
+
+")
+ENDMACRO()
+
+
+CONFIGURE_FEATURE(MPI)
-FIND_PACKAGE(NETCDF)
+#
+# Configuration for the netcdf library:
+#
-IF(NOT NETCDF_FOUND)
- macro_message_not_found("netcdf" "NETCDF")
-ENDIF()
+MACRO(FIND_FEATURE_NETCDF_EXTERNAL var)
-INCLUDE_DIRECTORIES(${NETCDF_INCLUDE_DIR})
+ FIND_PACKAGE(NETCDF)
-LIST(APPEND deal_ii_external_libraries ${NETCDF_LIBRARY})
+ IF(NETCDF_FOUND)
+ SET(${var} TRUE)
+ ENDIF()
-SET(HAVE_LIBNETCDF TRUE)
+ENDMACRO()
+
+
+MACRO(CONFIGURE_FEATURE_NETCDF_EXTERNAL var)
+
+ INCLUDE_DIRECTORIES(${NETCDF_INCLUDE_DIR})
+ LIST(APPEND deal_ii_external_libraries ${NETCDF_LIBRARY})
+ SET(HAVE_LIBNETCDF TRUE)
+
+ SET(${var} TRUE)
+ENDMACRO()
+
+
+MACRO(CONFIGURE_FEATURE_NETCDF_ERROR_MESSAGE)
+
+ MESSAGE(SEND_ERROR "
+Could not find the netcdf library!
+
+Please ensure that the netcdf library is installed on your computer.
+If the library is not at a default location, either provide some hints
+for the autodetection, or set the relevant variables by hand in ccmake.
+
+")
+
+ENDMACRO()
+
+
+CONFIGURE_FEATURE(NETCDF)
--- /dev/null
+#
+# Configuration for the tbb library:
+#
+
+INCLUDE(CheckCXXSourceCompiles)
+
+#
+# Set up genereal threading. The macro will be included in
+# CONFIGURE_FEATURE_TBB_EXTERNAL/CONTRIB:
+#
+MACRO(SETUP_THREADING var)
+ FIND_PACKAGE(Threads)
+
+ IF(Threads_FOUND)
+ SET(${var} TRUE)
+
+ #
+ # We support threading. Go on and configure the rest:
+ #
+
+ SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_THREAD_LIBS_INIT}")
+
+ SET(DEAL_II_USE_MT TRUE)
+
+ #
+ # Set up some posix threads specific configuration toggles:
+ #
+ IF(CMAKE_USE_PTHREADS_INIT)
+ SET(DEAL_II_USE_MT_POSIX TRUE)
+
+ # Check whether posix thread barriers are available:
+
+ LIST(APPEND CMAKE_REQUIRED_FLAGS "${CMAKE_THREAD_LIBS_INIT}")
+
+ CHECK_CXX_SOURCE_COMPILES(
+ "
+ #include <pthread.h>
+ int main()
+ {
+ pthread_barrier_t pb;
+ pthread_barrier_init (&pb, 0, 1);
+ pthread_barrier_wait (&pb);
+ pthread_barrier_destroy (&pb);
+ return 0;
+ }
+ "
+ DEAL_II_HAVE_MT_POSIX_BARRIERS)
+
+ LIST(REMOVE_ITEM CMAKE_REQUIRED_FLAGS "${CMAKE_THREAD_LIBS_INIT}")
+
+ IF(NOT DEAL_II_HAVE_MT_POSIX_BARRIERS)
+ SET(DEAL_II_USE_MT_POSIX_NO_BARRIERS TRUE)
+ ENDIF()
+ ENDIF()
+
+ #
+ # In some cases, -threads (or whatever else command line option)
+ # switches on some preprocessor flags. If this is not the case,
+ # then define them explicitely.
+ #
+
+ LIST(APPEND CMAKE_REQUIRED_FLAGS "${CMAKE_THREAD_LIBS_INIT}")
+ CHECK_CXX_SOURCE_COMPILES(
+ "
+ #if !defined (_REENTRANT) && !defined (_THREAD_SAFE)
+ # error Neither _REENTRANT nor _THREAD_SAFE were defined.
+ nonsense
+ #endif
+ int main(){ return 0; }
+ "
+ DEAL_II_HAVE_SANE_MT_DEFINITIONS)
+ LIST(REMOVE_ITEM CMAKE_REQUIRED_FLAGS "${CMAKE_THREAD_LIBS_INIT}")
+
+ IF(NOT DEAL_II_HAVE_SANE_MT_DEFINITIONS)
+ ADD_DEFINITIONS("-D_REENTRANT" "-D_THREAD_SAFE")
+ ENDIF()
+
+ ENDIF(Threads_FOUND)
+ENDMACRO()
+
+
+
+#
+# Set up the tbb library:
+#
+
+MACRO(FIND_FEATURE_TBB_EXTERNAL var)
+
+ FIND_PACKAGE(TBB)
+
+ # In case we don't have a debug library:
+ IF(NOT TBB_DEBUG_FOUND)
+ SET(TBB_DEBUG_LIBRARY ${TBB_LIBRARY})
+ ENDIF()
+
+ IF(TBB_FOUND)
+ SET(${var} TRUE)
+ ENDIF()
+
+ENDMACRO()
+
+
+MACRO(CONFIGURE_FEATURE_TBB_EXTERNAL var)
+
+ INCLUDE_DIRECTORIES(${TBB_INCLUDE_DIR})
+
+ IF (CMAKE_BUILD_TYPE MATCHES "Debug")
+ LIST(APPEND deal_ii_external_libraries ${TBB_DEBUG_LIBRARY})
+ ELSE()
+ LIST(APPEND deal_ii_external_libraries ${TBB_LIBRARY})
+ ENDIF()
+
+ # Setup threading and if successfull return TRUE:
+ SETUP_THREADING(${var})
+ENDMACRO()
+
+
+SET(HAVE_CONTRIB_FEATURE_TBB TRUE)
+
+
+MACRO(CONFIGURE_FEATURE_BOOST_CONTRIB var)
+ #
+ # Add tbb directly to the object files of deal.II
+ #
+
+ INCLUDE_DIRECTORIES(
+ ${CMAKE_SOURCE_DIR}/contrib/tbb/tbb30_104oss/include
+ )
+
+ ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/contrib/tbb/tbb30_104oss/src)
+
+ LIST(APPEND deal_ii_additional_object_files
+ $<TARGET_OBJECTS:obj_tbb>
+ )
+
+ # Setup threading and if successfull return TRUE:
+ SETUP_THREADING(${var})
+ENDMACRO()
+
+
+CONFIGURE_FEATURE(TBB)
+++ /dev/null
-INCLUDE(CheckCXXSourceCompiles)
-
-
-#
-# Set up genereal threading:
-#
-
-FIND_PACKAGE(Threads REQUIRED)
-
-SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_THREAD_LIBS_INIT}")
-
-SET(DEAL_II_USE_MT TRUE)
-
-
-#
-# Set up some posix threads specific configuration toggles:
-#
-IF(CMAKE_USE_PTHREADS_INIT)
- SET(DEAL_II_USE_MT_POSIX TRUE)
-
- # Check whether posix thread barriers are available:
-
- LIST(APPEND CMAKE_REQUIRED_FLAGS "${CMAKE_THREAD_LIBS_INIT}")
-
- CHECK_CXX_SOURCE_COMPILES(
- "
- #include <pthread.h>
- int main()
- {
- pthread_barrier_t pb;
- pthread_barrier_init (&pb, 0, 1);
- pthread_barrier_wait (&pb);
- pthread_barrier_destroy (&pb);
- return 0;
- }
- "
- DEAL_II_HAVE_MT_POSIX_BARRIERS)
-
- LIST(REMOVE_ITEM CMAKE_REQUIRED_FLAGS "${CMAKE_THREAD_LIBS_INIT}")
-
- IF(NOT DEAL_II_HAVE_MT_POSIX_BARRIERS)
- SET(DEAL_II_USE_MT_POSIX_NO_BARRIERS TRUE)
- ENDIF()
-ENDIF()
-
-
-#
-# In some cases, -threads (or whatever else command line option)
-# switches on some preprocessor flags. If this is not the case,
-# then define them explicitely.
-#
-
-LIST(APPEND CMAKE_REQUIRED_FLAGS "${CMAKE_THREAD_LIBS_INIT}")
-CHECK_CXX_SOURCE_COMPILES(
- "
- #if !defined (_REENTRANT) && !defined (_THREAD_SAFE)
- # error Neither _REENTRANT nor _THREAD_SAFE were defined.
- nonsense
- #endif
- int main(){ return 0; }
- "
- DEAL_II_HAVE_SANE_MT_DEFINITIONS)
-LIST(REMOVE_ITEM CMAKE_REQUIRED_FLAGS "${CMAKE_THREAD_LIBS_INIT}")
-
-IF(NOT DEAL_II_HAVE_SANE_MT_DEFINITIONS)
- ADD_DEFINITIONS("-D_REENTRANT" "-D_THREAD_SAFE")
-ENDIF()
-
-
-#
-# Set up the tbb library:
-#
-
-
-IF(NOT DEAL_II_FORCE_CONTRIB_TBB)
-
- FIND_PACKAGE(TBB)
-
- IF(NOT DEAL_II_ALLOW_CONTRIB AND NOT TBB_FOUND)
- macro_message_not_found("tbb" "TBB")
- ENDIF()
-
- # In case we don't have a debug library:
- IF(NOT TBB_DEBUG_FOUND)
- SET(TBB_DEBUG_LIBRARY ${TBB_LIBRARY})
- ENDIF()
-ENDIF()
-
-IF(DEAL_II_FORCE_CONTRIB_TBB OR NOT TBB_FOUND)
-
- #
- # Add tbb directly to the object files of deal.II
- #
-
- INCLUDE_DIRECTORIES(
- ${CMAKE_SOURCE_DIR}/contrib/tbb/tbb30_104oss/include
- )
-
- ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/contrib/tbb/tbb30_104oss/src)
-
- LIST(APPEND deal_ii_additional_object_files
- $<TARGET_OBJECTS:obj_tbb>
- )
-
-ENDIF()
-
-INCLUDE_DIRECTORIES(${TBB_INCLUDE_DIR})
-
-IF (CMAKE_BUILD_TYPE MATCHES "Debug")
- LIST(APPEND deal_ii_external_libraries ${TBB_DEBUG_LIBRARY})
-ELSE()
- LIST(APPEND deal_ii_external_libraries ${TBB_LIBRARY})
-ENDIF()
-FIND_PACKAGE(LAPACK REQUIRED)
-FIND_PACKAGE(BLAS REQUIRED)
+#
+# Configuration for the umfpack and amd libraries:
+#
-SET(CMAKE_SHARED_LINKER_FLAGS
- "${CMAKE_SHARED_LINKER_FLAGS} ${LAPACK_LINKER_FLAGS} ${BLAS_LINKER_FLAGS}"
- )
+# TODO: Implement the dependency on BLAS and LAPACK
-LIST(APPEND deal_ii_external_libraries
- ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES}
- )
-
-# TODO: A deal.II specific error message if blas or lapack is not found
-
-
-IF(NOT DEAL_II_FORCE_CONTRIB_UMFPACK)
+MACRO(FIND_FEATURE_UMFPACK_EXTERNAL var)
FIND_PACKAGE(UMFPACK)
FIND_PACKAGE(AMD)
- IF(NOT DEAL_II_ALLOW_CONTRIB)
- IF(NOT UMFPACK_FOUND)
- macro_message_not_found("umfpack" "UMFPACK")
- ENDIF()
- IF(NOT AMD_FOUND)
- macro_message_not_found("amd" "AMD")
- ENDIF()
+ IF(UMFPACK_FOUND AND AMD_FOUND)
+ SET(${var} TRUE)
ENDIF()
-ENDIF()
+ENDMACRO()
+
+
+MACRO(CONFIGURE_FEATURE_UMFPACK_EXTERNAL var)
+
+ INCLUDE_DIRECTORIES(${UMFPACK_INCLUDE_DIR} ${AMD_INCLUDE_DIR})
+
+ LIST(APPEND deal_ii_external_libraries
+ ${UMFPACK_LIBRARY} ${AMD_LIBRARY}
+ )
+
+ SET(HAVE_LIBUMFPACK TRUE)
+
+ SET(${var} TRUE)
-IF(UMFPACK_FOUND AND AMD_FOUND) # TODO
- SET(UMFPACKAMD_FOUND TRUE)
-ELSE()
- SET(UMFPACKAMD_FOUND FALSE)
-ENDIF()
-IF(DEAL_II_FORCE_CONTRIB_UMFPACK OR NOT UMFPACKAMD_FOUND)
+ENDMACRO()
+
+
+SET(HAVE_CONTRIB_FEATURE_UMFPACK TRUE)
+
+
+MACRO(CONFIGURE_FEATURE_UMFPACK_CONTRIB var)
INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/contrib/umfpack/UMFPACK/Include
$<TARGET_OBJECTS:obj_amd_global>
)
-ELSE()
+ SET(HAVE_LIBUMFPACK TRUE)
- INCLUDE_DIRECTORIES(${UMFPACK_INCLUDE_DIR} ${AMD_INCLUDE_DIR})
+ SET(${var} TRUE)
- LIST(APPEND deal_ii_external_libraries
- ${UMFPACK_LIBRARY} ${AMD_LIBRARY}
- )
+ENDMACRO()
+
+
+MACRO(CONFIGURE_FEATURE_BOOST_ERROR_MESSAGE)
+ MESSAGE(SEND_ERROR "
+Could not find the umfpack and amd libraries!
+
+Please ensure that the libraries are installed on your computer.
+If the libraries are not at a default location, either provide some hints
+via environment variables:
+UMFPACK_LIBRARY_DIR UMFPACK_INCLUDE_DIR
+AMD_LIBRARY_DIR AMD_INCLUDE_DIR
+Or set the relevant variables by hand in ccmake.
+
+Alternatively you may choose to compile the bundled contrib libraries
+by setting DEAL_II_ALLOW_CONTRIB=on or DEAL_II_FORCE_CONTRIB_UMFPACK=on.
-ENDIF()
+")
+ENDMACRO()
-SET(HAVE_LIBBLAS TRUE)
-SET(HAVE_LIBLAPACK TRUE)
-SET(HAVE_LIBUMFPACK TRUE)
+CONFIGURE_FEATURE(UMFPACK)
-FIND_PACKAGE(Netcdf REQUIRED)
+#
+# Configuration for the zlib library:
+#
-FIND_PACKAGE(ZLIB REQUIRED)
+MACRO(FIND_FEATURE_ZLIB_EXTERNAL var)
-INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIRS})
+ FIND_PACKAGE(ZLIB)
-LIST(APPEND deal_ii_external_libraries ${ZLIB_LIBRARIES})
+ IF(ZLIB_FOUND)
+ SET(${var} TRUE)
+ ENDIF()
-SET(HAVE_LIBZ TRUE)
+ENDMACRO()
+
+
+MACRO(CONFIGURE_FEATURE_ZLIB_EXTERNAL var)
+
+ INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIRS})
+ LIST(APPEND deal_ii_external_libraries ${ZLIB_LIBRARIES})
+ SET(HAVE_LIBZ TRUE)
+
+ SET(${var} TRUE)
+
+ENDMACRO()
+
+
+MACRO(CONFIGURE_FEATURE_ZLIB_ERROR_MESSAGE)
+ MESSAGE(SEND_ERROR "
+Could not find the zlib library!
+
+Please ensure that the zlib library is installed on your computer.
+If the library is not at a default location, either provide some hints
+for the autodetection, or set the relevant variables by hand in ccmake.
+
+")
+ENDMACRO()
+
+
+CONFIGURE_FEATURE(ZLIB)
--- /dev/null
+#
+# This macro is used in the feature configuration mechanism of deal.II
+#
+# Usage:
+#
+# CONFIGURE_FEATURE(feature_name)
+#
+# This macro assumes the following macros and variables to be defined:
+#
+#
+# HAVE_CONTRIB_FEATURE_${feature_name}
+#
+# - which is either set to TRUE if all necessary libraries of the
+# features comes bundled with deal.II and hence can be supported
+# without external dependencies
+#
+# CONFIGURE_FEATURE_${feature_name}_CONTRIB(var)
+#
+# - which shall setup all necessary configuration for the feature with
+# contrib source dependencies. var set to TRUE shall indicate success.
+#
+#
+# FIND_FEATURE_${feature_name}_EXTERNAL(var)
+#
+# - which shall set var to TRUE if all dependencies for the feature are
+# fullfilled. In this case all necessary variables for
+# CONFIGURE_FEATURE_${feature_name}_EXTERNAL shall be set. Otherwise
+# var should remain unset.
+#
+# CONFIGURE_FEATURE_${feature_name}_EXTERNAL(var)
+#
+# - which shall setup all necessary configuration for the feature with
+# external dependencies. var set to TRUE shall indicate success.
+#
+# CONFIGURE_FEATURE_${feature_name}_ERROR_MESSAGE()
+#
+# - which shall print a meaningfull error message if case no external
+# library is found (and contrib is not allowed to be used.)
+#
+#
+
+#
+# FAT NOTE:
+# This script is arcane black magic. But at least for the better good: We
+# don't have to copy the configuration logic to every single
+# configure_<feature>.cmake script.
+#
+
+
+# Some black magic to have substitution in command names:
+MACRO(RUN_COMMAND the_command)
+ FILE(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/macro_configure_feature.tmp"
+ "${the_command}")
+ INCLUDE("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/macro_configure_feature.tmp")
+ENDMACRO()
+
+
+MACRO(CONFIGURE_FEATURE feature)
+
+ #
+ # First case: DEAL_II_FORCE_CONTRIB_${feature} is defined:
+ #
+ IF(DEAL_II_FORCE_CONTRIB_${feature})
+
+ IF(HAVE_CONTRIB_FEATURE_${feature})
+ RUN_COMMAND(
+ "
+ CONFIGURE_FEATURE_${feature}_CONTRIB(
+ FEATURE_${feature}_CONTRIB_CONFIGURED
+ )
+ "
+ )
+ IF(FEATURE_${feature}_CONTRIB_CONFIGURED)
+ MESSAGE(STATUS
+ "DEAL_II_WITH_${feature} successfully set up with contrib packages."
+ )
+ ELSE()
+ MESSAGE(SEND_ERROR
+ "Failed to set up DEAL_II_WITH_${feature} with contrib packages."
+ )
+ ENDIF()
+ ELSE()
+ MESSAGE(FATAL_ERROR
+ "Internal build system error: DEAL_II_FORCE_CONTRIB_${feature} defined, but HAVE_CONTRIB_FEATURE_${feature} not present."
+ )
+ ENDIF()
+
+ ELSE()
+
+ #
+ # Second case: We may search for an external library:
+ #
+ RUN_COMMAND(
+ "FIND_FEATURE_${feature}_EXTERNAL(FEATURE_${feature}_EXTERNAL_FOUND)"
+ )
+
+ IF(FEATURE_${feature}_EXTERNAL_FOUND)
+
+ MESSAGE(STATUS
+ "All external dependencies for DEAL_II_WITH_${feature} are fullfilled."
+ )
+
+ RUN_COMMAND(
+ "
+ CONFIGURE_FEATURE_${feature}_EXTERNAL(
+ FEATURE_${feature}_EXTERNAL_CONFIGURED
+ )
+ "
+ )
+
+ IF(FEATURE_${feature}_EXTERNAL_CONFIGURED)
+ MESSAGE(STATUS
+ "DEAL_II_WITH_${feature} successfully set up with external dependencies."
+ )
+ ELSE()
+ MESSAGE(SEND_ERROR
+ "Failed to set up DEAL_II_WITH_${feature} with external dependencies."
+ )
+ ENDIF()
+
+ ELSE()
+
+ MESSAGE(STATUS
+ "DEAL_II_WITH_${feature} has unmet external dependencies."
+ )
+
+ IF(HAVE_CONTRIB_FEATURE_${feature} AND DEAL_II_ALLOW_CONTRIB)
+ RUN_COMMAND(
+ "
+ CONFIGURE_FEATURE_${feature}_CONTRIB(
+ FEATURE_${feature}_CONTRIB_CONFIGURED
+ )
+ "
+ )
+ IF(FEATURE_${feature}_CONTRIB_CONFIGURED)
+ MESSAGE(STATUS
+ "DEAL_II_WITH_${feature} successfully set up with contrib packages."
+ )
+ ELSE()
+ # TODO: Opt out!
+ MESSAGE(SEND_ERROR
+ "Failed to set up DEAL_II_WITH_${feature} with contrib packages."
+ )
+ RUN_COMMAND(
+ "CONFIGURE_FEATURE_${feature}_ERROR_MESSAGE()"
+ )
+ ENDIF()
+ ELSE()
+ # TODO: Opt out!
+ RUN_COMMAND(
+ "CONFIGURE_FEATURE_${feature}_ERROR_MESSAGE()"
+ )
+ ENDIF()
+
+ ENDIF()
+
+ ENDIF()
+ENDMACRO()
--- /dev/null
+# grml...
+MACRO(LIST_CONTAINS var value)
+ SET(${var})
+ FOREACH (value2 ${ARGN})
+ IF (${value} STREQUAL ${value2})
+ SET(${var} TRUE)
+ ENDIF (${value} STREQUAL ${value2})
+ ENDFOREACH (value2)
+ENDMACRO(LIST_CONTAINS)
-MACRO(macro_message_not_found library)
- # TODO: Check for each Find<...> module how to hint for a library
- # location...
+FUNCTION(macro_message_not_found library library_uppercase)
- STRING(TOUPPER "${library}" library_uppercase)
+ # We have contrib source and our own Find<...> module:
+ SET(contrib_and_find amd tbb umfpack)
- MESSAGE(SEND_ERROR "
+ # We have contrib source and use an external Find<...> module:
+ SET(contrib boost)
+
+ # We use our own Find<...> module:
+ SET(find_module netcdf)
+
+
+ IF(library_uppercase MATCHES AMD)
+ SET(library_contrib UMFPACK)
+ ELSE()
+ SET(library_contrib ${library_uppercase})
+ ENDIF()
+
+
+ LIST_CONTAINS(result library ${contrib_and_find})
+ IF(result)
+ MESSAGE(SEND_ERROR "
+Could not find the ${library} library!
+
+Please ensure that the ${library} library is installed on your computer.
+If the library is not at a default location, either provide some hints
+via environment variables:
+${library_uppercase}_LIBRARY_DIR ${library_uppercase}_INCLUDE_DIR
+Or set the relevant variables by hand in ccmake.
+
+Alternatively you may choose to compile the bundled contrib library of
+${library} by setting DEAL_II_ALLOW_CONTRIB=on or
+DEAL_II_FORCE_CONTRIB_${library_contrib}=on.
+
+")
+ RETURN()
+ ENDIF()
+
+
+ LIST_CONTAINS(result library ${contrib})
+ IF(result)
+ MESSAGE(SEND_ERROR "
+Could not find the ${library} library!
+
+Please ensure that the ${library} library is installed on your computer.
+If the library is not at a default location, either provide some hints
+for the autodetection, or set the relevant variables by hand in ccmake.
+
+Alternatively you may choose to compile the bundled contrib library of
+${library} by setting DEAL_II_ALLOW_CONTRIB=on or
+DEAL_II_FORCE_CONTRIB_${library_contrib}=on.
+
+")
+ RETURN()
+ ENDIF()
+
+
+ LIST_CONTAINS(result library ${find_module})
+ IF(result)
+ MESSAGE(SEND_ERROR "
Could not find the ${library} library!
Please ensure that the ${library} library is installed on your computer.
${library_uppercase}_LIBRARY_DIR ${library_uppercase}_INCLUDE_DIR
Or set the relevant variables by hand in ccmake.
+")
+ RETURN()
+ ENDIF()
+
+
+ MESSAGE(SEND_ERROR "
+Could not find the ${library} library!
+
+Please ensure that the ${library} library is installed on your computer.
+If the library is not at a default location, either provide some hints
+for the autodetection, or set the relevant variables by hand in ccmake.
+
")
-ENDMACRO()
+ENDFUNCTION()