Commit 52794dc5 authored by Christoph Grüninger's avatar Christoph Grüninger

Merge branch 'feature/use-new-testing' into 'master'

Feature/use new testing

Use dune_add_test which fixes the currently broken configuration.

See merge request !1
parents a145c421 a118e48c
# set up project
project("dune-grid-howto" C CXX)
#circumvent not building docs
set(BUILD_DOCS 1)
project(dune-grid-howto C CXX)
# general stuff
cmake_minimum_required(VERSION 2.8.12)
# guesse dune-common build directory
if(NOT (dune-common_DIR OR dune-common_ROOT OR
"${CMAKE_PREFIX_PATH}" MATCHES ".*dune-common.*"))
string(REPLACE ${CMAKE_PROJECT_NAME} dune-common dune-common_DIR
......@@ -15,9 +11,8 @@ if(NOT (dune-common_DIR OR dune-common_ROOT OR
endif()
#find dune-common and set the module path
find_package(dune-common)
list(APPEND CMAKE_MODULE_PATH ${dune-common_MODULE_PATH}
"${PROJECT_SOURCE_DIR}/cmake/modules")
find_package(dune-common REQUIRED)
list(APPEND CMAKE_MODULE_PATH ${dune-common_MODULE_PATH})
#include the dune macros
include(DuneMacros)
......@@ -25,94 +20,46 @@ include(DuneMacros)
# start a dune project with information from dune.module
dune_project()
add_subdirectory("doc")
add_subdirectory("grids")
set(GRIDTYPE YASPGRID)
set(GRIDDIM 2)
# The directory where the example grid files used for the examples are located
set_property(DIRECTORY APPEND PROPERTY
COMPILE_DEFINITIONS "DUNE_GRID_HOWTO_EXAMPLE_GRIDS_PATH=\"${PROJECT_SOURCE_DIR}/grids/\"")
set(examples_DATA gettingstarted.cc traversal.cc integration.cc othergrids.cc
adaptiveintegration.cc finitevolume.cc adaptivefinitevolume.cc
parfinitevolume.cc visualization.cc finiteelements.cc)
# force that all tests are built
set(DUNE_BUILD_TESTS_ON_MAKE_ALL TRUE)
set(TESTS
adaptivefinitevolume
adaptiveintegration
finiteelements
finitevolume
gettingstarted
integration
othergrids
parfinitevolume
traversal
visualization)
# enable the flags for all third party features found
dune_enable_all_packages()
add_executable(adaptivefinitevolume adaptivefinitevolume.cc)
add_dune_all_flags(adaptivefinitevolume)
dune_add_test(SOURCES adaptivefinitevolume.cc
COMPILE_DEFINITIONS "GRIDDIM=2" "WORLDDIM=2" "YASPGRID")
add_dune_alberta_flags(adaptivefinitevolume WORLDDIM 2)
add_dune_mpi_flags(adaptivefinitevolume)
add_executable(adaptiveintegration adaptiveintegration.cc)
add_dune_all_flags(adaptiveintegration)
add_dune_mpi_flags(adaptiveintegration)
dune_add_test(SOURCES adaptiveintegration.cc
COMPILE_DEFINITIONS "GRIDDIM=2" "WORLDDIM=2" "YASPGRID")
add_executable(finiteelements finiteelements.cc)
add_dune_all_flags(finiteelements)
add_dune_mpi_flags(finiteelements)
dune_add_test(SOURCES finiteelements.cc)
add_executable(finitevolume finitevolume.cc)
add_dune_all_flags(finitevolume)
add_dune_mpi_flags(finitevolume)
dune_add_test(SOURCES finitevolume.cc
COMPILE_DEFINITIONS "GRIDDIM=2" "WORLDDIM=2" "YASPGRID")
add_executable(integration integration.cc)
add_dune_all_flags(integration)
add_dune_mpi_flags(integration)
dune_add_test(SOURCES integration.cc
COMPILE_DEFINITIONS "GRIDDIM=2" "WORLDDIM=2" "YASPGRID")
add_executable(gettingstarted gettingstarted.cc)
add_dune_all_flags(gettingstarted)
add_dune_mpi_flags(gettingstarted)
dune_add_test(SOURCES gettingstarted.cc)
add_executable(othergrids othergrids.cc)
add_dune_all_flags(othergrids)
add_dune_mpi_flags(othergrids)
dune_add_test(SOURCES othergrids.cc)
add_executable(parfinitevolume parfinitevolume.cc)
add_dune_all_flags(parfinitevolume)
add_dune_mpi_flags(parfinitevolume)
dune_add_test(SOURCES parfinitevolume.cc)
add_executable(traversal traversal.cc)
add_dune_all_flags(traversal)
add_dune_mpi_flags(traversal)
dune_add_test(SOURCES traversal.cc)
add_executable(visualization visualization.cc)
add_dune_all_flags(visualization)
add_dune_mpi_flags(visualization)
dune_add_test(SOURCES visualization.cc
COMPILE_DEFINITIONS "GRIDDIM=2" "WORLDDIM=2" "YASPGRID")
set_property(TARGET
adaptivefinitevolume
adaptiveintegration
finitevolume
integration
visualization APPEND
PROPERTY COMPILE_DEFINITIONS "GRIDDIM=${GRIDDIM}" "WORLDDIM=${GRIDDIM}" "${GRIDTYPE}")
# We do not want want to build the tests during make all,
# but just build them on demand
SET(_test_target dune_grid_howto_tests)
add_custom_target(${_test_target})
dune_common_script_dir(SCRIPT_DIR)
configure_file(${SCRIPT_DIR}/BuildTests.cmake.in BuildTests.cmake @ONLY)
add_dependencies(${_test_target} ${TESTS})
foreach(_test ${TESTS})
add_test(${_test} ${_test})
endforeach(_test ${TESTS})
# install the header as done for the auto-tools
add_subdirectory(doc)
add_subdirectory(grids)
# install headers, cc files and executables
install(FILES
basicunitcube.hh
elementdata.hh
......@@ -130,10 +77,27 @@ install(FILES
unitcube_yaspgrid.hh
vertexdata.hh
vtkout.hh
adaptivefinitevolume.cc
adaptivefinitevolume
adaptiveintegration.cc
adaptiveintegration
gettingstarted.cc
gettingstarted
integration.cc
integration
othergrids.cc
othergrids
finiteelements.cc
finiteelements
finitevolume.cc
finitevolume
parfinitevolume.cc
parfinitevolume
traversal.cc
traversal
visualization.cc
visualization
DESTINATION ${CMAKE_INSTALL_DOCDIR}/examples)
install(FILES ${examples_DATA} DESTINATION ${CMAKE_INSTALL_DOCDIR}/examples)
install(TARGETS ${TESTS} DESTINATION ${CMAKE_INSTALL_DOCDIR}/examples)
# finalize the dune project, e.g. generating config.h etc.
finalize_dune_project(GENERATE_CONFIG_H_CMAKE)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment