]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Support direct build directory usage
authormaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Sat, 14 Sep 2013 20:04:19 +0000 (20:04 +0000)
committermaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Sat, 14 Sep 2013 20:04:19 +0000 (20:04 +0000)
git-svn-id: https://svn.dealii.org/branches/branch_port_the_testsuite@30704 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/bundled/CMakeLists.txt
deal.II/cmake/config/CMakeLists.txt
deal.II/cmake/config/Make.global_options.in
deal.II/cmake/scripts/CMakeLists.txt
deal.II/cmake/setup_finalize.cmake
deal.II/cmake/setup_post_project_call.cmake
deal.II/source/CMakeLists.txt

index 846b614f2ae08e78d929ecc6e6271264f68c2819..12ee568f59d80646f39ad101fad83f28760713d7 100644 (file)
@@ -35,6 +35,9 @@ IF(FEATURE_BOOST_BUNDLED_CONFIGURED)
     COMPONENT library
     PATTERN ".svn" EXCLUDE
     )
+  FILE(APPEND ${CMAKE_BINARY_DIR}${C\n"MAKE_FILES_DIRECTORY}/deal_ii_source_includes
+    "${BOOST_FOLDER}/include\n"
+    )
 
   ADD_SUBDIRECTORY(${BOOST_FOLDER}/libs/serialization/src)
 
@@ -88,6 +91,9 @@ IF(FEATURE_THREADS_BUNDLED_CONFIGURED)
     FILES_MATCHING PATTERN "*.h"
     PATTERN ".svn" EXCLUDE
     )
