From a82d80dd571d66ac4003d1370ebf5f16693ce742 Mon Sep 17 00:00:00 2001 From: maier Date: Thu, 20 Sep 2012 00:10:43 +0000 Subject: [PATCH] Reorganize comments and spacing git-svn-id: https://svn.dealii.org/branches/branch_cmake@26539 0785d39b-7218-0410-832d-ea1e28bc413d --- .../cmake/configure/configure_1_mpi.cmake | 17 ++--- .../cmake/configure/configure_1_tbb.cmake | 23 +++--- .../cmake/configure/configure_arpack.cmake | 4 +- .../cmake/configure/configure_blas.cmake | 4 +- .../cmake/configure/configure_boost.cmake | 10 +-- .../cmake/configure/configure_doxygen.cmake | 4 -- .../configure/configure_functionparser.cmake | 4 +- .../cmake/configure/configure_lapack.cmake | 11 ++- .../cmake/configure/configure_metis.cmake | 4 +- .../cmake/configure/configure_netcdf.cmake | 4 +- .../cmake/configure/configure_p4est.cmake | 5 +- .../cmake/configure/configure_trilinos.cmake | 16 +---- .../cmake/configure/configure_umfpack.cmake | 7 +- .../cmake/configure/configure_zlib.cmake | 5 +- deal.II/contrib/cmake/modules/FindAMD.cmake | 5 +- .../contrib/cmake/modules/FindARPACK.cmake | 5 +- deal.II/contrib/cmake/modules/FindMETIS.cmake | 6 +- .../contrib/cmake/modules/FindNETCDF.cmake | 5 +- deal.II/contrib/cmake/modules/FindP4EST.cmake | 5 +- deal.II/contrib/cmake/modules/FindTBB.cmake | 5 +- .../contrib/cmake/modules/FindTRILINOS.cmake | 9 ++- .../contrib/cmake/modules/FindUMFPACK.cmake | 5 +- .../cmake/setup_cached_variables.cmake | 30 ++++---- .../contrib/cmake/setup_compiler_flags.cmake | 72 +++++++------------ .../cmake/setup_compiler_flags_gnu.cmake | 34 ++++++++- .../cmake/setup_compiler_flags_icc.cmake | 0 deal.II/contrib/cmake/setup_finalize.cmake | 5 +- 27 files changed, 148 insertions(+), 156 deletions(-) create mode 100644 deal.II/contrib/cmake/setup_compiler_flags_icc.cmake diff --git a/deal.II/contrib/cmake/configure/configure_1_mpi.cmake b/deal.II/contrib/cmake/configure/configure_1_mpi.cmake index d3468f0469..0f7f165c37 100644 --- a/deal.II/contrib/cmake/configure/configure_1_mpi.cmake +++ b/deal.II/contrib/cmake/configure/configure_1_mpi.cmake @@ -3,13 +3,11 @@ # MACRO(FEATURE_MPI_FIND_EXTERNAL var) - FIND_PACKAGE(MPI) IF(MPI_CXX_FOUND) SET(${var} TRUE) ENDIF() - ENDMACRO() @@ -22,18 +20,12 @@ MACRO(FEATURE_MPI_CONFIGURE_EXTERNAL var) SET(DEAL_II_COMPILER_SUPPORTS_MPI TRUE) - # TODO: (Maybe) set up the rest: - #MPI_CXX_COMPILER MPI Compiler wrapper for CXX - - - #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 + #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() @@ -51,3 +43,4 @@ ENDMACRO() CONFIGURE_FEATURE(MPI) + diff --git a/deal.II/contrib/cmake/configure/configure_1_tbb.cmake b/deal.II/contrib/cmake/configure/configure_1_tbb.cmake index 4cd93ee4a9..7887bd771b 100644 --- a/deal.II/contrib/cmake/configure/configure_1_tbb.cmake +++ b/deal.II/contrib/cmake/configure/configure_1_tbb.cmake @@ -1,11 +1,11 @@ # -# Configuration for the tbb library: +# Configuration for tbb support: # # -# Set up genereal threading. The macro will be included in -# CONFIGURE_FEATURE_TBB_EXTERNAL/CONTRIB: +# Set up genereal threading: +# The macro will be included in CONFIGURE_FEATURE_TBB_EXTERNAL/CONTRIB. # MACRO(SETUP_THREADING var) FIND_PACKAGE(Threads) @@ -16,9 +16,7 @@ MACRO(SETUP_THREADING var) # # We support threading. Go on and configure the rest: # - ADD_FLAGS(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_THREAD_LIBS_INIT}") - SET(DEAL_II_USE_MT TRUE) # @@ -27,10 +25,10 @@ MACRO(SETUP_THREADING var) 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 @@ -44,12 +42,12 @@ MACRO(SETUP_THREADING var) } " 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() # @@ -57,7 +55,6 @@ MACRO(SETUP_THREADING var) # 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( " @@ -84,13 +81,11 @@ ENDMACRO() # MACRO(FEATURE_TBB_FIND_EXTERNAL var) - FIND_PACKAGE(TBB) IF(TBB_FOUND) SET(${var} TRUE) ENDIF() - ENDMACRO() @@ -126,18 +121,18 @@ MACRO(FEATURE_TBB_CONFIGURE_CONTRIB var) # Add tbb directly to the object files of deal.II # + # # Setup threading (before configuring our build...) # and if successfull return TRUE: + # SETUP_THREADING(${var}) - # # We have to disable a bunch of warnings: # ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-Wno-parentheses") ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-Wno-long-long") - INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/contrib/tbb/tbb30_104oss/include ) @@ -148,8 +143,8 @@ MACRO(FEATURE_TBB_CONFIGURE_CONTRIB var) $ ) - ENDMACRO() CONFIGURE_FEATURE(TBB) + diff --git a/deal.II/contrib/cmake/configure/configure_arpack.cmake b/deal.II/contrib/cmake/configure/configure_arpack.cmake index 04abc3ad21..b08baa0455 100644 --- a/deal.II/contrib/cmake/configure/configure_arpack.cmake +++ b/deal.II/contrib/cmake/configure/configure_arpack.cmake @@ -3,18 +3,15 @@ # MACRO(FEATURE_ARPACK_FIND_EXTERNAL var) - FIND_PACKAGE(ARPACK) IF(ARPACK_FOUND) SET(${var} TRUE) ENDIF() - ENDMACRO() MACRO(FEATURE_ARPACK_CONFIGURE_EXTERNAL var) - INCLUDE_DIRECTORIES(${ARPACK_INCLUDE_DIR}) LIST(APPEND deal_ii_external_libraries ${ARPACK_LIBRARY}) @@ -25,3 +22,4 @@ ENDMACRO() CONFIGURE_FEATURE(ARPACK) + diff --git a/deal.II/contrib/cmake/configure/configure_blas.cmake b/deal.II/contrib/cmake/configure/configure_blas.cmake index 023f19f12c..395d1dfaf7 100644 --- a/deal.II/contrib/cmake/configure/configure_blas.cmake +++ b/deal.II/contrib/cmake/configure/configure_blas.cmake @@ -3,18 +3,15 @@ # MACRO(FEATURE_BLAS_FIND_EXTERNAL var) - FIND_PACKAGE(BLAS) IF(BLAS_FOUND) SET(${var} TRUE) ENDIF() - ENDMACRO() MACRO(FEATURE_BLAS_CONFIGURE_EXTERNAL var) - ADD_FLAGS(CMAKE_SHARED_LINKER_FLAGS "${BLAS_LINKER_FLAGS}") LIST(APPEND deal_ii_external_libraries @@ -28,3 +25,4 @@ ENDMACRO() CONFIGURE_FEATURE(BLAS) + diff --git a/deal.II/contrib/cmake/configure/configure_boost.cmake b/deal.II/contrib/cmake/configure/configure_boost.cmake index 98287a12dc..ca45d7d744 100644 --- a/deal.II/contrib/cmake/configure/configure_boost.cmake +++ b/deal.II/contrib/cmake/configure/configure_boost.cmake @@ -24,7 +24,6 @@ ENDIF() MACRO(FEATURE_BOOST_FIND_EXTERNAL var) - FIND_PACKAGE (Boost COMPONENTS serialization thread) IF(Boost_THREAD_FOUND AND Boost_SERIALIZATION_FOUND) @@ -33,7 +32,6 @@ MACRO(FEATURE_BOOST_FIND_EXTERNAL var) # Get rid of this annoying unimportant variable: MARK_AS_ADVANCED(Boost_DIR) ENDIF() - ENDMACRO() @@ -59,11 +57,14 @@ SET(FEATURE_BOOST_HAVE_CONTRIB TRUE) MACRO(FEATURE_BOOST_CONFIGURE_CONTRIB var) - + # # compile the necessary parts of boost out of ./contrib + # + # # We need to set some definitions to use the headers of the bundled boost # library: + # ADD_DEFINITIONS("-DBOOST_NO_HASH" "-DBOOST_NO_SLIST") INCLUDE_DIRECTORIES( @@ -79,12 +80,13 @@ MACRO(FEATURE_BOOST_CONFIGURE_CONTRIB var) ) IF( DEAL_II_USE_MT AND NOT DEAL_II_CAN_USE_CXX1X) + # # If the C++ compiler doesn't completely support the C++1x standard # (and consequently we can't use std::thread, std::mutex, etc), then # include all the files that form BOOST's thread implementation so that # we don't have to build BOOST itself only to get at this small part of # it. it also ensures that we use the correct compiler and flags - + # ADD_SUBDIRECTORY( ${CMAKE_SOURCE_DIR}/contrib/boost-1.49.0/libs/thread/src ) diff --git a/deal.II/contrib/cmake/configure/configure_doxygen.cmake b/deal.II/contrib/cmake/configure/configure_doxygen.cmake index 3a3177d614..6831e0713f 100644 --- a/deal.II/contrib/cmake/configure/configure_doxygen.cmake +++ b/deal.II/contrib/cmake/configure/configure_doxygen.cmake @@ -3,7 +3,6 @@ # MACRO(FEATURE_DOXYGEN_FIND_EXTERNAL var) - FIND_PACKAGE(Doxygen) # @@ -12,12 +11,10 @@ MACRO(FEATURE_DOXYGEN_FIND_EXTERNAL var) IF(DOXYGEN_FOUND AND DOXYGEN_DOT_FOUND) SET(${var} TRUE) ENDIF() - ENDMACRO() MACRO(FEATURE_DOXYGEN_CONFIGURE_EXTERNAL var) - # # The FindDoxygen defines for us: # @@ -33,7 +30,6 @@ MACRO(FEATURE_DOXYGEN_CONFIGURE_EXTERNAL var) # SET(${var} TRUE) - ENDMACRO() diff --git a/deal.II/contrib/cmake/configure/configure_functionparser.cmake b/deal.II/contrib/cmake/configure/configure_functionparser.cmake index 4b7bf48748..51fd8d4dcd 100644 --- a/deal.II/contrib/cmake/configure/configure_functionparser.cmake +++ b/deal.II/contrib/cmake/configure/configure_functionparser.cmake @@ -13,8 +13,9 @@ SET(FEATURE_FUNCTIONPARSER_HAVE_CONTRIB TRUE) MACRO(FEATURE_FUNCTIONPARSER_CONFIGURE_CONTRIB var) - + # # compile the necessary parts of functionparser out of ./contrib + # INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/contrib/functionparser/ @@ -36,3 +37,4 @@ ENDMACRO() CONFIGURE_FEATURE(FUNCTIONPARSER) + diff --git a/deal.II/contrib/cmake/configure/configure_lapack.cmake b/deal.II/contrib/cmake/configure/configure_lapack.cmake index 1c7d8830b2..1bed7ff8c3 100644 --- a/deal.II/contrib/cmake/configure/configure_lapack.cmake +++ b/deal.II/contrib/cmake/configure/configure_lapack.cmake @@ -3,13 +3,11 @@ # MACRO(FEATURE_LAPACK_FIND_EXTERNAL var) - FIND_PACKAGE(LAPACK) IF(LAPACK_FOUND) SET(${var} TRUE) ENDIF() - ENDMACRO() @@ -21,12 +19,12 @@ MACRO(FEATURE_LAPACK_CONFIGURE_EXTERNAL var) ${LAPACK_LIBRARIES} ) - LIST(APPEND CMAKE_REQUIRED_LIBRARIES "${LAPACK_LIBRARIES}") - LIST(APPEND CMAKE_REQUIRED_FLAGS "${LAPACK_LINKER_FLAGS}") # # TODO: Reduce to the really necessary parts. # + LIST(APPEND CMAKE_REQUIRED_LIBRARIES "${LAPACK_LIBRARIES}") + LIST(APPEND CMAKE_REQUIRED_FLAGS "${LAPACK_LINKER_FLAGS}") CHECK_FUNCTION_EXISTS(daxpy_ HAVE_DAXPY_) CHECK_FUNCTION_EXISTS(dgeevx_ HAVE_DGEEVX_) CHECK_FUNCTION_EXISTS(dgeev_ AVE_DGEEV_) @@ -44,7 +42,6 @@ MACRO(FEATURE_LAPACK_CONFIGURE_EXTERNAL var) CHECK_FUNCTION_EXISTS(dstev_ AVE_DSTEV_) CHECK_FUNCTION_EXISTS(dsyevx_ HAVE_DSYEVX_) CHECK_FUNCTION_EXISTS(dsygvx_ HAVE_DSYGVX_) - CHECK_FUNCTION_EXISTS(saxpy_ HAVE_SAXPY_) CHECK_FUNCTION_EXISTS(sgeevx_ HAVE_SGEEVX_) CHECK_FUNCTION_EXISTS(sgeev_ HAVE_SGEEV_) @@ -62,12 +59,11 @@ MACRO(FEATURE_LAPACK_CONFIGURE_EXTERNAL var) CHECK_FUNCTION_EXISTS(sstev_ HAVE_SSTEV_) CHECK_FUNCTION_EXISTS(ssyevx_ HAVE_SSYEVX_) CHECK_FUNCTION_EXISTS(ssygvx_ HAVE_SSYGVX_) - CHECK_FUNCTION_EXISTS(strtrs_ HAVE_STRTRS_) - LIST(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES "${LAPACK_LIBRARIES}") LIST(REMOVE_ITEM CMAKE_REQUIRED_FLAGS "${LAPACK_LINKER_FLAGS}") + SET(HAVE_LIBLAPACK TRUE) SET(${var} TRUE) @@ -76,3 +72,4 @@ ENDMACRO() CONFIGURE_FEATURE(LAPACK) + diff --git a/deal.II/contrib/cmake/configure/configure_metis.cmake b/deal.II/contrib/cmake/configure/configure_metis.cmake index 7c81afe45b..a9f2605744 100644 --- a/deal.II/contrib/cmake/configure/configure_metis.cmake +++ b/deal.II/contrib/cmake/configure/configure_metis.cmake @@ -3,7 +3,6 @@ # MACRO(FEATURE_METIS_FIND_EXTERNAL var) - FIND_PACKAGE(METIS) IF(METIS_FOUND AND METIS_MAJOR GREATER 4) @@ -14,12 +13,10 @@ MACRO(FEATURE_METIS_FIND_EXTERNAL var) "Version 5.x required!" ) ENDIF() - ENDMACRO() MACRO(FEATURE_METIS_CONFIGURE_EXTERNAL var) - INCLUDE_DIRECTORIES(${METIS_INCLUDE_DIR}) LIST(APPEND deal_ii_external_libraries ${METIS_LIBRARY}) @@ -30,3 +27,4 @@ ENDMACRO() CONFIGURE_FEATURE(METIS) + diff --git a/deal.II/contrib/cmake/configure/configure_netcdf.cmake b/deal.II/contrib/cmake/configure/configure_netcdf.cmake index e5f2eba600..4aa284fc05 100644 --- a/deal.II/contrib/cmake/configure/configure_netcdf.cmake +++ b/deal.II/contrib/cmake/configure/configure_netcdf.cmake @@ -3,18 +3,15 @@ # MACRO(FEATURE_NETCDF_FIND_EXTERNAL var) - FIND_PACKAGE(NETCDF) IF(NETCDF_FOUND) SET(${var} TRUE) ENDIF() - ENDMACRO() MACRO(FEATURE_NETCDF_CONFIGURE_EXTERNAL var) - INCLUDE_DIRECTORIES(${NETCDF_INCLUDE_DIR}) LIST(APPEND deal_ii_external_libraries ${NETCDF_LIBRARY}) SET(HAVE_LIBNETCDF TRUE) @@ -24,3 +21,4 @@ ENDMACRO() CONFIGURE_FEATURE(NETCDF) + diff --git a/deal.II/contrib/cmake/configure/configure_p4est.cmake b/deal.II/contrib/cmake/configure/configure_p4est.cmake index 9dea4a18ed..469ce39c50 100644 --- a/deal.II/contrib/cmake/configure/configure_p4est.cmake +++ b/deal.II/contrib/cmake/configure/configure_p4est.cmake @@ -9,7 +9,6 @@ SET(FEATURE_P4EST_DEPENDS MACRO(FEATURE_P4EST_FIND_EXTERNAL var) - FIND_PACKAGE(P4EST) FIND_PACKAGE(SC) @@ -20,12 +19,10 @@ MACRO(FEATURE_P4EST_FIND_EXTERNAL var) IF(P4EST_FOUND AND SC_FOUND) SET(${var} TRUE) ENDIF() - ENDMACRO() MACRO(FEATURE_P4EST_CONFIGURE_EXTERNAL var) - INCLUDE_DIRECTORIES(${P4EST_INCLUDE_DIR} ${SC_INCLUDE_DIR}) IF (CMAKE_BUILD_TYPE MATCHES "Debug") @@ -52,7 +49,6 @@ MACRO(FEATURE_P4EST_CONFIGURE_EXTERNAL var) SET(DEAL_II_USE_P4EST TRUE) SET(${var} TRUE) - ENDMACRO() @@ -70,3 +66,4 @@ ENDMACRO() CONFIGURE_FEATURE(P4EST) + diff --git a/deal.II/contrib/cmake/configure/configure_trilinos.cmake b/deal.II/contrib/cmake/configure/configure_trilinos.cmake index 0208b8c234..7798de1974 100644 --- a/deal.II/contrib/cmake/configure/configure_trilinos.cmake +++ b/deal.II/contrib/cmake/configure/configure_trilinos.cmake @@ -4,14 +4,13 @@ MACRO(FEATURE_TRILINOS_FIND_EXTERNAL var) - FIND_PACKAGE(TRILINOS) IF(TRILINOS_FOUND) - SET(${var} TRUE) # # So, we have a library. Let's see whether we can use it: # + SET(${var} TRUE) # @@ -44,7 +43,6 @@ MACRO(FEATURE_TRILINOS_FIND_EXTERNAL var) ENDIF() - # # Trilinos 10.6 had quite a number of bugs we ran into, see # for example @@ -61,7 +59,6 @@ MACRO(FEATURE_TRILINOS_FIND_EXTERNAL var) ENDIF() - # # The same is unfortunately true for 10.8.[01]: # https://software.sandia.gov/bugzilla/show_bug.cgi?id=5370 @@ -78,12 +75,9 @@ MACRO(FEATURE_TRILINOS_FIND_EXTERNAL var) ENDIF() - # # Trilinos has to be configured with the same MPI configuration as - # deal.II. TODO: Refine this check... - # - + # deal.II. # # Epetra installs Epetra_MpiComm.h if configured trilinos was # configured with mpi. We use this as a check for the mpi configuration @@ -103,7 +97,6 @@ MACRO(FEATURE_TRILINOS_FIND_EXTERNAL var) ENDIF() - # # Some verions of Sacado_cmath.hpp does things that aren't compatible # with the -std=c++0x flag of GCC, see deal.II FAQ. @@ -129,12 +122,10 @@ MACRO(FEATURE_TRILINOS_FIND_EXTERNAL var) ENDIF() ENDIF(TRILINOS_FOUND) - ENDMACRO() MACRO(FEATURE_TRILINOS_CONFIGURE_EXTERNAL var) - INCLUDE_DIRECTORIES(${TRILINOS_INCLUDE_DIR}) LIST(APPEND deal_ii_external_libraries @@ -158,14 +149,13 @@ MACRO(FEATURE_TRILINOS_CONFIGURE_EXTERNAL var) # else and we better disable some of the warnings to enable us # to see through the clutter. # - 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() CONFIGURE_FEATURE(TRILINOS) + diff --git a/deal.II/contrib/cmake/configure/configure_umfpack.cmake b/deal.II/contrib/cmake/configure/configure_umfpack.cmake index bed5192e39..34b8ee1df4 100644 --- a/deal.II/contrib/cmake/configure/configure_umfpack.cmake +++ b/deal.II/contrib/cmake/configure/configure_umfpack.cmake @@ -10,19 +10,16 @@ SET(FEATURE_UMFPACK_DEPENDS MACRO(FEATURE_UMFPACK_FIND_EXTERNAL var) - FIND_PACKAGE(UMFPACK) FIND_PACKAGE(AMD) IF(UMFPACK_FOUND AND AMD_FOUND) SET(${var} TRUE) ENDIF() - ENDMACRO() MACRO(FEATURE_UMFPACK_CONFIGURE_EXTERNAL var) - INCLUDE_DIRECTORIES(${UMFPACK_INCLUDE_DIR} ${AMD_INCLUDE_DIR}) LIST(APPEND deal_ii_external_libraries @@ -32,7 +29,6 @@ MACRO(FEATURE_UMFPACK_CONFIGURE_EXTERNAL var) SET(HAVE_LIBUMFPACK TRUE) SET(${var} TRUE) - ENDMACRO() @@ -40,7 +36,6 @@ SET(FEATURE_UMFPACK_HAVE_CONTRIB TRUE) MACRO(FEATURE_UMFPACK_CONFIGURE_CONTRIB var) - INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/contrib/umfpack/UMFPACK/Include ${CMAKE_SOURCE_DIR}/contrib/umfpack/AMD/Include @@ -62,7 +57,6 @@ MACRO(FEATURE_UMFPACK_CONFIGURE_CONTRIB var) SET(HAVE_LIBUMFPACK TRUE) SET(${var} TRUE) - ENDMACRO() @@ -82,3 +76,4 @@ ENDMACRO() CONFIGURE_FEATURE(UMFPACK) + diff --git a/deal.II/contrib/cmake/configure/configure_zlib.cmake b/deal.II/contrib/cmake/configure/configure_zlib.cmake index b1291d9043..1221050628 100644 --- a/deal.II/contrib/cmake/configure/configure_zlib.cmake +++ b/deal.II/contrib/cmake/configure/configure_zlib.cmake @@ -3,25 +3,22 @@ # MACRO(FEATURE_ZLIB_FIND_EXTERNAL var) - FIND_PACKAGE(ZLIB) IF(ZLIB_FOUND) SET(${var} TRUE) ENDIF() - ENDMACRO() MACRO(FEATURE_ZLIB_CONFIGURE_EXTERNAL var) - INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIRS}) LIST(APPEND deal_ii_external_libraries ${ZLIB_LIBRARIES}) SET(HAVE_LIBZ TRUE) SET(${var} TRUE) - ENDMACRO() CONFIGURE_FEATURE(ZLIB) + diff --git a/deal.II/contrib/cmake/modules/FindAMD.cmake b/deal.II/contrib/cmake/modules/FindAMD.cmake index 848d53711c..4b90208439 100644 --- a/deal.II/contrib/cmake/modules/FindAMD.cmake +++ b/deal.II/contrib/cmake/modules/FindAMD.cmake @@ -1,4 +1,6 @@ -# Try to find AMD +# +# Try to find the AMD library +# INCLUDE(FindPackageHandleStandardArgs) @@ -18,3 +20,4 @@ IF(AMD_FOUND) AMD_INCLUDE_DIR ) ENDIF() + diff --git a/deal.II/contrib/cmake/modules/FindARPACK.cmake b/deal.II/contrib/cmake/modules/FindARPACK.cmake index 6479e4c386..c98a121a82 100644 --- a/deal.II/contrib/cmake/modules/FindARPACK.cmake +++ b/deal.II/contrib/cmake/modules/FindARPACK.cmake @@ -1,4 +1,6 @@ -# Try to find ARPACK +# +# Try to find the ARPACK library +# INCLUDE(FindPackageHandleStandardArgs) @@ -14,3 +16,4 @@ IF(ARPACK_FOUND) ARPACK_LIBRARY ) ENDIF() + diff --git a/deal.II/contrib/cmake/modules/FindMETIS.cmake b/deal.II/contrib/cmake/modules/FindMETIS.cmake index a61f125836..7dfb4c76a4 100644 --- a/deal.II/contrib/cmake/modules/FindMETIS.cmake +++ b/deal.II/contrib/cmake/modules/FindMETIS.cmake @@ -1,4 +1,6 @@ -# Try to find METIS +# +# Try to find the METIS library +# INCLUDE(FindPackageHandleStandardArgs) @@ -14,7 +16,6 @@ FIND_LIBRARY(METIS_LIBRARY # # Extract the version number out of metis.h # - FILE(STRINGS "${METIS_INCLUDE_DIR}/metis.h" METIS_MAJOR_STRING REGEX "METIS_VER_MAJOR") STRING(REGEX REPLACE "^.*METIS_VER_MAJOR.* ([0-9]+).*" "\\1" METIS_MAJOR "${METIS_MAJOR_STRING}") @@ -32,3 +33,4 @@ IF(METIS_FOUND) METIS_INCLUDE_DIR ) ENDIF() + diff --git a/deal.II/contrib/cmake/modules/FindNETCDF.cmake b/deal.II/contrib/cmake/modules/FindNETCDF.cmake index bbb925c223..09c535fc75 100644 --- a/deal.II/contrib/cmake/modules/FindNETCDF.cmake +++ b/deal.II/contrib/cmake/modules/FindNETCDF.cmake @@ -1,4 +1,6 @@ -# Try to find NETCDF +# +# Try to find the NETCDF library +# INCLUDE(FindPackageHandleStandardArgs) @@ -18,3 +20,4 @@ IF(NETCDF_FOUND) NETCDF_INCLUDE_DIR ) ENDIF() + diff --git a/deal.II/contrib/cmake/modules/FindP4EST.cmake b/deal.II/contrib/cmake/modules/FindP4EST.cmake index e8336b69d3..af21eed2e2 100644 --- a/deal.II/contrib/cmake/modules/FindP4EST.cmake +++ b/deal.II/contrib/cmake/modules/FindP4EST.cmake @@ -1,4 +1,6 @@ -# Try to find P4EST +# +# Try to find the P4EST library +# INCLUDE(FindPackageHandleStandardArgs) @@ -24,3 +26,4 @@ IF(P4EST_FOUND) P4EST_INCLUDE_DIR ) ENDIF() + diff --git a/deal.II/contrib/cmake/modules/FindTBB.cmake b/deal.II/contrib/cmake/modules/FindTBB.cmake index f8c8a418d5..34d11008ad 100644 --- a/deal.II/contrib/cmake/modules/FindTBB.cmake +++ b/deal.II/contrib/cmake/modules/FindTBB.cmake @@ -1,4 +1,6 @@ -# Try to find the Threading Building Blocks-library +# +# Try to find the Threading Building Blocks library +# INCLUDE(FindPackageHandleStandardArgs) @@ -25,3 +27,4 @@ IF(TBB_FOUND) TBB_INCLUDE_DIR ) ENDIF() + diff --git a/deal.II/contrib/cmake/modules/FindTRILINOS.cmake b/deal.II/contrib/cmake/modules/FindTRILINOS.cmake index 0c1334efbb..78b6895dd8 100644 --- a/deal.II/contrib/cmake/modules/FindTRILINOS.cmake +++ b/deal.II/contrib/cmake/modules/FindTRILINOS.cmake @@ -1,4 +1,6 @@ -# Try to find the Trilinos +# +# Try to find the Trilinos library +# INCLUDE(FindPackageHandleStandardArgs) @@ -12,6 +14,9 @@ find_package(TRILINOS PATH_PREFIXES lib64/cmake/Trilinos lib/cmake/Trilinos ) +# +# Extract the major and minor version numbers: +# STRING(REGEX REPLACE "^([0-9]+).*$" "\\1" TRILINOS_MAJOR "${Trilinos_VERSION}") @@ -25,7 +30,6 @@ STRING(REGEX REPLACE TRILINOS_SUBMINOR "${Trilinos_VERSION}") -# TODO: Trilinos may export more than one include dir. FIND_PATH(TRILINOS_INCLUDE_DIR Trilinos_version.h HINTS ${Trilinos_INCLUDE_DIRS} ) @@ -59,3 +63,4 @@ IF(TRILINOS_FOUND) TRILINOS_LIBRARIES ) ENDIF() + diff --git a/deal.II/contrib/cmake/modules/FindUMFPACK.cmake b/deal.II/contrib/cmake/modules/FindUMFPACK.cmake index 13b2847275..fe349e61fc 100644 --- a/deal.II/contrib/cmake/modules/FindUMFPACK.cmake +++ b/deal.II/contrib/cmake/modules/FindUMFPACK.cmake @@ -1,4 +1,6 @@ -# Try to find UMFPACK +# +# Try to find the UMFPACK library +# INCLUDE(FindPackageHandleStandardArgs) @@ -18,3 +20,4 @@ IF(UMFPACK_FOUND) UMFPACK_INCLUDE_DIR ) ENDIF() + diff --git a/deal.II/contrib/cmake/setup_cached_variables.cmake b/deal.II/contrib/cmake/setup_cached_variables.cmake index ea673de7f1..628e579888 100644 --- a/deal.II/contrib/cmake/setup_cached_variables.cmake +++ b/deal.II/contrib/cmake/setup_cached_variables.cmake @@ -1,5 +1,6 @@ # -# FAT NOTE: +# Setup cached variables prior to the PROJECT(deal.II) call +# # # We have a problem: We would like to setup our choice of C_FLAGS and # CXX_FLAGS but let the user overwrite it (if desired). @@ -8,13 +9,14 @@ # # We have to call PROJECT(deal.II) in order to set up the project and run # the C- and CXX-compiler detection and configuration. (Otherwise we cannot -# compile anything and have no idea which compiler is selected.) In this -# process CMAKE_{C|CXX}_FLAGS are already set to stupid default values. +# compile anything and, furthermore, have no idea which compiler is +# selected.) In this process CMAKE_CXX_FLAGS[...] are already set to stupid +# default values. # (And _cannot_ be sanely set from this script afterwards...) # # To mitigate this problem, we do the following: # -# - We initialize the cached CMAKE_{C|CXX}_FLAGS variables with empty +# - We initialize the cached CMAKE_CXX_FLAGS[...] variables with empty # strings prior to initializing the compiler, so that no default values # are set. # @@ -28,37 +30,38 @@ # # - At the end of the configuration step we add _SAVED # _AT THE END_ of the respective allowing the user to -# effectively overwrite our default setting. +# effectively overwrite our default settings. # # # Setup CMAKE_BUILD_TYPE: # - SET(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: Debug Release.") + +# +# This is cruel, I know. But it is better to only have a known number of +# options for CMAKE_BUILD_TYPE... +# IF( NOT CMAKE_BUILD_TYPE MATCHES "Release" AND NOT CMAKE_BUILD_TYPE MATCHES "Debug" ) - # - # This is cruel, I know. But it is better to only have a known number of - # options for CMAKE_BUILD_TYPE... - # MESSAGE(FATAL_ERROR "CMAKE_BUILD_TYPE does neither match Release, nor Debug.") ENDIF() + # # Set BUILD_SHARED_LIBS to default to ON: # -SET(BUILD_SHARED_LIBS TRUE CACHE BOOL "Build a shared library") +SET(BUILD_SHARED_LIBS ON CACHE OPTION "Build a shared library") + # # Set cached compiler flags to an empty string: # - SET(deal_ii_used_flags CMAKE_C_FLAGS CMAKE_CXX_FLAGS @@ -67,8 +70,8 @@ SET(deal_ii_used_flags CMAKE_C_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG ) - FOREACH(flags ${deal_ii_used_flags}) + # "CACHE" ensures that we only set the variable if it is not already set # as a cached variable, effectively we're setting a default value: SET(${flags} "" CACHE STRING @@ -83,5 +86,6 @@ FOREACH(flags ${deal_ii_used_flags}) # SET(${flags}_SAVED "${${flags}}") SET(${flags} "") + ENDFOREACH() diff --git a/deal.II/contrib/cmake/setup_compiler_flags.cmake b/deal.II/contrib/cmake/setup_compiler_flags.cmake index 94887aae16..c8bbce0b86 100644 --- a/deal.II/contrib/cmake/setup_compiler_flags.cmake +++ b/deal.II/contrib/cmake/setup_compiler_flags.cmake @@ -1,15 +1,12 @@ # -# Setup default compiler flags: +# Setup default compiler flags: This file sets up sensible default compiler +# flags for the various platforms, compilers and build targets supported by +# the deal.II library. # -# This file sets up sensible default compiler flags for the various -# platforms, compilers and build targets supported by the deal.II -# library. # - -# -# #################### -# # FAT NOTE: # -# #################### +# #################### +# # FAT NOTE: # +# #################### # # All configuration in setup_compiler_flags.cmake and # setup_compiler_flags_.cmake shall ONLY consist of CFLAGS, @@ -31,12 +28,12 @@ # -# ###################### -# # FAT NOTE 2: # -# ###################### +# We need a C compiler only for the compilation of the bundled umfpack +# library, so we don't make much fuss about configuration and setup of the +# C compiler and assume that CC and CXX are the same compiler brand, hence +# supporting almost the same compiler flags. +# (See setup in setup_compiler_flags_*.cmake) # -# For the moment we assume that CC and CXX are the same compiler. -# We need CC for the compilation of the bundled umfpack library only... # So, give a prominent error message in case CC and CXX differ: # IF(NOT ( ${CMAKE_C_COMPILER_ID} STREQUAL ${CMAKE_CXX_COMPILER_ID} AND @@ -50,12 +47,10 @@ IF(NOT ( ${CMAKE_C_COMPILER_ID} STREQUAL ${CMAKE_CXX_COMPILER_ID} AND ENDIF() - -# -# Setup CMAKE_CXX_FLAGS<_RELEASE|_DEBUG>: -# - IF(DEAL_II_SETUP_DEFAULT_COMPILER_FLAGS) + # + # *Hooray* We are allowed to set compiler flags :-] + # MESSAGE(STATUS "Set up default compiler flags.") # @@ -67,44 +62,25 @@ IF(DEAL_II_SETUP_DEFAULT_COMPILER_FLAGS) SET(DEAL_II_KNOWN_COMPILER TRUE) ENDIF() + # + # Setup for ICC compiler: + # + IF( CMAKE_CXX_COMPILER_ID MATCHES "Intel") + INCLUDE(setup_compiler_flags_intel) + SET(DEAL_II_KNOWN_COMPILER TRUE) + ENDIF() + IF(NOT DEAL_II_KNOWN_COMPILER) MESSAGE(WARNING "\n" - "Unrecognized compiler!\n\n" + "Unrecognized compiler!\n" "Please set the relevant compiler options by hand.\n") ENDIF() ELSE(DEAL_II_SETUP_DEFAULT_COMPILER_FLAGS) MESSAGE(STATUS - "Skipped setting up default compiler flags " + "Skipped setup of default compiler flags " "(DEAL_II_SETUP_DEFAULT_COMPILER_FLAGS=OFF)" ) ENDIF(DEAL_II_SETUP_DEFAULT_COMPILER_FLAGS) - - -# -# Setup CMAKE_C_FLAGS<_RELEASE|_DEBUG>: -# - -# -# For the moment we assume that CC and CXX are the same compiler and that -# we can set (almost) the same default flags for both. -# - -SET(CMAKE_C_FLAGS ${CMAKE_CXX_FLAGS}) -SET(CMAKE_C_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE}) -SET(CMAKE_C_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG}) - -# -# Strip flags not supported by a C target: -# -STRIP_FLAG(CMAKE_C_FLAGS "-Wsynth") -STRIP_FLAG(CMAKE_C_FLAGS_RELEASE "-felide-constructors") - -# -# Disable some warnings: -# -STRIP_FLAG(CMAKE_C_FLAGS "-Wall") # There is no other way to disable -Wunknown-pragma atm... -STRIP_FLAG(CMAKE_C_FLAGS "-Wsign-compare") -STRIP_FLAG(CMAKE_C_FLAGS "-Wwrite-strings") diff --git a/deal.II/contrib/cmake/setup_compiler_flags_gnu.cmake b/deal.II/contrib/cmake/setup_compiler_flags_gnu.cmake index a127f5c176..2b23322e3b 100644 --- a/deal.II/contrib/cmake/setup_compiler_flags_gnu.cmake +++ b/deal.II/contrib/cmake/setup_compiler_flags_gnu.cmake @@ -1,8 +1,8 @@ # # General setup for GCC and compilers sufficiently close to GCC # -# Please read the fat note in setup_compiler_flags.cmake prior to editing -# this file. +# Please read the fat note in setup_compiler_flags.cmake prior to +# editing this file. # @@ -98,7 +98,6 @@ IF(CMAKE_SYSTEM_NAME MATCHES "CYGWIN") # TODO: Check for correct name ENDIF() - ################################# # # # For the Release target: # @@ -140,3 +139,32 @@ IF (CMAKE_BUILD_TYPE MATCHES "Debug") ENABLE_IF_SUPPORTED(CMAKE_SHARED_LINKER_FLAGS "-g") ENDIF() ENDIF() + + +############################################### +# # +# Set up CMAKE_C_FLAGS<_RELEASE|_DEBUG> # +# # +############################################### + +# +# For the moment we assume that CC and CXX are the same compiler and that +# we can set (almost) the same default flags for both: +# +SET(CMAKE_C_FLAGS ${CMAKE_CXX_FLAGS}) +SET(CMAKE_C_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE}) +SET(CMAKE_C_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG}) + +# +# OK, touché, touché. We have to strip flags not supported by a C target: +# +STRIP_FLAG(CMAKE_C_FLAGS "-Wsynth") +STRIP_FLAG(CMAKE_C_FLAGS_RELEASE "-felide-constructors") + +# +# and disable some warnings: +# +STRIP_FLAG(CMAKE_C_FLAGS "-Wall") # There is no other way to disable -Wunknown-pragma atm... +STRIP_FLAG(CMAKE_C_FLAGS "-Wsign-compare") +STRIP_FLAG(CMAKE_C_FLAGS "-Wwrite-strings") + diff --git a/deal.II/contrib/cmake/setup_compiler_flags_icc.cmake b/deal.II/contrib/cmake/setup_compiler_flags_icc.cmake new file mode 100644 index 0000000000..e69de29bb2 diff --git a/deal.II/contrib/cmake/setup_finalize.cmake b/deal.II/contrib/cmake/setup_finalize.cmake index 16593f1ee0..d9b4625fc3 100644 --- a/deal.II/contrib/cmake/setup_finalize.cmake +++ b/deal.II/contrib/cmake/setup_finalize.cmake @@ -1,3 +1,7 @@ +# +# Finalize the configuration: +# + # # Append the saved initial (cached) variables ${flags}_SAVED at the end of # ${flags}, see setup_cached_compiler_flags.cmake and the main @@ -11,7 +15,6 @@ ENDFOREACH() # # And print out a nice configuration summary: # - MESSAGE(" * * -- 2.39.5