#
INCLUDE(setup_custom_targets)
+#
+# And finally, print the configuration:
+#
+FILE(READ ${CMAKE_BINARY_DIR}/summary.log DEAL_II_LOG_SUMMARY)
+MESSAGE("${DEAL_II_LOG_SUMMARY}")
+
+++ /dev/null
-# Copyright 2005-2010 Intel Corporation. All Rights Reserved.
-#
-# This file is part of Threading Building Blocks.
-#
-# Threading Building Blocks is free software; you can redistribute it
-# and/or modify it under the terms of the GNU General Public License
-# version 2 as published by the Free Software Foundation.
-#
-# Threading Building Blocks is distributed in the hope that it will be
-# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
-# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with Threading Building Blocks; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-#
-# As a special exception, you may use this file as part of a free software
-# library without restriction. Specifically, if other files instantiate
-# templates or use macros or inline functions from this file, or you compile
-# this file and link it with other files to produce an executable, this
-# file does not by itself cause the resulting executable to be covered by
-# the GNU General Public License. This exception does not however
-# invalidate any other reasons why the executable file might be covered by
-# the GNU General Public License.
-
-tbb_root?=.
-include $(tbb_root)/build/common.inc
-.PHONY: default all tbb tbbmalloc test examples
-
-#workaround for non-depend targets tbb and tbbmalloc which both depend on version_string.tmp
-#According to documentation submakes should run in parallel
-.NOTPARALLEL: tbb tbbmalloc
-
-default: tbb tbbmalloc
-
-all: tbb tbbmalloc test examples
-
-tbb: mkdir
- @$(MAKE) -C "$(work_dir)_debug" -r -f $(tbb_root)/build/Makefile.tbb cfg=debug tbb_root=$(tbb_root)
- @$(MAKE) -C "$(work_dir)_release" -r -f $(tbb_root)/build/Makefile.tbb cfg=release tbb_root=$(tbb_root)
-
-tbbmalloc: mkdir
- @$(MAKE) -C "$(work_dir)_debug" -r -f $(tbb_root)/build/Makefile.tbbmalloc cfg=debug malloc tbb_root=$(tbb_root)
- @$(MAKE) -C "$(work_dir)_release" -r -f $(tbb_root)/build/Makefile.tbbmalloc cfg=release malloc tbb_root=$(tbb_root)
-
-test: tbb tbbmalloc
- -@$(MAKE) -C "$(work_dir)_debug" -r -f $(tbb_root)/build/Makefile.tbbmalloc cfg=debug malloc_test tbb_root=$(tbb_root)
- -@$(MAKE) -C "$(work_dir)_debug" -r -f $(tbb_root)/build/Makefile.test cfg=debug tbb_root=$(tbb_root)
- -@$(MAKE) -C "$(work_dir)_release" -r -f $(tbb_root)/build/Makefile.tbbmalloc cfg=release malloc_test tbb_root=$(tbb_root)
- -@$(MAKE) -C "$(work_dir)_release" -r -f $(tbb_root)/build/Makefile.test cfg=release tbb_root=$(tbb_root)
-
-rml: mkdir
- @$(MAKE) -C "$(work_dir)_debug" -r -f $(tbb_root)/build/Makefile.rml cfg=debug tbb_root=$(tbb_root)
- @$(MAKE) -C "$(work_dir)_release" -r -f $(tbb_root)/build/Makefile.rml cfg=release tbb_root=$(tbb_root)
-
-
-examples: tbb tbbmalloc
- $(MAKE) -C examples -r -f Makefile tbb_root=.. release test
-
-.PHONY: clean clean_examples mkdir info
-
-clean: clean_examples
- $(shell $(RM) $(work_dir)_release$(SLASH)*.* >$(NUL) 2>$(NUL))
- $(shell $(RD) $(work_dir)_release >$(NUL) 2>$(NUL))
- $(shell $(RM) $(work_dir)_debug$(SLASH)*.* >$(NUL) 2>$(NUL))
- $(shell $(RD) $(work_dir)_debug >$(NUL) 2>$(NUL))
- @echo clean done
-
-clean_examples:
- $(shell $(MAKE) -s -i -r -C examples -f Makefile tbb_root=.. clean >$(NUL) 2>$(NUL))
-
-mkdir:
- $(shell $(MD) "$(work_dir)_release" >$(NUL) 2>$(NUL))
- $(shell $(MD) "$(work_dir)_debug" >$(NUL) 2>$(NUL))
- @echo Created $(work_dir)_release and ..._debug directories
-
-info:
- @echo OS: $(tbb_os)
- @echo arch=$(arch)
- @echo compiler=$(compiler)
- @echo runtime=$(runtime)
- @echo tbb_build_prefix=$(tbb_build_prefix)
-
--- /dev/null
+SET(CMAKE_BINARY_DIR "@CMAKE_BINARY_DIR@")
+
+#
+# Clean subdirectories from the generated CMake build system:
+#
+FOREACH(_folder bundled config contrib doc include scripts source)
+ file(GLOB _files_to_remove
+ ${CMAKE_BINARY_DIR}/${_folder}/cmake_install.cmake
+ ${CMAKE_BINARY_DIR}/${_folder}/*/cmake_install.cmake
+ ${CMAKE_BINARY_DIR}/${_folder}/Makefile
+ ${CMAKE_BINARY_DIR}/${_folder}/*/Makefile
+ )
+ EXECUTE_PROCESS(
+ COMMAND ${CMAKE_COMMAND} -E remove ${_files_to_remove}
+ )
+
+ file(GLOB _directories_to_remove
+ ${CMAKE_BINARY_DIR}/${_folder}/CMakeFiles
+ ${CMAKE_BINARY_DIR}/${_folder}/*/CMakeFiles
+ )
+ FOREACH(_dir ${_directories_to_remove})
+ EXECUTE_PROCESS(
+ COMMAND ${CMAKE_COMMAND} -E remove_directory ${_dir}
+ )
+ ENDFOREACH()
+ENDFOREACH()
+
+
+#
+# Remove configured files
+#
+file(GLOB _files_to_remove
+ ${CMAKE_BINARY_DIR}/CMakeCache.txt
+ ${CMAKE_BINARY_DIR}/cmake_install.cmake
+ ${CMAKE_BINARY_DIR}/config/deal.IIConfig.cmake
+ ${CMAKE_BINARY_DIR}/config/deal.IIConfigVersion.cmake
+ ${CMAKE_BINARY_DIR}/config/Make.global_options
+ ${CMAKE_BINARY_DIR}/config/template-arguments
+ ${CMAKE_BINARY_DIR}/distclean.cmake
+ ${CMAKE_BINARY_DIR}/examples/cmake_install.cmake
+ ${CMAKE_BINARY_DIR}/examples/Makefile
+ ${CMAKE_BINARY_DIR}/include/*/base/config.h
+ ${CMAKE_BINARY_DIR}/install_manifest.txt
+ ${CMAKE_BINARY_DIR}/Makefile
+ ${CMAKE_BINARY_DIR}/summary.log
+ )
+EXECUTE_PROCESS(
+ COMMAND ${CMAKE_COMMAND} -E remove ${_files_to_remove}
+ )
+
+#
+# and special folders
+#
+file(GLOB _directories_to_remove
+ ${CMAKE_BINARY_DIR}/bin
+ ${CMAKE_BINARY_DIR}/CMakeFiles
+ ${CMAKE_BINARY_DIR}/common
+ ${CMAKE_BINARY_DIR}/examples/CMakeFiles
+ ${CMAKE_BINARY_DIR}/lib
+ )
+FOREACH(_dir ${_directories_to_remove})
+ EXECUTE_PROCESS(
+ COMMAND ${CMAKE_COMMAND} -E remove_directory ${_dir}
+ )
+ENDFOREACH()
+
# DEAL_II_COMPONENT_CONTRIB
# DEAL_II_COMPONENT_DOCUMENTATION
# DEAL_II_COMPONENT_EXAMPLES
+# CMAKE_INSTALL_PREFIX **)
#
# Options regarding compilation and linking:
#
# DEAL_II_CXX_FLAGS_RELEASE
# DEAL_II_SHARED_LINKER_FLAGS_RELEASE
#
-# *) May also be set via environment variable (CFLAGS, CXXFLAGS, LDFLAGS)
-# (nonempty cached variable has precedence will not be overwritten by
-# environment)
+# *) May also be set via environment variable (CFLAGS, CXXFLAGS, LDFLAGS)
+# (nonempty cached variable has precedence will not be overwritten by
+# environment)
+#
+# **) for an in-source build (and if DISABLE_AUTOPILOT is not set)
#
ON
)
+#
+# Set CMAKE_INSTALL_PREFIX to the source directory if an in source build is
+# detected (and DISABLE_AUTOPILOT is not set)
+#
+IF( "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}" AND
+ NOT DISABLE_AUTOPILOT)
+ SET(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}" CACHE STRING
+ "Install path prefix, prepended onto install directories."
+ )
+ENDIF()
+
###########################################################################
# #
#####
#
-# Setup some convenience custom targets for the build system, i.e.
-#
-# $ make <custom_target>.
-#
-# We add custom targets for building all targets necessary to install a
-# specific component (too bad, we have to do this by hand. There is no cmake
-# internal way to do this, yet...):
-#
-# library, documentation, compat_files
+# Setup some convenience custom targets for the build system:
#
-ADD_CUSTOM_TARGET(library)
+###########################################################################
+# #
+# Custom targets for library, documentation and compat_files components: #
+# #
+###########################################################################
+
+ADD_CUSTOM_TARGET(library)
FOREACH(_build ${DEAL_II_BUILD_TYPES})
ADD_DEPENDENCIES(library ${DEAL_II_BASE_NAME}${DEAL_II_${_build}_SUFFIX})
- IF(_build MATCHES "RELEASE")
- ADD_CUSTOM_TARGET(release
- DEPENDS ${DEAL_II_BASE_NAME}${DEAL_II_${_build}_SUFFIX}
- )
- ELSEIF(_build MATCHES "DEBUG")
- ADD_CUSTOM_TARGET(debug
- DEPENDS ${DEAL_II_BASE_NAME}${DEAL_II_${_build}_SUFFIX}
- )
- ENDIF()
ENDFOREACH()
IF(DEAL_II_COMPONENT_DOCUMENTATION)
)
ENDIF()
+
+###########################################################################
+# #
+# Custom targets for the autopilot mode: #
+# #
+###########################################################################
+
+IF( "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}" AND
+ NOT DISABLE_AUTOPILOT)
+ #
+ # Setup the "distclean" target:
+ #
+ CONFIGURE_FILE(
+ ${CMAKE_SOURCE_DIR}/cmake/distclean.cmake.in
+ ${CMAKE_BINARY_DIR}/distclean.cmake
+ @ONLY)
+ ADD_CUSTOM_TARGET(distclean
+ COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target clean
+ COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}/distclean.cmake
+ )
+
+ #
+ # Targets for changing the build type:
+ #
+ ADD_CUSTOM_TARGET(debug
+ COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Debug ${CMAKE_SOURCE_DIR}
+ COMMENT "Switch CMAKE_BUILD_TYPE to Debug"
+ )
+ ADD_CUSTOM_TARGET(release
+ COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Release ${CMAKE_SOURCE_DIR}
+ COMMENT "Switch CMAKE_BUILD_TYPE to Release"
+ )
+ ADD_CUSTOM_TARGET(debugrelease
+ COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=DebugRelease ${CMAKE_SOURCE_DIR}
+ COMMENT "Switch CMAKE_BUILD_TYPE to DebugRelease"
+ )
+
+ #
+ # A cheesy trick to automatically install and print a summary
+ #
+ ADD_CUSTOM_TARGET("install-intree" ALL
+ COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target install/fast
+ )
+ ADD_DEPENDENCIES(install-intree compat_files)
+ ADD_DEPENDENCIES(install-intree contrib)
+ ADD_DEPENDENCIES(install-intree documentation)
+ ADD_DEPENDENCIES(install-intree library)
+ENDIF()
+
SET(_log "${CMAKE_BINARY_DIR}/summary.log")
FILE(WRITE ${_log}
-"#
-# deal.II configuration:
-#
- CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}
- CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}
- CMAKE_SOURCE_DIR: ${CMAKE_SOURCE_DIR}
- CMAKE_BINARY_DIR: ${CMAKE_BINARY_DIR}\n
- CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION} on platform ${CMAKE_SYSTEM_NAME}
- ${CMAKE_CXX_COMPILER}\n
-Compiler flags used for this build:
- CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}\n"
+"###
+#
+# deal.II configuration:
+#
+# CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}
+# CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}
+# CMAKE_SOURCE_DIR: ${CMAKE_SOURCE_DIR}
+# CMAKE_BINARY_DIR: ${CMAKE_BINARY_DIR}
+# CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION} on platform ${CMAKE_SYSTEM_NAME}
+# ${CMAKE_CXX_COMPILER}
+#
+# Compiler flags used for this build:
+# CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}
+"
)
IF(CMAKE_BUILD_TYPE MATCHES "Release")
- FILE(APPEND ${_log} " DEAL_II_CXX_FLAGS_RELEASE: ${DEAL_II_CXX_FLAGS_RELEASE}\n")
+ FILE(APPEND ${_log} "# DEAL_II_CXX_FLAGS_RELEASE: ${DEAL_II_CXX_FLAGS_RELEASE}\n")
ENDIF()
IF(CMAKE_BUILD_TYPE MATCHES "Debug")
- FILE(APPEND ${_log} " DEAL_II_CXX_FLAGS_DEBUG: ${DEAL_II_CXX_FLAGS_DEBUG}\n")
+ FILE(APPEND ${_log} "# DEAL_II_CXX_FLAGS_DEBUG: ${DEAL_II_CXX_FLAGS_DEBUG}\n")
ENDIF()
-FILE(APPEND ${_log} " CMAKE_SHARED_LINKER_FLAGS: ${CMAKE_SHARED_LINKER_FLAGS}\n")
+FILE(APPEND ${_log} "# CMAKE_SHARED_LINKER_FLAGS: ${CMAKE_SHARED_LINKER_FLAGS}\n")
IF(CMAKE_BUILD_TYPE MATCHES "Release")
- FILE(APPEND ${_log} " DEAL_II_SHARED_LINKER_FLAGS_RELEASE: ${DEAL_II_SHARED_LINKER_FLAGS_RELEASE}\n")
+ FILE(APPEND ${_log} "# DEAL_II_SHARED_LINKER_FLAGS_RELEASE: ${DEAL_II_SHARED_LINKER_FLAGS_RELEASE}\n")
ENDIF()
IF(CMAKE_BUILD_TYPE MATCHES "Debug")
- FILE(APPEND ${_log} " DEAL_II_SHARED_LINKER_FLAGS_DEBUG: ${DEAL_II_SHARED_LINKER_FLAGS_DEBUG}\n")
+ FILE(APPEND ${_log} "# DEAL_II_SHARED_LINKER_FLAGS_DEBUG: ${DEAL_II_SHARED_LINKER_FLAGS_DEBUG}\n")
ENDIF()
IF(FEATURE_UMFPACK_BUNDLED_CONFIGURED)
FILE(APPEND ${_log}
-"\nThe bundled UMFPACK library will be compiled with the following C compiler:
- CMAKE_C_COMPILER: ${CMAKE_C_COMPILER_ID} ${CMAKE_C_COMPILER_VERSION}
- ${CMAKE_C_COMPILER}
- CMAKE_C_FLAGS: ${CMAKE_C_FLAGS}\n"
+"
+#
+# The bundled UMFPACK library will be compiled with the following C compiler:
+# CMAKE_C_COMPILER: ${CMAKE_C_COMPILER_ID} ${CMAKE_C_COMPILER_VERSION}
+# ${CMAKE_C_COMPILER}
+# CMAKE_C_FLAGS: ${CMAKE_C_FLAGS}
+"
)
IF(CMAKE_BUILD_TYPE MATCHES "Release")
- FILE(APPEND ${_log} " DEAL_II_C_FLAGS_RELEASE: ${DEAL_II_C_FLAGS_RELEASE}\n")
+ FILE(APPEND ${_log} "# DEAL_II_C_FLAGS_RELEASE: ${DEAL_II_C_FLAGS_RELEASE}\n")
ENDIF()
IF(CMAKE_BUILD_TYPE MATCHES "Debug")
- FILE(APPEND ${_log} " DEAL_II_C_FLAGS_DEBUG: ${DEAL_II_C_FLAGS_DEBUG}\n")
+ FILE(APPEND ${_log} "# DEAL_II_C_FLAGS_DEBUG: ${DEAL_II_C_FLAGS_DEBUG}\n")
ENDIF()
ENDIF()
IF(NOT DEAL_II_SETUP_DEFAULT_COMPILER_FLAGS)
- FILE(APPEND ${_log} "\nWARNING: DEAL_II_SETUP_DEFAULT_COMPILER_FLAGS is set to OFF\n")
+ FILE(APPEND ${_log} "#\n# WARNING: DEAL_II_SETUP_DEFAULT_COMPILER_FLAGS is set to OFF\n")
ELSEIF(NOT DEAL_II_KNOWN_COMPILER)
- FILE(APPEND ${_log} "\nWARNING: Unknown compiler! Please set compiler flags by hand.\n")
+ FILE(APPEND ${_log} "#\n# WARNING: Unknown compiler! Please set compiler flags by hand.\n")
ENDIF()
FILE(APPEND ${_log}
- "\nConfigured Features:"
+ "#\n# Configured Features:"
)
IF(FORCE_AUTODETECTION)
FILE(APPEND ${_log}
" (DEAL_II_ALLOW_BUNDLED = ${DEAL_II_ALLOW_BUNDLED})"
)
ENDIF()
-
FILE(APPEND ${_log} "\n")
GET_CMAKE_PROPERTY(_res VARIABLES)
IF(_var MATCHES "DEAL_II_WITH")
IF(${${_var}})
# FEATURE is enabled
- STRING(REGEX REPLACE "^DEAL_II_WITH_" "" feature ${_var})
- IF(FEATURE_${feature}_EXTERNAL_CONFIGURED)
- FILE(APPEND ${_log} " ${_var} set up with external dependencies\n")
- ELSEIF(FEATURE_${feature}_BUNDLED_CONFIGURED)
- IF(DEAL_II_FORCE_BUNDLED_${feature})
- FILE(APPEND ${_log} " ${_var} set up with bundled packages (forced)\n")
+ STRING(REGEX REPLACE "^DEAL_II_WITH_" "" _feature ${_var})
+ IF(FEATURE_${_feature}_EXTERNAL_CONFIGURED)
+ FILE(APPEND ${_log} "# ${_var} set up with external dependencies\n")
+ LIST(APPEND _features ${_feature})
+ ELSEIF(FEATURE_${_feature}_BUNDLED_CONFIGURED)
+ LIST(APPEND _features ${_feature})
+ IF(DEAL_II_FORCE_BUNDLED_${_feature})
+ FILE(APPEND ${_log} "# ${_var} set up with bundled packages (forced)\n")
ELSE()
- FILE(APPEND ${_log} " ${_var} set up with bundled packages\n")
+ FILE(APPEND ${_log} "# ${_var} set up with bundled packages\n")
ENDIF()
ENDIF()
ELSE()
# FEATURE is disabled
- FILE(APPEND ${_log} " ( ${_var} = ${${_var}} )\n")
+ FILE(APPEND ${_log} "# ( ${_var} = ${${_var}} )\n")
ENDIF()
ENDIF()
ENDFOREACH()
FILE(APPEND ${_log}
- "\nComponent configuration:\n"
+ "#\n# Component configuration:\n"
)
FOREACH(_var ${_res})
IF(_var MATCHES "DEAL_II_COMPONENT")
IF(${${_var}})
- FILE(APPEND ${_log} " ${_var}\n")
+ FILE(APPEND ${_log} "# ${_var}\n")
+ STRING(REPLACE "DEAL_II_COMPONENT_" "" _component ${_var})
+ LIST(APPEND _components ${_component})
ELSE()
- FILE(APPEND ${_log} " ( ${_var} = ${${_var}} )\n")
+ FILE(APPEND ${_log} "# ( ${_var} = ${${_var}} )\n")
ENDIF()
ENDIF()
ENDFOREACH()
-FILE(READ ${_log} DEAL_II_LOG_SUMMARY)
-MESSAGE("\n\n${DEAL_II_LOG_SUMMARY}\n")
+IF("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
+ TO_STRING(_components ${_components})
+ TO_STRING(_features ${_features})
+
+ IF(DISABLE_AUTOPILOT)
+ FILE(APPEND ${_log} "#\n# Autopilot disabled (DISABLE_AUTOPILOT = ON)\n")
+ ELSE()
+ FILE(APPEND ${_log}
+"#
+###
+
+###
+#
+# !!! In-source build detected. Activating autopilot. !!!
+# (If you do not want this, configure with DISABLE_AUTOPILOT = ON)
+#
+# deal.II configuration (short summary, for the detailed one see above):
+#
+# CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}
+# CMAKE_SOURCE_DIR: ${CMAKE_SOURCE_DIR}
+# CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION} on platform ${CMAKE_SYSTEM_NAME}
+# FEATURES: ${_features}
+# COMPONENTS: ${_components}
+#
+# You can now run
+#
+# $ make - to compile and setup the library in-source
+#
+# $ make debug - to switch the build type to \"Debug\"
+# $ make release - to switch the build type to \"Release\"
+# $ make debugrelease - to switch the build type to \"DebugRelease\"
+# $ make edit_cache - to change the configuration (e.g. select or deselect features)
+# and rerun the configure and generate phases of CMake
+#
+# $ make clean - to remove files generated by the build system
+# $ make distclean - to clean the directory from _all_ generated files
+# (includes clean and the removal of the generated build system)
+#
+# Have a nice day!
+")
+ ENDIF()
+ENDIF()
+
+FILE(APPEND ${_log}
+ "#\n###"
+ )