]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Update for the build process
authormaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 13 Sep 2012 12:07:48 +0000 (12:07 +0000)
committermaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 13 Sep 2012 12:07:48 +0000 (12:07 +0000)
git-svn-id: https://svn.dealii.org/branches/branch_cmake@26349 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/CMakeLists.txt
deal.II/contrib/cmake/check/check_for_compiler_features.cmake
deal.II/contrib/cmake/check/check_for_cxx_features.cmake
deal.II/contrib/cmake/configure/configure_mpi.cmake
deal.II/contrib/cmake/configure/configure_threads.cmake

index 3271176ba659bec0cc5d7e8b3c36dde3a920a6bd..83e8c438e8a5ed052985b9c37184cffe584fed8f 100644 (file)
@@ -82,7 +82,7 @@ OPTION(DEAL_II_WITH_NETCDF
 
 OPTION(DEAL_II_WITH_THREADS
   "Build deal.II with support for threads. This pulls in libtbb as a dependency."
-  ON)
+  OFF)
 
 OPTION(DEAL_II_WITH_UMFPACK
   "Build deal.II with support for UMFPACK, BLAS and LAPACK."
@@ -110,7 +110,7 @@ OPTION(DEAL_II_FORCE_CONTRIB_FUNCTIONPARSER
 
 OPTION(DEAL_II_FORCE_CONTRIB_BOOST
   "Always use the bundled boost library instead of an external one."
-  ON)
+  OFF)
 
 OPTION(DEAL_II_FORCE_CONTRIB_TBB
   "Always use the bundled tbb library instead of an external one."
@@ -176,17 +176,42 @@ SET(DEAL_II_PATH ${CMAKE_INSTALL_PREFIX})
 
 
 
+
 #
 # Now, configure a lot of things:
 #
 
-# Used as a dummy target for all the stuff that has to be done before the
-# library can be compiled:
-ADD_CUSTOM_TARGET(deal_ii_target_dependencies)
 
-# Used to keep track of external libraries and necessary linker flags
-SET(deal_ii_external_libraries "")
-SET(deal_ii_required_linker_flags "")
+###########################################################################
+#                                                                         #
+#                               FAT NOTE:                                 #
+#                                                                         #
+###########################################################################
+
+#
+# To keep things clean, only the following cmake variables should be
+# altered (beside setting a lot of DEAL_II_* definitions...)
+#
+# CMAKE_SHARED_LINKER_FLAGS
+#
+#   for setting necessary linker flags for the deal.II library.
+#
+# CMAKE_C_FLAGS and CMAKE_CXX_FLAGS (uncached)
+#
+#   for setting necessary compiler flags, e.g. -std=c++0x (if available).
+#   Note: Uncached variables are not visible to the user, and cannot be
+#   altered.
+#
+ADD_CUSTOM_TARGET(deal_ii_target_dependencies)
+#
+#   Used as a dummy target for all the stuff that has to be done before the
+#   library can be compiled.
+#
+SET(deal_ii_external_libraries)
+#
+#   Used to keep track of external libraries, against which the deal.II
+#   library will be linked.
+#
 
 #
 # Platform checks:
@@ -233,17 +258,6 @@ ENDIF()
 
 
 
-# And finally convert deal_ii_required_linker_flags from a list into a
-# string *sigh*
-# TODO: Encapsulate in a macro...
-SET(deal_ii_required_linker_flags_list ${deal_ii_required_linker_flags})
-SET(deal_ii_required_linker_flags "")
-FOREACH (arg ${deal_ii_required_linker_flags_list})
-  SET(deal_ii_required_linker_flags "${deal_ii_required_linker_flags} ${arg}")
-ENDFOREACH()
-
-
-
 #
 # Build the toolchain:
 #
index f8e4127fa5fc88c8d2fa793b5d83b6f162109ede..17d94906e1061042e66efcae198a5aaa0f755e15 100644 (file)
@@ -1,4 +1,5 @@
 INCLUDE(CheckCXXSourceCompiles)
+INCLUDE(CheckCXXCompilerFlag)
 INCLUDE(CheckCXXSourceRuns)
 
 
@@ -11,6 +12,7 @@ INCLUDE(CheckCXXSourceRuns)
 #
 # Check whether the std::vector::iterator is just a plain pointer
 #
+# TODO: Get rid of this negation!
 CHECK_CXX_SOURCE_COMPILES(
   "
   #include <vector>
@@ -102,16 +104,10 @@ CHECK_CXX_SOURCE_COMPILES(
 
 IF(HAVE_GLIBC_STACKTRACE AND NOT CMAKE_SYSTEM_NAME MATCHES "Darwin")
 
-  LIST(APPEND CMAKE_REQUIRED_FLAGS "-rdynamic")
-
-  CHECK_CXX_SOURCE_COMPILES(
-    "
-    int main() { return 0; }
-    "
+  CHECK_CXX_COMPILER_FLAG(
+    "-rdynamic"
     DEAL_II_COMPILER_HAS_RDYNAMIC)
 
-  LIST(REMOVE_ITEM CMAKE_REQUIRED_FLAGS "-rdynamic")
-
   IF(DEAL_II_COMPILER_HAS_RDYNAMIC)
     SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -rdynamic")
   ENDIF()
@@ -376,3 +372,17 @@ IF(NOT DEAL_II_COMPILER_HAS_ATTRIBUTE_PRETTY_FUNCTION)
   ENDIF()
 
 ENDIF()
+
+
+
+#
+# Check whether the -as-needed flag is available. If so set it to compile
+# the deal.II library
+#
+CHECK_CXX_COMPILER_FLAG(
+  "-Wl,-as-needed"
+  DEAL_II_COMPILER_HAS_AS_NEEDED)
+
+IF(DEAL_II_COMPILER_HAS_AS_NEEDED)
+  SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-as-needed")
+ENDIF()
index 44724c4ea0111a7f1df66a84a7144d6d5eeff821..a6cada2476b58406b27e45fff35bced5830e79a1 100644 (file)
@@ -1,4 +1,5 @@
 INCLUDE(CheckCXXSourceCompiles)
+INCLUDE(CheckCXXCompilerFlag)
 INCLUDE(CheckCXXSourceRuns)
 INCLUDE(CheckIncludeFiles)
 
@@ -24,20 +25,16 @@ CHECK_CXX_SOURCE_COMPILES(
 
 # See if there is a compiler flag to enable C++0x features
 # (Only test for -std=c++0x for the moment.)
-
-# Set CMAKE_REQUIRED_FLAGS for the unit tests
-LIST(APPEND CMAKE_REQUIRED_FLAGS "-std=c++0x")
-
-CHECK_CXX_SOURCE_COMPILES(
-  "
-  int main(){ return 0; }
-  "
+CHECK_CXX_COMPILER_FLAG(
+  "-std=c++0x"
   DEAL_II_HAVE_CXX0X_FLAG)
 
 
-
 IF(DEAL_II_HAVE_CXX0X_FLAG)
 
+  # Set CMAKE_REQUIRED_FLAGS for the unit tests
+  LIST(APPEND CMAKE_REQUIRED_FLAGS "-std=c++0x")
+
   CHECK_CXX_SOURCE_COMPILES(
     "
     #include <array>
@@ -189,12 +186,12 @@ IF(DEAL_II_HAVE_CXX0X_FLAG)
     ENDIF()
   ENDIF()
 
+  LIST(REMOVE_ITEM CMAKE_REQUIRED_FLAGS "-std=c++0x")
+
 ELSE()
     MESSAGE(STATUS "Insufficient C++0x support. Disabling -std=c++0x.")
 ENDIF()
 
-LIST(REMOVE_ITEM CMAKE_REQUIRED_FLAGS "-std=c++0x")
-
 
 
 CHECK_CXX_SOURCE_COMPILES(
index 9cb952b7db5883170925c2d11ce83a9932ead0db..97661d72c7483a059e2fd5497aac6d00637f39c1 100644 (file)
@@ -4,7 +4,8 @@ FIND_PACKAGE(MPI REQUIRED CXX)
 
 INCLUDE_DIRECTORIES(${MPI_CXX_INCLUDE_PATH})
 
-LIST(APPEND deal_ii_required_linker_flags ${MPI_CXX_LINK_FLAGS})
+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)
index 107fa36781cf13dfe13377c386ad652431dc612d..962573b1a6183d3bd10c2f8716cd50e1938f14d0 100644 (file)
@@ -8,7 +8,8 @@ INCLUDE(CheckCXXSourceCompiles)
 FIND_PACKAGE(Threads REQUIRED)
 
 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_THREAD_LIBS_INIT}")
-LIST(APPEND deal_ii_required_linker_flags ${CMAKE_THREAD_LIBS_INIT})
+
+SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_THREAD_LIBS_INIT}")
 
 SET(DEAL_II_USE_MT TRUE)
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.