From: Matthias Maier Date: Sat, 14 Sep 2013 20:04:19 +0000 (+0000) Subject: Support direct build directory usage X-Git-Tag: v8.1.0~570^2~343 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=28d1f4f1c0cfb8e233ca03ffb0aeb199456b8c4e;p=dealii.git Support direct build directory usage git-svn-id: https://svn.dealii.org/branches/branch_port_the_testsuite@30704 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/bundled/CMakeLists.txt b/deal.II/bundled/CMakeLists.txt index 846b614f2a..12ee568f59 100644 --- a/deal.II/bundled/CMakeLists.txt +++ b/deal.II/bundled/CMakeLists.txt @@ -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() diff --git a/deal.II/cmake/config/CMakeLists.txt b/deal.II/cmake/config/CMakeLists.txt index 49f9893e65..c5f885b058 100644 --- a/deal.II/cmake/config/CMakeLists.txt +++ b/deal.II/cmake/config/CMakeLists.txt @@ -14,11 +14,34 @@ ## ## --------------------------------------------------------------------- +# +# 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 diff --git a/deal.II/cmake/config/Make.global_options.in b/deal.II/cmake/config/Make.global_options.in index cc00835e74..a2cc2fe854 100644 --- a/deal.II/cmake/config/Make.global_options.in +++ b/deal.II/cmake/config/Make.global_options.in @@ -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@ diff --git a/deal.II/cmake/scripts/CMakeLists.txt b/deal.II/cmake/scripts/CMakeLists.txt index 99558adce8..b29cad8b5d 100644 --- a/deal.II/cmake/scripts/CMakeLists.txt +++ b/deal.II/cmake/scripts/CMakeLists.txt @@ -15,6 +15,13 @@ ## --------------------------------------------------------------------- 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 diff --git a/deal.II/cmake/setup_finalize.cmake b/deal.II/cmake/setup_finalize.cmake index a651931f34..c6b2969bd1 100644 --- a/deal.II/cmake/setup_finalize.cmake +++ b/deal.II/cmake/setup_finalize.cmake @@ -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 + ) ######################################################################## diff --git a/deal.II/cmake/setup_post_project_call.cmake b/deal.II/cmake/setup_post_project_call.cmake index 8987b3645a..d5678c1b03 100644 --- a/deal.II/cmake/setup_post_project_call.cmake +++ b/deal.II/cmake/setup_post_project_call.cmake @@ -51,11 +51,3 @@ IF(CMAKE_CROSSCOMPILING) ) INCLUDE(${DEAL_II_NATIVE}/importExecutables.cmake) ENDIF() - - -# -# Cleanup importTargets.cmake -# -FILE(REMOVE - ${CMAKE_BINARY_DIR}/importTargets.cmake - ) diff --git a/deal.II/source/CMakeLists.txt b/deal.II/source/CMakeLists.txt index 0f6b1d0524..ab138affb1 100644 --- a/deal.II/source/CMakeLists.txt +++ b/deal.II/source/CMakeLists.txt @@ -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 )