+  FILE(APPEND ${CMAKE_BINARY_DIR}${C\n"MAKE_FILES_DIRECTORY}/deal_ii_source_includes
+    "${TBB_FOLDER}/include\n"
+    )
 
   ADD_SUBDIRECTORY(${TBB_FOLDER}/src)
 ENDIF()
index 49f9893e6593e360f80f37bc4584a9c21a284cd7..c5f885b058c9cf19b4813148bb5f5afadc2f39a0 100644 (file)
 ##
 ## ---------------------------------------------------------------------
 
+#
+# This file sets up the project configuration consisting of
+#
+#   Make.global_options (legacy)
+#   deal.IIConfig.cmake
+#   deal.IIVersionConfig.cmake
+#
+# and copies it (a) to the build directory and (b) prepares it for later
+# installation (the copy in CMAKE_CURRENT_BINARY_DIR).
+#
+
+#
+# Read in auxiliary include directories for the build directory
+# configuration:
+#
+FILE(STRINGS
+  ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/deal_ii_source_includes
+  deal_ii_source_includes
+  )
 
 #
 # Configure the template-arguments file
 #
-CONFIGURE_FILE(
+CONFIGURE_FILE( # for binary dir:
+  ${CMAKE_CURRENT_SOURCE_DIR}/template-arguments.in
+  ${CMAKE_BINARY_DIR}/${DEAL_II_COMMON_RELDIR}/template-arguments
+  )
+CONFIGURE_FILE( # for installation:
   ${CMAKE_CURRENT_SOURCE_DIR}/template-arguments.in
   ${CMAKE_CURRENT_BINARY_DIR}/template-arguments
   )
@@ -30,7 +53,13 @@ CONFIGURE_FILE(
 #                                                                      #
 ########################################################################
 
-INSTALL(FILES
+FILE(COPY # for binary dir:
+  ${CMAKE_SOURCE_DIR}/cmake/macros/macro_deal_ii_initialize_cached_variables.cmake
+  ${CMAKE_SOURCE_DIR}/cmake/macros/macro_deal_ii_invoke_autopilot.cmake
+  ${CMAKE_SOURCE_DIR}/cmake/macros/macro_deal_ii_setup_target.cmake
+  DESTINATION ${CMAKE_BINARY_DIR}/${DEAL_II_CMAKE_MACROS_RELDIR}
+  )
+INSTALL(FILES # for installation:
   ${CMAKE_SOURCE_DIR}/cmake/macros/macro_deal_ii_initialize_cached_variables.cmake
   ${CMAKE_SOURCE_DIR}/cmake/macros/macro_deal_ii_invoke_autopilot.cmake
   ${CMAKE_SOURCE_DIR}/cmake/macros/macro_deal_ii_setup_target.cmake
@@ -93,13 +122,32 @@ FOREACH(_build ${DEAL_II_BUILD_TYPES})
     )
 ENDFOREACH()
 
+#
+# For binary dir:
+#
+SET(CONFIG_INCLUDE_DIRS
+  \${DEAL_II_PATH}/\${DEAL_II_INCLUDE_RELDIR}
+  \${DEAL_II_PATH}/\${DEAL_II_INCLUDE_RELDIR}/deal.II
+  ${CMAKE_SOURCE_DIR}/include/
+  ${CMAKE_SOURCE_DIR}/include/deal.II
+  ${deal_ii_source_includes}
+  ${DEAL_II_USER_INCLUDE_DIRS}
+  )
+CONFIGURE_FILE(
+  ${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in
+  ${CMAKE_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}Config.cmake
+  @ONLY
+  )
+
+#
+# For installation:
+#
 SET(CONFIG_INCLUDE_DIRS
   \${DEAL_II_PATH}/\${DEAL_II_INCLUDE_RELDIR}
   \${DEAL_II_PATH}/\${DEAL_II_INCLUDE_RELDIR}/deal.II
   \${DEAL_II_PATH}/\${DEAL_II_INCLUDE_RELDIR}/deal.II/bundled
   ${DEAL_II_USER_INCLUDE_DIRS}
   )
-
 CONFIGURE_FILE(
   ${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in
   ${CMAKE_CURRENT_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_NAME}Config.cmake
@@ -109,22 +157,30 @@ CONFIGURE_FILE(
 #
 # Append feature configuration:
 #
-
-SET(_file ${CMAKE_CURRENT_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_NAME}Config.cmake)
-FILE(APPEND ${_file}
-  "\n\n#\n# Feature configuration:\n#\n\n"
+FOREACH(_file
+  ${CMAKE_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}Config.cmake
+  ${CMAKE_CURRENT_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_NAME}Config.cmake
   )
-GET_CMAKE_PROPERTY(res VARIABLES)
-FOREACH(var ${res})
-  IF(var MATCHES "DEAL_II_WITH")
-    FILE(APPEND ${_file}
-      "SET(${var} ${${var}})\n"
-      )
-  ENDIF()
+  FILE(APPEND ${_file}
+    "\n\n#\n# Feature configuration:\n#\n\n"
+    )
+  GET_CMAKE_PROPERTY(res VARIABLES)
+  FOREACH(var ${res})
+    IF(var MATCHES "DEAL_II_WITH")
+      FILE(APPEND ${_file}
+        "SET(${var} ${${var}})\n"
+        )
+    ENDIF()
+  ENDFOREACH()
 ENDFOREACH()
 
 
-CONFIGURE_FILE(
+CONFIGURE_FILE( # for binary dir:
+  ${CMAKE_CURRENT_SOURCE_DIR}/ConfigVersion.cmake.in
+  ${CMAKE_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}ConfigVersion.cmake
+  @ONLY
+  )
+CONFIGURE_FILE( # for installation:
   ${CMAKE_CURRENT_SOURCE_DIR}/ConfigVersion.cmake.in
   ${CMAKE_CURRENT_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_NAME}ConfigVersion.cmake
   @ONLY
@@ -150,13 +206,6 @@ IF(DEAL_II_COMPONENT_COMPAT_FILES)
   # Transform some cmake lists into a string that the old Makefile
   # mechanism actually understands:
   #
-  TO_STRING_AND_ADD_PREFIX(MAKEFILE_INCLUDE_DIRS "${CMAKE_INCLUDE_FLAG_CXX}"
-    $(D)/${DEAL_II_INCLUDE_RELDIR}
-    $(D)/${DEAL_II_INCLUDE_RELDIR}/deal.II
-    $(D)/${DEAL_II_INCLUDE_RELDIR}/deal.II/bundled
-    ${DEAL_II_USER_INCLUDE_DIRS}
-    ${DEAL_II_INCLUDE_DIRS}
-    )
 
   FOREACH(build ${DEAL_II_BUILD_TYPES})
     TO_STRING_AND_ADD_PREFIX(MAKEFILE_DEFINITIONS_${build}
@@ -241,6 +290,33 @@ IF(DEAL_II_COMPONENT_COMPAT_FILES)
   COND_SET_TO_YES(DEAL_II_WITH_P4EST MAKEFILE_P4EST)
   COND_SET_TO_YES(DEAL_II_WITH_MPI MAKEFILE_MPI)
 
+  #
+  # For binary dir:
+  #
+  TO_STRING_AND_ADD_PREFIX(MAKEFILE_INCLUDE_DIRS "${CMAKE_INCLUDE_FLAG_CXX}"
+    $(D)/${DEAL_II_INCLUDE_RELDIR}
+    $(D)/${DEAL_II_INCLUDE_RELDIR}/deal.II
+    ${CMAKE_SOURCE_DIR}/include/
+    ${CMAKE_SOURCE_DIR}/include/deal.II
+    ${deal_ii_source_includes}
+    ${DEAL_II_USER_INCLUDE_DIRS}
+    )
+  SET(MAKEFILE_D ${CMAKE_BINARY_DIR})
+  CONFIGURE_FILE(
+    ${CMAKE_CURRENT_SOURCE_DIR}/Make.global_options.in
+    ${CMAKE_BINARY_DIR}/${DEAL_II_COMMON_RELDIR}/Make.global_options
+    )
+
+  #
+  # For installation:
+  #
+  TO_STRING_AND_ADD_PREFIX(MAKEFILE_INCLUDE_DIRS "${CMAKE_INCLUDE_FLAG_CXX}"
+    $(D)/${DEAL_II_INCLUDE_RELDIR}
+    $(D)/${DEAL_II_INCLUDE_RELDIR}/deal.II
+    $(D)/${DEAL_II_INCLUDE_RELDIR}/deal.II/bundled
+    ${DEAL_II_USER_INCLUDE_DIRS}
+    )
+  SET(MAKEFILE_D ${CMAKE_INSTALL_PREFIX})
   CONFIGURE_FILE(
     ${CMAKE_CURRENT_SOURCE_DIR}/Make.global_options.in
     ${CMAKE_CURRENT_BINARY_DIR}/Make.global_options
index cc00835e7440e8448ea655089eaae2d4cd6fc3cf..a2cc2fe85468fcd05a80fb0c241a18c585a99545 100644 (file)
@@ -23,7 +23,7 @@
 #
 
 
-D                    = @CMAKE_INSTALL_PREFIX@
+D                    = @MAKEFILE_D@
 CXX                  = @CMAKE_CXX_COMPILER@
 CXX-ID               = @CMAKE_CXX_COMPILER_ID@
 CXX-VERSION          = @CMAKE_CXX_COMPILER_VERSION@
index 99558adce8273d32a7ba8d75836b5f7fd9b74e6e..b29cad8b5de1666225ea09e8622bac9a99de9b27 100644 (file)
 ## ---------------------------------------------------------------------
 
 ADD_EXECUTABLE(expand_instantiations expand_instantiations.cc)
+
+IF(DEAL_II_COMPONENT_COMPAT_FILES)
+  SET_TARGET_PROPERTIES(expand_instantiations
+    PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/common/scripts
+    )
+ENDIF()
+
 IF(NOT CMAKE_CROSSCOMPILING)
   #
   # Export expand_instantiations for use in cross compilation:
@@ -81,6 +88,10 @@ IF(DEAL_II_COMPONENT_COMPAT_FILES)
     ADD_CUSTOM_TARGET(run_report_features COMMAND report_features)
   ENDIF()
 
+  SET_TARGET_PROPERTIES(make_dependencies report_features
+    PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/common/scripts
+    )
+
   INSTALL(TARGETS make_dependencies report_features expand_instantiations
     EXPORT ${DEAL_II_PROJECT_CONFIG_NAME}Targets
     DESTINATION ${DEAL_II_COMMON_RELDIR}/scripts
index a651931f347fa18cf161cb2e85d7ef00fa2fa6a2..c6b2969bd1aa9de34c3bf4d358b3919d1de2153c 100644 (file)
@@ -72,6 +72,17 @@ FOREACH(_build ${DEAL_II_BUILD_TYPES})
     ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/deal_ii_objects_${_build_lowercase}
     )
 ENDFOREACH()
+FILE(WRITE
+  ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/deal_ii_source_includes
+  ""
+  )
+
+#
+# Cleanup deal.IITargets.cmake in the build directory:
+#
+FILE(REMOVE
+  ${CMAKE_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}Targets.cmake
+  )
 
 
 ########################################################################
index 8987b3645a1884a61e1d66daddcdf6c50a8ce94e..d5678c1b03da1b1692bf354e26b8cd186de86d8d 100644 (file)
@@ -51,11 +51,3 @@ IF(CMAKE_CROSSCOMPILING)
     )
   INCLUDE(${DEAL_II_NATIVE}/importExecutables.cmake)
 ENDIF()
-
-
-#
-# Cleanup importTargets.cmake
-#
-FILE(REMOVE
-  ${CMAKE_BINARY_DIR}/importTargets.cmake
-  )
index 0f6b1d0524ce76e145966297ce4ee6afc9a943b9..ab138affb1938af45c15090687262f8b2ceb9abf 100644 (file)
@@ -82,6 +82,9 @@ FOREACH(build ${DEAL_II_BUILD_TYPES})
     COMPILE_DEFINITIONS "${DEAL_II_DEFINITIONS};${DEAL_II_DEFINITIONS_${build}}"
     COMPILE_FLAGS "${DEAL_II_CXX_FLAGS_${build}}"
     INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/${DEAL_II_LIBRARY_RELDIR}"
+    ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
+    LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
+    RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
     )
 
   TARGET_LINK_LIBRARIES(${DEAL_II_BASE_NAME}${DEAL_II_${build}_SUFFIX}
@@ -89,9 +92,11 @@ FOREACH(build ${DEAL_II_BUILD_TYPES})
     ${DEAL_II_EXTERNAL_LIBRARIES}
     )
 
+  FILE(MAKE_DIRECTORY
+    ${CMAKE_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_RELDIR}
+    )
   EXPORT(TARGETS ${DEAL_II_BASE_NAME}${DEAL_II_${build}_SUFFIX}
-    NAMESPACE exported- # Prefix a namespace
-    FILE ${CMAKE_BINARY_DIR}/importTargets.cmake
+    FILE ${CMAKE_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}Targets.cmake
     APPEND
     )
 

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.