From 924ee9e0d253839ccddc4597d7aa18d891cf2703 Mon Sep 17 00:00:00 2001 From: maier Date: Wed, 16 Jul 2014 21:11:16 +0000 Subject: [PATCH] CMake: Port to version 3.0.0, part 2. This commit removes the testsuite subproject regeneration callback and cleans up the relevant code git-svn-id: https://svn.dealii.org/trunk@33184 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/CMakeLists.txt | 2 +- deal.II/cmake/setup_testsuite.cmake | 166 ---------------------------- deal.II/doc/news/changes.h | 7 ++ deal.II/tests/CMakeLists.txt | 115 +++++++++++++++---- 4 files changed, 103 insertions(+), 187 deletions(-) delete mode 100644 deal.II/cmake/setup_testsuite.cmake diff --git a/deal.II/CMakeLists.txt b/deal.II/CMakeLists.txt index 7c6b852220..7105a28406 100644 --- a/deal.II/CMakeLists.txt +++ b/deal.II/CMakeLists.txt @@ -157,7 +157,7 @@ ADD_SUBDIRECTORY(cmake/config) # has to be included after source ADD_SUBDIRECTORY(contrib) # has to be included after source ADD_SUBDIRECTORY(examples) -INCLUDE(setup_testsuite) +ADD_SUBDIRECTORY(tests) # # And finally, print the configuration: diff --git a/deal.II/cmake/setup_testsuite.cmake b/deal.II/cmake/setup_testsuite.cmake deleted file mode 100644 index 888d32ad28..0000000000 --- a/deal.II/cmake/setup_testsuite.cmake +++ /dev/null @@ -1,166 +0,0 @@ -## --------------------------------------------------------------------- -## $Id$ -## -## Copyright (C) 2013 by the deal.II authors -## -## This file is part of the deal.II library. -## -## The deal.II library is free software; you can use it, redistribute -## it, and/or modify it under the terms of the GNU Lesser General -## Public License as published by the Free Software Foundation; either -## version 2.1 of the License, or (at your option) any later version. -## The full text of the license can be found in the file LICENSE at -## the top level of the deal.II distribution. -## -## --------------------------------------------------------------------- - -# -# This is a bloody hack to avoid a severe performance penalty when using -# 12k top level targets with GNU Make that really does not like that... -# -# The only choice we have is to set up every test subdirectory as an -# independent project. Unfortunately this adds quite a significant amount -# of complexity :-( -# - -# -# Setup the testsuite. -# - -SET_IF_EMPTY(MAKEOPTS $ENV{MAKEOPTS}) - -MESSAGE(STATUS "") -MESSAGE(STATUS "Testsuite will be set up with TEST_DIR=${TEST_DIR}") - -ADD_SUBDIRECTORY( - ${CMAKE_SOURCE_DIR}/tests/quick_tests - ${CMAKE_BINARY_DIR}/tests/quick_tests - ) - -# -# Write a minimalistic CTestTestfile.cmake file to CMAKE_BINARY_DIR and -# CMAKE_BINARY_DIR/tests: -# - -FILE(WRITE ${CMAKE_BINARY_DIR}/CTestTestfile.cmake - "SUBDIRS(tests)" - ) - -FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/tests) -FILE(WRITE ${CMAKE_BINARY_DIR}/tests/CTestTestfile.cmake "") - -# -# Custom targets to set and clean up the testsuite: -# - -# Setup tests: -ADD_CUSTOM_TARGET(setup_tests) - -# Remove all tests: -ADD_CUSTOM_TARGET(prune_tests) - -# Regenerate tests (run "make rebuild_cache" in subprojects): -ADD_CUSTOM_TARGET(regen_tests - COMMAND ${CMAKE_COMMAND} - --build ${CMAKE_BINARY_DIR}/tests --target regen_tests - -- ${MAKEOPTS} - ) - -# Clean all tests -ADD_CUSTOM_TARGET(clean_tests - COMMAND ${CMAKE_COMMAND} - --build ${CMAKE_BINARY_DIR}/tests --target clean_tests - -- ${MAKEOPTS} - ) - -MESSAGE(STATUS "Setting up testsuite") - -# -# Provide custom targets to setup and prune the testsuite subproject: -# - -EXECUTE_PROCESS( - COMMAND ${CMAKE_COMMAND} -G${CMAKE_GENERATOR} - -DTEST_DIR=${TEST_DIR} - ${CMAKE_SOURCE_DIR}/tests - WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/tests - OUTPUT_QUIET - ) - -SET(_options) -LIST(APPEND _options -DDEAL_II_SOURCE_DIR=${CMAKE_SOURCE_DIR}) -LIST(APPEND _options -DDEAL_II_BINARY_DIR=${CMAKE_BINARY_DIR}) -FOREACH(_var - DIFF_DIR - NUMDIFF_DIR - TEST_DIFF - TEST_PICKUP_REGEX - TEST_TIME_LIMIT - MPIEXEC - MPIEXEC_NUMPROC_FLAG - MPIEXEC_PREFLAGS - MPIEXEC_POSTFLAGS - ) - # always undefine: - LIST(APPEND _options "-U${_var}") - IF(DEFINED ${_var}) - LIST(APPEND _options "-D${_var}=${${_var}}") - ENDIF() -ENDFOREACH() - -# -# Glob together a list of all subfolders to set up: -# - -FILE(GLOB _categories RELATIVE ${TEST_DIR} ${TEST_DIR}/*) -SET(_categories all-headers build_tests mesh_converter ${_categories}) -LIST(REMOVE_DUPLICATES _categories) - -# -# Define a subproject for every enabled category: -# - -FOREACH(_category ${_categories}) - IF(EXISTS ${CMAKE_SOURCE_DIR}/tests/${_category}/CMakeLists.txt) - SET(_category_dir ${CMAKE_SOURCE_DIR}/tests/${_category}) - ELSEIF(EXISTS ${TEST_DIR}/${_category}/CMakeLists.txt) - SET(_category_dir ${TEST_DIR}/${_category}) - ELSE() - SET(_category_dir) - ENDIF() - - IF(NOT "${_category_dir}" STREQUAL "") - ADD_CUSTOM_TARGET(setup_tests_${_category} - COMMAND ${CMAKE_COMMAND} -E make_directory - ${CMAKE_BINARY_DIR}/tests/${_category} - COMMAND cd ${CMAKE_BINARY_DIR}/tests/${_category} && - ${CMAKE_COMMAND} -G${CMAKE_GENERATOR} ${_options} ${_category_dir} - > /dev/null - DEPENDS ${_category_dir} - COMMENT "Processing tests/${_category}" - ) - ADD_DEPENDENCIES(setup_tests setup_tests_${_category}) - - ADD_CUSTOM_TARGET(prune_tests_${_category} - COMMAND ${CMAKE_COMMAND} -E remove_directory - ${CMAKE_BINARY_DIR}/tests/${_category} - ) - ADD_DEPENDENCIES(prune_tests prune_tests_${_category}) - - FILE(APPEND ${CMAKE_BINARY_DIR}/tests/CTestTestfile.cmake - "SUBDIRS(${_category})\n" - ) - ENDIF() -ENDFOREACH() -MESSAGE(STATUS "Setting up testsuite - Done") - -MESSAGE(STATUS "Regenerating testsuite subprojects") -EXECUTE_PROCESS( - COMMAND ${CMAKE_COMMAND} - --build ${CMAKE_BINARY_DIR}/tests --target regen_tests - -- ${MAKEOPTS} - OUTPUT_QUIET - ) -MESSAGE(STATUS "Regenerating testsuite subprojects - Done") - -MESSAGE(STATUS "") diff --git a/deal.II/doc/news/changes.h b/deal.II/doc/news/changes.h index 92f4b300a2..367901f0b6 100644 --- a/deal.II/doc/news/changes.h +++ b/deal.II/doc/news/changes.h @@ -40,6 +40,13 @@ inconvenience this causes.

    +
  1. Removed: CMake's configure phase no longer calls back into testsuite + subprojects. If a build directory is reconfigured the testsuite has to be + regenerated by hand using make regen_tests. +
    + (Matthias Maier, 2014/07/16) +
  2. +
  3. Removed: Class PointerMatrixBase (and, consequently, the various classes derived from it) had comparison operators that were intended to work generically for any kind of derived class. However, the implementation diff --git a/deal.II/tests/CMakeLists.txt b/deal.II/tests/CMakeLists.txt index 44787e72f4..0f5a62e17f 100644 --- a/deal.II/tests/CMakeLists.txt +++ b/deal.II/tests/CMakeLists.txt @@ -1,7 +1,7 @@ ## --------------------------------------------------------------------- ## $Id$ ## -## Copyright (C) 2013 by the deal.II authors +## Copyright (C) 2013 - 2014 by the deal.II authors ## ## This file is part of the deal.II library. ## @@ -15,46 +15,121 @@ ## --------------------------------------------------------------------- # -# This is a small project that provides some custom targets that need a -# working, independent subproject because they are called back during -# configure phase. +# Setup the testsuite. +# +# We define toplevel targets: +# setup_tests - set up testsuite subprojects +# regen_tests - rerun configure stage in every testsuite subproject +# clean_tests - run the 'clean' target in every testsuite subproject +# prune_tests - remove all testsuite subprojects # -IF(NOT DEFINED TEST_DIR) - MESSAGE(FATAL_ERROR "\n - The testsuite cannot be set up as an independent project. - Please configure \"deal.II\" directly instead.\n\n" - ) -ENDIF() +SET_IF_EMPTY(MAKEOPTS $ENV{MAKEOPTS}) -CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) -PROJECT(testsuite NONE) +# +# First of all, our quicktests: +# -# Regenerate tests (run "make rebuild_cache" in subprojects): -ADD_CUSTOM_TARGET(regen_tests) +ADD_SUBDIRECTORY(quick_tests) -# Clean all tests -ADD_CUSTOM_TARGET(clean_tests) +# +# Write minimalistic CTestTestfile.cmake files to CMAKE_BINARY_DIR and +# CMAKE_BINARY_DIR/tests: +# + +MESSAGE(STATUS "Testsuite will be set up with TEST_DIR=${TEST_DIR}") +MESSAGE(STATUS "Setting up testsuite") + +FILE(WRITE ${CMAKE_BINARY_DIR}/CTestTestfile.cmake "SUBDIRS(tests)") +FILE(WRITE ${CMAKE_BINARY_DIR}/tests/CTestTestfile.cmake "") + +# +# A config line for tests: +# + +SET(_options "") +LIST(APPEND _options -DDEAL_II_SOURCE_DIR=${CMAKE_SOURCE_DIR}) +LIST(APPEND _options -DDEAL_II_BINARY_DIR=${CMAKE_BINARY_DIR}) +FOREACH(_var + DIFF_DIR NUMDIFF_DIR TEST_DIFF TEST_PICKUP_REGEX TEST_TIME_LIMIT + MPIEXEC MPIEXEC_NUMPROC_FLAG MPIEXEC_PREFLAGS MPIEXEC_POSTFLAGS + ) + ADD_FLAGS(_options "-U${_var}") + IF(DEFINED ${_var}) + ADD_FLAGS(_options "-D${_var}=${${_var}}") + ENDIF() +ENDFOREACH() + +# +# Glob together a list of all subfolders to set up: +# FILE(GLOB _categories RELATIVE ${TEST_DIR} ${TEST_DIR}/*) SET(_categories all-headers build_tests mesh_converter ${_categories}) LIST(REMOVE_DUPLICATES _categories) +# +# Custom targets for the testsuite: +# + +# Setup tests: +ADD_CUSTOM_TARGET(setup_tests) + +# Remove all tests: +ADD_CUSTOM_TARGET(prune_tests) + +# Regenerate tests (run "make rebuild_cache" in subprojects): +ADD_CUSTOM_TARGET(regen_tests) + +# Regenerate tests (run "make clean" in subprojects): +ADD_CUSTOM_TARGET(clean_tests) + FOREACH(_category ${_categories}) - IF( EXISTS ${CMAKE_SOURCE_DIR}/${_category}/CMakeLists.txt OR - EXISTS ${TEST_DIR}/${_category}/CMakeLists.txt ) + IF(EXISTS ${CMAKE_SOURCE_DIR}/tests/${_category}/CMakeLists.txt) + SET(_category_dir ${CMAKE_SOURCE_DIR}/tests/${_category}) + ELSEIF(EXISTS ${TEST_DIR}/${_category}/CMakeLists.txt) + SET(_category_dir ${TEST_DIR}/${_category}) + ELSE() + SET(_category_dir) + ENDIF() + + IF(NOT "${_category_dir}" STREQUAL "") + ADD_CUSTOM_TARGET(setup_tests_${_category} + COMMAND ${CMAKE_COMMAND} -E make_directory + ${CMAKE_BINARY_DIR}/tests/${_category} + COMMAND cd ${CMAKE_BINARY_DIR}/tests/${_category} && + ${CMAKE_COMMAND} -G${CMAKE_GENERATOR} ${_options} ${_category_dir} + > /dev/null + COMMENT "Processing tests/${_category}" + ) + ADD_DEPENDENCIES(setup_tests setup_tests_${_category}) + + ADD_CUSTOM_TARGET(prune_tests_${_category} + COMMAND ${CMAKE_COMMAND} -E remove_directory + ${CMAKE_BINARY_DIR}/tests/${_category} + COMMENT "Processing tests/${_category}" + ) + ADD_DEPENDENCIES(prune_tests prune_tests_${_category}) ADD_CUSTOM_TARGET(regen_tests_${_category} - COMMAND [ ! -d ${_category} ] || ${CMAKE_COMMAND} + COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR}/${_category} --target regenerate + COMMENT "Processing tests/${_category}" ) ADD_DEPENDENCIES(regen_tests regen_tests_${_category}) ADD_CUSTOM_TARGET(clean_tests_${_category} - COMMAND [ ! -d ${_category} ] || ${CMAKE_COMMAND} + COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR}/${_category} --target clean + COMMENT "Processing tests/${_category}" ) ADD_DEPENDENCIES(clean_tests clean_tests_${_category}) + FILE(APPEND ${CMAKE_BINARY_DIR}/tests/CTestTestfile.cmake + "SUBDIRS(${_category})\n" + ) ENDIF() ENDFOREACH() + +MESSAGE(STATUS "Setting up testsuite - Done") + -- 2.39.5