COMPONENT library
PATTERN ".svn" EXCLUDE
)
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/deal_ii_source_includes
+ "${BOOST_FOLDER}/include\n"
+ )
ADD_SUBDIRECTORY(${BOOST_FOLDER}/libs/serialization/src)
FILES_MATCHING PATTERN "*.h"
PATTERN ".svn" EXCLUDE
)
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/deal_ii_source_includes
+ "${TBB_FOLDER}/include\n"
+ )
ADD_SUBDIRECTORY(${TBB_FOLDER}/src)
ENDIF()
##
## ---------------------------------------------------------------------
+#
+# 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_CURRENT_BINARY_DIR}/template-arguments
+ ${CMAKE_BINARY_DIR}/${DEAL_II_COMMON_RELDIR}/template-arguments
)
# #
########################################################################
-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
)
ENDFOREACH()
-SET(CONFIG_INCLUDE_DIRS
+#
+# For binary dir:
+#
+SET(CONFIG_INCLUDE_DIRS_BINARY
+ \${DEAL_II_PATH}/include
+ \${DEAL_II_PATH}/include/deal.II
+ ${CMAKE_SOURCE_DIR}/include/
+ ${CMAKE_SOURCE_DIR}/include/deal.II
+ ${deal_ii_source_includes}
+ ${DEAL_II_USER_INCLUDE_DIRS}
+ )
+#
+# For installation:
+#
+SET(CONFIG_INCLUDE_DIRS_INSTALLATION
\${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
+ ${CMAKE_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}Config.cmake
@ONLY
)
-
#
# Append feature configuration:
#
-
-SET(_file ${CMAKE_CURRENT_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_NAME}Config.cmake)
+SET(_file
+ ${CMAKE_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}Config.cmake
+ )
FILE(APPEND ${_file}
"\n\n#\n# Feature configuration:\n#\n\n"
)
ENDIF()
ENDFOREACH()
-
CONFIGURE_FILE(
${CMAKE_CURRENT_SOURCE_DIR}/ConfigVersion.cmake.in
- ${CMAKE_CURRENT_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_NAME}ConfigVersion.cmake
+ ${CMAKE_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}ConfigVersion.cmake
@ONLY
)
INSTALL(FILES
- ${CMAKE_CURRENT_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_NAME}Config.cmake
- ${CMAKE_CURRENT_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_NAME}ConfigVersion.cmake
+ ${CMAKE_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}Config.cmake
+ ${CMAKE_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}ConfigVersion.cmake
DESTINATION ${DEAL_II_PROJECT_CONFIG_RELDIR}
COMPONENT library
)
# 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}
COND_SET_TO_YES(DEAL_II_WITH_P4EST MAKEFILE_P4EST)
COND_SET_TO_YES(DEAL_II_WITH_MPI MAKEFILE_MPI)
+ #
+ # For binary dir:
+ #
+ SET(MAKEFILE_D_BINARY ${CMAKE_BINARY_DIR})
+ TO_STRING_AND_ADD_PREFIX(MAKEFILE_INCLUDE_DIRS_BINARY "${CMAKE_INCLUDE_FLAG_CXX}"
+ $(D)/install
+ $(D)/install/deal.II
+ ${CMAKE_SOURCE_DIR}/include/
+ ${CMAKE_SOURCE_DIR}/include/deal.II
+ ${deal_ii_source_includes}
+ ${DEAL_II_USER_INCLUDE_DIRS}
+ )
+ #
+ # For installation:
+ #
+ SET(MAKEFILE_D_INSTALLATION ${CMAKE_INSTALL_PREFIX})
+ TO_STRING_AND_ADD_PREFIX(MAKEFILE_INCLUDE_DIRS_INSTALLATION "${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}
+ )
CONFIGURE_FILE(
${CMAKE_CURRENT_SOURCE_DIR}/Make.global_options.in
- ${CMAKE_CURRENT_BINARY_DIR}/Make.global_options
+ ${CMAKE_BINARY_DIR}/${DEAL_II_COMMON_RELDIR}/Make.global_options
)
INSTALL(FILES
- ${CMAKE_CURRENT_BINARY_DIR}/template-arguments
- ${CMAKE_CURRENT_BINARY_DIR}/Make.global_options
+ ${CMAKE_BINARY_DIR}/${DEAL_II_COMMON_RELDIR}/template-arguments
+ ${CMAKE_BINARY_DIR}/${DEAL_II_COMMON_RELDIR}/Make.global_options
DESTINATION ${DEAL_II_COMMON_RELDIR}
COMPONENT compat_files
)
ENDIF()
+#
+# Finally, add a target to create the "binary" file in
+# ${DEAL_II_PROJECT_CONFIG_RELDIR} and add it to the library target:
+#
+ADD_CUSTOM_TARGET(setup_build_dir ALL
+ COMMAND ${CMAKE_COMMAND} -E touch
+ ${CMAKE_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_RELDIR}/binary
+ COMMAND ${CMAKE_COMMAND} -E touch
+ ${CMAKE_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}Config.cmake
+ )
+ADD_DEPENDENCIES(library setup_build_dir)
+
+#
+# And a script to remove it upon installation from the install prefix:
+#
+INSTALL(CODE
+ "
+ FILE(REMOVE ${CMAKE_INSTALL_PREFIX}/${DEAL_II_PROJECT_CONFIG_RELDIR}/binary)
+ EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E touch
+ ${CMAKE_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}Config.cmake
+ )
+ "
+ COMPONENT library
+ )
GET_FILENAME_COMPONENT(_path "${_path}" PATH)
ENDWHILE()
+#
+# Is this project reside in a build directory or at an installed location?
+#
+
+IF(EXISTS ${DEAL_II_PATH}/${DEAL_II_PROJECT_CONFIG_RELDIR}/binary)
+ SET(DEAL_II_BUILD_DIR TRUE)
+ENDIF()
+
#
# Print a message after inclusion of this file:
#
SET(DEAL_II_PROJECT_CONFIG_INCLUDED TRUE)
IF(NOT ${DEAL_II_PACKAGE_NAME}_FIND_QUIETLY)
- MESSAGE(STATUS
- "Using the ${DEAL_II_PACKAGE_NAME}-${DEAL_II_PACKAGE_VERSION} installation found at ${DEAL_II_PATH}"
- )
+ IF(DEAL_II_BUILD_DIR)
+ MESSAGE(STATUS
+ "Using the ${DEAL_II_PACKAGE_NAME}-${DEAL_II_PACKAGE_VERSION} build directory found at ${DEAL_II_PATH}"
+ )
+ ELSE()
+ MESSAGE(STATUS
+ "Using the ${DEAL_II_PACKAGE_NAME}-${DEAL_II_PACKAGE_VERSION} installation found at ${DEAL_II_PATH}"
+ )
+ ENDIF()
ENDIF()
#
# Information about include directories and libraries
#
-
-SET(DEAL_II_INCLUDE_DIRS "@CONFIG_INCLUDE_DIRS@")
+IF(DEAL_II_BUILD_DIR)
+ SET(DEAL_II_INCLUDE_DIRS "@CONFIG_INCLUDE_DIRS_BINARY@")
+ELSE()
+ SET(DEAL_II_INCLUDE_DIRS "@CONFIG_INCLUDE_DIRS_INSTALLATION@")
+ENDIF()
# Full list of libraries for the debug target:
SET(DEAL_II_LIBRARIES_DEBUG "@CONFIG_LIBRARIES_DEBUG@")
# Information about library targets
#
-SET(DEAL_II_TARGET_CONFIG "${DEAL_II_PATH}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}Targets.cmake")
+IF(DEAL_II_BUILD_DIR)
+ SET(DEAL_II_TARGET_CONFIG "${DEAL_II_PATH}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}BuildTargets.cmake")
+ELSE()
+ SET(DEAL_II_TARGET_CONFIG "${DEAL_II_PATH}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}Targets.cmake")
+ENDIF()
# The Debug target:
SET(DEAL_II_TARGET_DEBUG "@CONFIG_TARGET_DEBUG@")
#
-D = @CMAKE_INSTALL_PREFIX@
+ifeq ($(wildcard $(D)/@DEAL_II_PROJECT_CONFIG_RELDIR@/binary),)
+ D = @MAKEFILE_D_INSTALLATION@
+else
+ D = @MAKEFILE_D_BINARY@
+endif
+
CXX = @CMAKE_CXX_COMPILER@
CXX-ID = @CMAKE_CXX_COMPILER_ID@
CXX-VERSION = @CMAKE_CXX_COMPILER_VERSION@
# Include paths as command line flags
-INCLUDE = @MAKEFILE_INCLUDE_DIRS@
+ifeq ($(wildcard $(D)/@DEAL_II_PROJECT_CONFIG_RELDIR@/binary),)
+ INCLUDE = @MAKEFILE_INCLUDE_DIRS_INSTALLATION@
+else
+ INCLUDE = @MAKEFILE_INCLUDE_DIRS_BINARY@
+endif
# compiler flags for debug and optimized mode
MACRO(EXPAND_INSTANTIATIONS _target _inst_in_files)
- IF(CMAKE_CROSSCOMPILING)
- SET(_ei_exec native-expand_instantiations)
- ELSE()
- SET(_ei_exec expand_instantiations)
- ENDIF()
-
FOREACH (_inst_in_file ${_inst_in_files})
STRING(REGEX REPLACE "\\.in$" "" _inst_file "${_inst_in_file}" )
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_inst_file}
- DEPENDS ${_ei_exec}
+ DEPENDS expand_instantiations
${CMAKE_BINARY_DIR}/cmake/config/template-arguments
${CMAKE_CURRENT_SOURCE_DIR}/${_inst_in_file}
- COMMAND ${_ei_exec}
+ COMMAND expand_instantiations
ARGS ${CMAKE_BINARY_DIR}/cmake/config/template-arguments
< ${CMAKE_CURRENT_SOURCE_DIR}/${_inst_in_file}
> ${CMAKE_CURRENT_BINARY_DIR}/${_inst_file}
##
## ---------------------------------------------------------------------
-ADD_EXECUTABLE(expand_instantiations expand_instantiations.cc)
IF(NOT CMAKE_CROSSCOMPILING)
- #
- # Export expand_instantiations for use in cross compilation:
- #
+ 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
+ )
+ INSTALL(TARGETS expand_instantiations
+ EXPORT ${DEAL_II_PROJECT_CONFIG_NAME}Targets
+ DESTINATION ${DEAL_II_COMMON_RELDIR}/scripts
+ COMPONENT compat_files
+ )
+ ENDIF()
+
EXPORT(TARGETS expand_instantiations
- FILE ${CMAKE_CURRENT_BINARY_DIR}/importExecutables.cmake
- NAMESPACE native- # Prefix a namespace
+ FILE ${CMAKE_BINARY_DIR}/importExecutables.cmake
)
ENDIF()
# Build and install the old dependency_resolution and report_features
# executables:
#
+
INCLUDE_DIRECTORIES(
BEFORE # Ensure deal.II include directories come first
- ${CMAKE_BINARY_DIR}/include/
+ #
+ # Reverse order due to BEFORE:
+ #
${CMAKE_SOURCE_DIR}/include/
+ ${CMAKE_BINARY_DIR}/include/
)
ADD_EXECUTABLE(make_dependencies make_dependencies.cc)
ADD_CUSTOM_TARGET(run_report_features COMMAND report_features)
ENDIF()
- INSTALL(TARGETS make_dependencies report_features expand_instantiations
+ SET_TARGET_PROPERTIES(make_dependencies report_features
+ PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/common/scripts
+ )
+
+ INSTALL(TARGETS make_dependencies report_features
EXPORT ${DEAL_II_PROJECT_CONFIG_NAME}Targets
DESTINATION ${DEAL_II_COMMON_RELDIR}/scripts
COMPONENT compat_files
${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}BuildTargets.cmake
+ )
########################################################################
SET(DEAL_II_NATIVE "DEAL_II_NATIVE-NOTFOUND" CACHE FILEPATH
"A pointer to a native deal.Ii build directory"
)
- INCLUDE(${DEAL_II_NATIVE}/cmake/scripts/importExecutables.cmake)
+ IF(DEAL_II_NATIVE MATCHES "-NOTFOUND")
+ MESSAGE(FATAL_ERROR
+ "Please set the CMake variable DEAL_II_NATIVE to a valid path that points to a native deal.II build directory"
+ )
+ ENDIF()
+ INCLUDE(${DEAL_II_NATIVE}/importExecutables.cmake)
ENDIF()
<h3>Specific improvements</h3>
<ol>
+ <li>
+ Enhancement: It is now possible to use the build directory directly without
+ the need to install first. For this, a second copy of all necessary project
+ configuration files (deal.IIConfig.cmake, ..., Make.global_options) are
+ generated and deployed in the build directory. (This is fully compatible with
+ the old possibility to install into the build dir.)
+ <br>
+ (Matthias Maier, 2013/09/15)
+ </li>
+
<li>
Fixed: DoFTools::extract_locally_*_dofs now instantiated for hp::DofHandler.
<br>
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}
${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}
+ FILE ${CMAKE_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}BuildTargets.cmake
+ APPEND
+ )
+
INSTALL(TARGETS ${DEAL_II_BASE_NAME}${DEAL_II_${build}_SUFFIX}
EXPORT ${DEAL_II_PROJECT_CONFIG_NAME}Targets
DESTINATION ${DEAL_II_LIBRARY_RELDIR}