# Configuration for mpi support:
#
-
MACRO(FEATURE_MPI_FIND_EXTERNAL var)
FIND_PACKAGE(MPI QUIET)
MPI_EXTRA_LIBRARY
MPI_LIBRARY
)
-
SET(${var} TRUE)
ENDIF()
ENDMACRO()
-MACRO(FEATURE_MPI_CONFIGURE_EXTERNAL var)
-
+MACRO(FEATURE_MPI_CONFIGURE_EXTERNAL)
ADD_FLAGS(CMAKE_CXX_FLAGS "${MPI_CXX_COMPILE_FLAGS}")
ADD_FLAGS(CMAKE_SHARED_LINKER_FLAGS "${MPI_CXX_LINK_FLAGS}")
# The user has to know the location of the mpi headers as well:
LIST(APPEND DEAL_II_USER_INCLUDE_DIRS ${MPI_CXX_INCLUDE_PATH})
-
+ # TODO:
SET(DEAL_II_USE_MPICXX ON CACHE BOOL
"Set the compiler to the detected mpi wrapper ${MPI_CXX_COMPILER}"
)
IF(DEAL_II_MPICXX)
SET(CMAKE_CXX_COMPILER ${MPI_CXX_COMPILER})
ENDIF()
-
- SET(${var} TRUE)
ENDMACRO()
# Set up genereal threading:
# The macro will be included in CONFIGURE_FEATURE_THREADS_EXTERNAL/BUNDLED.
#
-MACRO(SETUP_THREADING var)
+MACRO(SETUP_THREADING)
FIND_PACKAGE(Threads)
- IF(Threads_FOUND)
- MARK_AS_ADVANCED(
- pthread_LIBRARY
+ IF(NOT Threads_FOUND)
+ # TODO:
+ MESSAGE(FATAL_ERROR
+ "\nInternal configuration error: No Threading support found\n\n"
)
- SET(${var} TRUE)
+ ENDIF()
- #
- # Change -lphtread to -pthread for better compatibility on non linux
- # platforms:
- #
- IF("${CMAKE_THREAD_LIBS_INIT}" MATCHES "-lpthread")
- CHECK_CXX_COMPILER_FLAG("-pthread"
- DEAL_II_HAVE_FLAG_pthread
+ MARK_AS_ADVANCED(pthread_LIBRARY)
+
+ #
+ # Change -lphtread to -pthread for better compatibility on non linux
+ # platforms:
+ #
+ IF("${CMAKE_THREAD_LIBS_INIT}" MATCHES "-lpthread")
+ CHECK_CXX_COMPILER_FLAG("-pthread"
+ DEAL_II_HAVE_FLAG_pthread
+ )
+ IF(DEAL_II_HAVE_FLAG_pthread)
+ STRING(REPLACE "-lpthread" "-pthread" CMAKE_THREAD_LIBS_INIT
+ "${CMAKE_THREAD_LIBS_INIT}"
)
- IF(DEAL_II_HAVE_FLAG_pthread)
- STRING(REPLACE "-lpthread" "-pthread" CMAKE_THREAD_LIBS_INIT
- "${CMAKE_THREAD_LIBS_INIT}"
- )
- ENDIF()
ENDIF()
+ ENDIF()
- ADD_FLAGS(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_THREAD_LIBS_INIT}")
+ ADD_FLAGS(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_THREAD_LIBS_INIT}")
+ #
+ # Set up some posix thread specific configuration toggles:
+ #
+ IF(CMAKE_USE_PTHREADS_INIT)
+ SET(DEAL_II_USE_MT_POSIX TRUE)
#
- # Set up some posix thread specific configuration toggles:
+ # Check whether posix thread barriers are available:
#
- IF(CMAKE_USE_PTHREADS_INIT)
- SET(DEAL_II_USE_MT_POSIX TRUE)
-
- #
- # Check whether posix thread barriers are available:
- #
- ADD_FLAGS(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)
- STRIP_FLAG(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()
-
+ ADD_FLAGS(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)
+ STRIP_FLAG(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(Threads_FOUND)
+ ENDIF()
+
ENDMACRO()
ENDMACRO()
-MACRO(FEATURE_THREADS_CONFIGURE_EXTERNAL var)
+MACRO(FEATURE_THREADS_CONFIGURE_EXTERNAL)
INCLUDE_DIRECTORIES(${TBB_INCLUDE_DIR})
IF (CMAKE_BUILD_TYPE MATCHES "Debug")
ENDIF()
# Setup threading and if successfull return TRUE:
- SETUP_THREADING(${var})
+ SETUP_THREADING()
ENDMACRO()
-MACRO(FEATURE_THREADS_CONFIGURE_BUNDLED var)
+MACRO(FEATURE_THREADS_CONFIGURE_BUNDLED)
#
# Setup threading (before configuring our build...)
- # and if successfull return TRUE:
#
- SETUP_THREADING(${var})
+ SETUP_THREADING()
#
# We have to disable a bunch of warnings:
ENDIF()
INCLUDE_DIRECTORIES(${TBB_FOLDER}/include)
-
ENDMACRO()
# Configuration for the ARPACK library:
#
-
-MACRO(FEATURE_ARPACK_CONFIGURE_EXTERNAL var)
- LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES ${ARPACK_LIBRARIES})
- ADD_FLAGS(CMAKE_SHARED_LINKER_FLAGS "${ARPACK_LINKER_FLAGS}")
-
- SET(${var} TRUE)
-ENDMACRO()
-
-
CONFIGURE_FEATURE(ARPACK)
ENDIF()
-SET(DEAL_II_WITH_BOOST
- # Always true. We need it :-]
- ON
+SET(DEAL_II_WITH_BOOST ON # Always true. We need it :-]
CACHE BOOL "Build deal.II with support for boost." FORCE
)
ENDMACRO()
-MACRO(FEATURE_BOOST_CONFIGURE_EXTERNAL var)
+MACRO(FEATURE_BOOST_CONFIGURE_EXTERNAL)
INCLUDE_DIRECTORIES (${Boost_INCLUDE_DIR})
IF (CMAKE_BUILD_TYPE MATCHES "Debug")
${Boost_THREAD_LIBRARY_RELEASE} ${Boost_SERIALIZATION_LIBRARY_RELEASE}
)
ENDIF()
-
- SET(${var} TRUE)
ENDMACRO()
-MACRO(FEATURE_BOOST_CONFIGURE_BUNDLED var)
+MACRO(FEATURE_BOOST_CONFIGURE_BUNDLED)
#
# We need to set some definitions to use the headers of the bundled boost
# library:
)
INCLUDE_DIRECTORIES(${BOOST_FOLDER}/include)
-
- SET(${var} TRUE)
ENDMACRO()
ENDMACRO()
-MACRO(FEATURE_FUNCTIONPARSER_CONFIGURE_EXTERNAL var)
-ENDMACRO()
-
-
-MACRO(FEATURE_FUNCTIONPARSER_CONFIGURE_BUNDLED var)
+MACRO(FEATURE_FUNCTIONPARSER_CONFIGURE_BUNDLED)
INCLUDE_DIRECTORIES(${FUNCTIONPARSER_FOLDER})
- SET(${var} TRUE)
ENDMACRO()
# Configuration for the netcdf library:
#
-
-MACRO(FEATURE_HDF5_CONFIGURE_EXTERNAL var)
- INCLUDE_DIRECTORIES(${HDF5_INCLUDE_DIRS})
- LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES ${HDF5_LIBRARIES})
-
- SET(${var} TRUE)
-ENDMACRO()
-
-
MACRO(FEATURE_HDF5_ERROR_MESSAGE)
MESSAGE(FATAL_ERROR "\n"
"Could not find the hdf5 library!\n"
)
ENDMACRO()
-
CONFIGURE_FEATURE(HDF5)
# Configuration for the lapack library:
#
-
MACRO(FEATURE_LAPACK_FIND_EXTERNAL var)
FIND_PACKAGE(LAPACK)
ENDMACRO()
-MACRO(FEATURE_LAPACK_CONFIGURE_EXTERNAL var)
+MACRO(FEATURE_LAPACK_CONFIGURE_EXTERNAL)
ADD_FLAGS(CMAKE_SHARED_LINKER_FLAGS "${LAPACK_LINKER_FLAGS}")
- LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES
- ${LAPACK_LIBRARIES}
- )
+ LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES ${LAPACK_LIBRARIES})
CHECK_FOR_LAPACK_FUNCTIONS()
-
- SET(${var} TRUE)
ENDMACRO()
ENDMACRO()
-MACRO(FEATURE_METIS_CONFIGURE_EXTERNAL var)
- INCLUDE_DIRECTORIES(${METIS_INCLUDE_DIRS})
- LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES ${METIS_LIBRARIES})
-
- SET(${var} TRUE)
-ENDMACRO()
-
-
MACRO(FEATURE_METIS_ERROR_MESSAGE)
MESSAGE(FATAL_ERROR "\n"
"Could not find the metis library!\n"
# Configuration for the MUMPS library:
#
-
SET(FEATURE_MUMPS_DEPENDS DEAL_II_WITH_MPI)
-MACRO(FEATURE_MUMPS_CONFIGURE_EXTERNAL var)
- INCLUDE_DIRECTORIES(${MUMPS_INCLUDE_DIRS})
- LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES
- ${MUMPS_LIBRARIES}
- ${MPI_CXX_LIBRARIES} # for good measure
- )
- ADD_FLAGS(CMAKE_SHARED_LINKER_FLAGS "${MUMPS_LINKER_FLAGS}")
-
- SET(${var} TRUE)
-ENDMACRO()
-
-
MACRO(FEATURE_MUMPS_ERROR_MESSAGE)
MESSAGE(FATAL_ERROR "\n"
"Could not find the mumps library!\n"
# Configuration for the netcdf library:
#
-
-MACRO(FEATURE_NETCDF_CONFIGURE_EXTERNAL var)
- INCLUDE_DIRECTORIES(${NETCDF_INCLUDE_DIRS})
- LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES ${NETCDF_LIBRARIES})
- SET(${var} TRUE)
-ENDMACRO()
-
-
CONFIGURE_FEATURE(NETCDF)
SET(${var} TRUE)
ENDIF()
ENDIF()
-
-ENDMACRO()
-
-
-MACRO(FEATURE_P4EST_CONFIGURE_EXTERNAL var)
- INCLUDE_DIRECTORIES(${P4EST_INCLUDE_DIRS})
-
- # The user has to know the location of the p4est headers as well:
- LIST(APPEND DEAL_II_USER_INCLUDE_DIRS ${P4EST_INCLUDE_DIRS})
-
- LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES ${P4EST_LIBRARIES})
-
- SET(${var} TRUE)
ENDMACRO()
ENDMACRO()
-MACRO(FEATURE_PETSC_CONFIGURE_EXTERNAL var)
+MACRO(FEATURE_PETSC_CONFIGURE_EXTERNAL)
INCLUDE_DIRECTORIES(${PETSC_INCLUDE_DIRS})
# The user has to know the location of the petsc headers as well:
LIST(APPEND DEAL_II_USER_INCLUDE_DIRS ${PETSC_INCLUDE_DIRS})
- LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES
- ${PETSC_LIBRARIES}
- )
+ LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES ${PETSC_LIBRARIES})
#
# Disable a bunch of warnings when compiling with petsc:
SET(DEAL_II_EXPAND_PETSC_MPI_VECTOR "PETScWrappers::MPI::Vector")
SET(DEAL_II_EXPAND_PETSC_MPI_BLOCKVECTOR "PETScWrappers::MPI::BlockVector")
ENDIF()
-
- SET(${var} TRUE)
ENDMACRO()
ENDMACRO()
-MACRO(FEATURE_SLEPC_CONFIGURE_EXTERNAL var)
+MACRO(FEATURE_SLEPC_CONFIGURE_EXTERNAL)
INCLUDE_DIRECTORIES(${SLEPC_INCLUDE_DIRS})
# The user has to know the location of the SLEPC headers as well:
LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES
${SLEPC_LIBRARIES}
)
-
- SET(${var} TRUE)
ENDMACRO()
ENDMACRO()
-MACRO(FEATURE_TRILINOS_CONFIGURE_EXTERNAL var)
+MACRO(FEATURE_TRILINOS_CONFIGURE_EXTERNAL)
INCLUDE_DIRECTORIES(${TRILINOS_INCLUDE_DIRS})
# The user has to know the location of the trilinos headers as well:
SET(DEAL_II_EXPAND_TRILINOS_MPI_VECTOR "TrilinosWrappers::MPI::Vector")
ENDIF()
-
#
# used with -W -Wall (which includes -Wunused). Regrettable
# though it may be, these warnings pretty much drown everything
ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-Wno-unused")
ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-Wno-extra")
ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-Wno-overloaded-virtual")
-
- SET(${var} TRUE)
ENDMACRO()
SET(FEATURE_UMFPACK_DEPENDS DEAL_II_WITH_LAPACK)
-MACRO(FEATURE_UMFPACK_CONFIGURE_EXTERNAL var)
-
- INCLUDE_DIRECTORIES(${UMFPACK_INCLUDE_DIRS})
- LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES ${UMFPACK_LIBRARIES})
- ADD_FLAGS(CMAKE_SHARED_LINKER_FLAGS "${UMFPACK_LINKER_FLAGS}")
-
- SET(${var} TRUE)
-ENDMACRO()
-
-
-MACRO(FEATURE_UMFPACK_CONFIGURE_BUNDLED var)
-
+MACRO(FEATURE_UMFPACK_CONFIGURE_BUNDLED)
INCLUDE_DIRECTORIES(
${UMFPACK_FOLDER}/UMFPACK/Include
${UMFPACK_FOLDER}/AMD/Include
)
-
- SET(${var} TRUE)
ENDMACRO()
# Configuration for the zlib library:
#
-
-MACRO(FEATURE_ZLIB_CONFIGURE_EXTERNAL var)
- INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIRS})
- LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES ${ZLIB_LIBRARIES})
- SET(${var} TRUE)
-ENDMACRO()
-
-
CONFIGURE_FEATURE(ZLIB)
# CONFIGURE_FEATURE(feature)
#
#
-# This macro uses the following variables and macros:
+# This macro uses the following optional variables and macros:
#
-# FEATURE_${feature}_DEPENDS (variable, optional)
+# FEATURE_${feature}_DEPENDS (variable)
# a variable which contains an optional list of other features
# this feature depends on (and which have to be enbled for this feature
# to work.) The features must be given with the full option toggle:
# DEAL_II_WITH_[...]
#
-# FEATURE_${feature}_HAVE_BUNDLED (variable, optional)
+# FEATURE_${feature}_HAVE_BUNDLED (variable)
# which should either be set to TRUE if all necessary libraries of the
# features comes bundled with deal.II and hence can be supported
# without external dependencies, or unset.
#
-# FEATURE_${feature}_CONFIGURE_BUNDLED(var) (macro, optional)
+# FEATURE_${feature}_CONFIGURE_BUNDLED(var) (macro)
# which should setup all necessary configuration for the feature with
# bundled source dependencies. var set to TRUE indicates success,
# otherwise this script should issue a FATAL_ERROR.
#
-# FEATURE_${feature}_FIND_EXTERNAL(var) (macro, optional)
+# FEATURE_${feature}_FIND_EXTERNAL(var) (macro)
# which should set var to TRUE if all dependencies for the feature are
# fullfilled. In this case all necessary variables for
# FEATURE_${feature}_CONFIGURE_EXTERNAL must be set. Otherwise
# var should remain unset.
# If not defined, FIND_PACKAGE(${feature}) is called.
#
-# FEATURE_${feature}_CONFIGURE_EXTERNAL(var) (macro, mandatory)
+# FEATURE_${feature}_CONFIGURE_EXTERNAL(var) (macro)
# which should setup all necessary configuration for the feature with
-# external dependencies. var set to TRUE indicates success,
-# otherwise this script gives an error.
+# external dependencies.
#
-# FEATURE_${feature}_ERROR_MESSAGE() (macro, optional)
+# FEATURE_${feature}_ERROR_MESSAGE() (macro)
# which should print a meaningfull error message (with FATAL_ERROR) for
# the case that no external library was found (and bundled is not
# allowed to be used.) If not defined, a suitable default error message
ENDMACRO()
+#
+# Default macro for basic external setup:
+#
+MACRO(FEATURE_CONFIGURE_EXTERNAL _feature)
+ IF(DEFINED ${_feature}_INCLUDE_DIRS)
+ INCLUDE_DIRECTORIES(${${_feature}_INCLUDE_DIRS})
+ ENDIF()
+ IF(DEFINED ${_feature}_LIBRARIES)
+ LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES ${${_feature}_LIBRARIES})
+ ENDIF()
+ IF(DEFINED ${_feature}_LINKER_FLAGS)
+ ADD_FLAGS(CMAKE_SHARED_LINKER_FLAGS "${${_feature}_LINKER_FLAGS}")
+ ENDIF()
+ENDMACRO()
+
+
###########################################################################
# #
# CONFIGURE_FEATURE: #
# First case: DEAL_II_FORCE_BUNDLED_${_feature} is defined:
#
IF(FEATURE_${_feature}_HAVE_BUNDLED)
- RUN_COMMAND("FEATURE_${_feature}_CONFIGURE_BUNDLED(FEATURE_${_feature}_BUNDLED_CONFIGURED)")
- IF(FEATURE_${_feature}_BUNDLED_CONFIGURED)
- MESSAGE(STATUS "DEAL_II_WITH_${_feature} successfully set up with bundled packages.")
- SET_CACHED_OPTION(${_feature} ON)
- ELSE()
- # This should not happen. So give an error
- MESSAGE(FATAL_ERROR
- "\nInternal build system error: Failed to set up "
- "DEAL_II_WITH_${_feature} with bundled packages.\n\n"
- )
- ENDIF()
+ RUN_COMMAND("FEATURE_${_feature}_CONFIGURE_BUNDLED()")
+ MESSAGE(STATUS "DEAL_II_WITH_${_feature} successfully set up with bundled packages.")
+ SET_CACHED_OPTION(${_feature} ON)
ELSE()
MESSAGE(FATAL_ERROR "\n"
"Internal build system error: DEAL_II_FORCE_BUNDLED_${_feature} "
IF(FEATURE_${_feature}_EXTERNAL_FOUND)
MESSAGE(STATUS "All external dependencies for DEAL_II_WITH_${_feature} are fullfilled.")
- RUN_COMMAND("FEATURE_${_feature}_CONFIGURE_EXTERNAL(FEATURE_${_feature}_EXTERNAL_CONFIGURED)")
- IF(FEATURE_${_feature}_EXTERNAL_CONFIGURED)
- MESSAGE(STATUS "DEAL_II_WITH_${_feature} successfully set up with external dependencies.")
- SET_CACHED_OPTION(${_feature} ON)
+ IF(COMMAND FEATURE_${_feature}_CONFIGURE_EXTERNAL)
+ RUN_COMMAND("FEATURE_${_feature}_CONFIGURE_EXTERNAL()")
ELSE()
- # This should not happen. So give an error
- MESSAGE(FATAL_ERROR
- "\nInternal build system error: Failed to set up "
- "DEAL_II_WITH_${_feature} with external dependencies.\n\n"
- )
+ FEATURE_CONFIGURE_EXTERNAL(${_feature})
ENDIF()
+ MESSAGE(STATUS "DEAL_II_WITH_${_feature} successfully set up with external dependencies.")
+ SET_CACHED_OPTION(${_feature} ON)
+
ELSE(FEATURE_${_feature}_EXTERNAL_FOUND)
MESSAGE(STATUS "DEAL_II_WITH_${_feature} has unmet external dependencies.")
IF(FEATURE_${_feature}_HAVE_BUNDLED AND DEAL_II_ALLOW_BUNDLED)
- RUN_COMMAND("FEATURE_${_feature}_CONFIGURE_BUNDLED(FEATURE_${_feature}_BUNDLED_CONFIGURED)")
- IF(FEATURE_${_feature}_BUNDLED_CONFIGURED)
- MESSAGE(STATUS "DEAL_II_WITH_${_feature} successfully set up with bundled packages.")
- SET_CACHED_OPTION(${_feature} ON)
- ELSE()
- # This should not happen. So give an error
- MESSAGE(FATAL_ERROR
- "\nInternal build system error: Failed to set up "
- "DEAL_II_WITH_${_feature} with bundled packages.\n\n"
- )
- ENDIF()
+ RUN_COMMAND("FEATURE_${_feature}_CONFIGURE_BUNDLED()")
+ MESSAGE(STATUS "DEAL_II_WITH_${_feature} successfully set up with bundled packages.")
+ SET_CACHED_OPTION(${_feature} ON)
ELSE()
IF(DEAL_II_WITH_${_feature})
IF(COMMAND FEATURE_${_feature}_ERROR_MESSAGE)
ENDIF()
ENDIF(FEATURE_${_feature}_EXTERNAL_FOUND)
+
ENDIF()
ENDIF()
ELSE()
${DMUMPS_LIBRARY}
${MUMPS_COMMON_LIBRARY}
${SCALAPACK_LIBRARIES}
+ ${MPI_CXX_LIBRARIES} # For good measure
)
SET(MUMPS_LINKER_FLAGS
${SCALAPACK_LINKER_FLAGS}