From: maier Date: Mon, 10 Sep 2012 14:13:53 +0000 (+0000) Subject: New configuration behaviour: X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=02357457e1681091b604039b7a837c9b4d1eb612;p=dealii-svn.git New configuration behaviour: The library autodetection no defaults to use external libraries. The following configuration toggles can be used to overwrite the behaviour: DEAL_II_ALLOW_CONTRIB Allow the use of contrib libraries if an external library is not found. DEAL_II_FORCE_CONTRIB_* Force the use of a contrib library. This overwrites the autodetection as well as DEAL_II_ALLOW_CONTRIB git-svn-id: https://svn.dealii.org/branches/branch_cmake@26264 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/CMakeLists.txt b/deal.II/CMakeLists.txt index 26f7d857cd..0b4c414a2a 100644 --- a/deal.II/CMakeLists.txt +++ b/deal.II/CMakeLists.txt @@ -12,31 +12,49 @@ SET(CMAKE_INCLUDE_CURRENT_DIR true) # General configuration options: # -OPTION(DEAL_II_USE_CONTRIB - "Build and use contrib libraries bundled with the source tarball." - ON - ) +OPTION(DEAL_II_ALLOW_CONTRIB + "Allow the use of contrib libraries bundled with the source tarball. + Note: If set to off DEAL_II_FORCE_CONTRIB* will still pull in bundled + 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" + ON) + OPTION(DEAL_II_WITH_THREADS "Build deal.II with support for threads. This pulls in libtbb as a dependency." - ON - ) + ON) + OPTION(DEAL_II_FUNCTIONPARSER - "BUild deal.II with support for functionparser" - ON - ) -OPTION(DEAL_II_MPI "Build deal.II with support for openmpi." - OFF - ) -OPTION(DEAL_II_WITH_UMFPACK "Build deal.II with support for UMFPACK, BLAS and LAPACK." - ON - ) -OPTION(DEAL_II_WITH_METIS "Build deal.II with support for Metis." - OFF - ) + "Build deal.II with support for functionparser" + ON) + +OPTION(DEAL_II_MPI + "Build deal.II with support for openmpi." + OFF) + +OPTION(DEAL_II_WITH_UMFPACK + "Build deal.II with support for UMFPACK, BLAS and LAPACK." + ON) + +OPTION(DEAL_II_WITH_METIS + "Build deal.II with support for Metis." + OFF) # TODO: The rest ;-) +OPTION(DEAL_II_FORCE_CONTRIB_BOOST + "Always use the bundled boost library instead of an external one." + OFF) + +OPTION(DEAL_II_FORCE_CONTRIB_TBB + "Always use the bundled tbb library instead of an external one." + OFF) + +OPTION(DEAL_II_FORCE_CONTRIB_UMFPACK + "Always use the bundled umfpack library instead of an external one." + OFF) + # # Now, configure and prepare a lot of things: @@ -68,7 +86,7 @@ ENDIF() # TODO: The rest... -message( "${deal_ii_external_libraries}" ) + # # Build the toolchain: @@ -77,7 +95,6 @@ message( "${deal_ii_external_libraries}" ) ADD_SUBDIRECTORY(common/expand_instantiations) - # # Compile the library: # @@ -91,4 +108,5 @@ INCLUDE_DIRECTORIES( INCLUDE(macro_expand_instantiations) ADD_SUBDIRECTORY(include) + ADD_SUBDIRECTORY(source) diff --git a/deal.II/contrib/cmake/modules/prepare_boost.cmake b/deal.II/contrib/cmake/modules/prepare_boost.cmake index cd942493e8..a9a8566101 100644 --- a/deal.II/contrib/cmake/modules/prepare_boost.cmake +++ b/deal.II/contrib/cmake/modules/prepare_boost.cmake @@ -1,14 +1,25 @@ -IF(NOT DEAL_II_USE_CONTRIB) +IF(DEAL_II_ALLOW_CONTRIB) + FIND_PACKAGE (Boost COMPONENTS serialization thread) +ELSE() FIND_PACKAGE (Boost COMPONENTS serialization thread REQUIRED) +ENDIF() + +# +# Get rid of this annoying unimportant variable: +# +MARK_AS_ADVANCED(Boost_DIR) - INCLUDE_DIRECTORIES (${Boost_INCLUDE_DIR}) +IF(NOT DEAL_II_FORCE_CONTRIB_BOOST) + IF(Boost_THREAD_FOUND AND Boost_SERIALIZATION_FOUND) + INCLUDE_DIRECTORIES (${Boost_INCLUDE_DIR}) - LIST(APPEND deal_ii_external_libraries - ${Boost_THREAD_LIBRARY} ${Boost_SERIALIZATION_LIBRARY} - ) - LIST(APPEND deal_ii_external_debug_libraries - ${Boost_THREAD_LIBRARY_DEBUG} ${Boost_SERIALIZATION_LIBRARY_DEBUG} - ) + LIST(APPEND deal_ii_external_libraries + ${Boost_THREAD_LIBRARY} ${Boost_SERIALIZATION_LIBRARY} + ) + LIST(APPEND deal_ii_external_debug_libraries + ${Boost_THREAD_LIBRARY_DEBUG} ${Boost_SERIALIZATION_LIBRARY_DEBUG} + ) - SET(DEAL_II_USE_EXTERNAL_BOOST TRUE) + SET(DEAL_II_USE_EXTERNAL_BOOST TRUE) + ENDIF() ENDIF() diff --git a/deal.II/contrib/cmake/modules/prepare_threads.cmake b/deal.II/contrib/cmake/modules/prepare_threads.cmake index 5c0a830f18..700d489dfd 100644 --- a/deal.II/contrib/cmake/modules/prepare_threads.cmake +++ b/deal.II/contrib/cmake/modules/prepare_threads.cmake @@ -1,25 +1,28 @@ FIND_PACKAGE(Threads REQUIRED) -IF(DEAL_II_USE_CONTRIB) +IF(DEAL_II_ALLOW_CONTRIB) + FIND_PACKAGE(TBB) +ELSE() + FIND_PACKAGE(TBB REQUIRED) +ENDIF() + +IF(DEAL_II_FORCE_CONTRIB_TBB OR NOT TBB_FOUND) + SET(libtbb_directory "tbb30_104oss") + # compile and link the contrib tbb library: ADD_SUBDIRECTORY(contrib/tbb) - # This sets TBB_LIBRARY and TBB_DEBUG_LIBRARY to the full path of the - # _installed_ library location -ELSE() + # set TBB_LIBRARY and TBB_DEBUG_LIBRARY to the full path of the + # _installed_ library location: - FIND_PACKAGE(TBB REQUIRED) + SET(TBB_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/contrib/tbb/${libtbb_directory}/include) + SET(TBB_LIBRARY ${CMAKE_INSTALL_PREFIX}/lib/libtbb.so) + SET(TBB_DEBUG_LIBRARY ${CMAKE_INSTALL_PREFIX}/lib/libtbb_debug.so) ENDIF() INCLUDE_DIRECTORIES(${TBB_INCLUDE_DIR}) -IF(NOT DEAL_II_USE_CONTRIB) - LIST(APPEND deal_ii_include_paths - ${TBB_INCLUDE_DIR} - ) -ENDIF() - LIST(APPEND deal_ii_external_libraries ${TBB_LIBRARY} ) diff --git a/deal.II/contrib/cmake/modules/prepare_umfpack.cmake b/deal.II/contrib/cmake/modules/prepare_umfpack.cmake index d74a9630c9..4ad1a64ce3 100644 --- a/deal.II/contrib/cmake/modules/prepare_umfpack.cmake +++ b/deal.II/contrib/cmake/modules/prepare_umfpack.cmake @@ -1,7 +1,22 @@ FIND_PACKAGE(LAPACK REQUIRED) FIND_PACKAGE(BLAS REQUIRED) -IF(DEAL_II_USE_CONTRIB) +IF(DEAL_II_ALLOW_CONTRIB) + FIND_PACKAGE(Umfpack) + FIND_PACKAGE(AMD) +ELSE() + FIND_PACKAGE(Umfpack REQUIRED) + FIND_PACKAGE(AMD REQUIRED) +ENDIF() + +IF(UMFPACK_FOUND AND AMD_FOUND) + SET(UmfpackAMD_FOUND TRUE) +ELSE() + SET(UmfpackAMD_FOUND FALSE) +ENDIF() + + +IF(DEAL_II_FORCE_CONTRIB_UMFPACK OR NOT UmfpackAMD_FOUND) # # Add umfpack and amd directly to the object files of deal.II # @@ -21,16 +36,9 @@ IF(DEAL_II_USE_CONTRIB) $ ) ELSE() - FIND_PACKAGE(Umfpack REQUIRED) - FIND_PACKAGE(AMD REQUIRED) INCLUDE_DIRECTORIES(${Umfpack_INCLUDE_DIR} ${AMD_INCLUDE_DIR}) - # - # We skip *_INCLUDE_DIR because it is not needed for the use of the - # deal.II library - # - LIST(APPEND deal_ii_external_libraries ${Umfpack_LIBRARY} ${AMD_LIBRARY} ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES} ) diff --git a/deal.II/contrib/tbb/CMakeLists.txt b/deal.II/contrib/tbb/CMakeLists.txt index 197761dd74..bb4de171cc 100644 --- a/deal.II/contrib/tbb/CMakeLists.txt +++ b/deal.II/contrib/tbb/CMakeLists.txt @@ -1,5 +1,3 @@ -SET(libtbb_directory "tbb30_104oss") - ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${libtbb_directory} COMMAND ${CMAKE_COMMAND} -E copy_directory @@ -24,10 +22,6 @@ ADD_CUSTOM_TARGET(tbb ALL ADD_DEPENDENCIES(deal_ii_target_dependencies tbb) -SET(TBB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/${libtbb_directory}/include) -SET(TBB_LIBRARY ${CMAKE_INSTALL_PREFIX}/lib/libtbb.so) -SET(TBB_DEBUG_LIBRARY ${CMAKE_INSTALL_PREFIX}/lib/libtbb_debug.so) - INSTALL( DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${libtbb_directory}/include/tbb DESTINATION include