Commit 080baf66 authored by Christoph Grueninger's avatar Christoph Grueninger
Browse files

[CMake] Build tests in test/common.

git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@10750 2fb0f335-1f38-0410-981e-8018bf24f1b0
parent a91f61b6
......@@ -23,85 +23,9 @@ add_subdirectory("tutorial")
# finalize the dune project, e.g. generating config.h etc.
finalize_dune_project(GENERATE_CONFIG_H_CMAKE)
message("<<<< DUNE_GRID_VERSION: ${DUNE_GRID_VERSION}")
# ##############
# # general stuff
# cmake_minimum_required(VERSION 2.8)
# set(ProjectName "DuMuX")
# set(ProjectVersion "2.4-svn")
# set(ProjectMaintainer "DuMuX")
# set(ProjectMaintainerEmail "dumux@listserv.uni-stuttgart.de")
# project(${ProjectName} CXX)
# # needed for tests like pthread and BLAS
# enable_language(C)
#
# ##############
# # make sure our own modules will be found
# set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules")
#
# ##############
# # Set the policy how CMake resolves library paths to the
# # policy introduced by CMake 2.6 (this does not apply for
# # CMake 2.4 and below, of course). For details, see
# # http://www.cmake.org/cmake/help/cmake-2.6.html#policy:CMP0003
# if(COMMAND cmake_policy)
# cmake_policy(SET CMP0003 NEW)
# endif(COMMAND cmake_policy)
#
# ##############
# # Find the required packages
# find_package(DUNE_common REQUIRED)
# find_package(DUNE_geometry REQUIRED)
# find_package(DUNE_grid REQUIRED)
# find_package(DUNE_istl REQUIRED)
# find_package(DUNE_localfunctions REQUIRED)
#
# ##############
# # Find the optional packages
# find_package(DUNE_pdelab)
# find_package(MPI)
# find_package(Boost)
# find_package(Alberta)
# find_package(UG)
# find_package(ALUGrid)
# find_package(METIS)
# find_package(SuperLU)
#
# ##############
# # Find the required include files
# include(CheckIncludeFile)
# include(CheckIncludeFileCXX)
# check_include_file("malloc.h" HAVE_MALLOC_H)
# check_include_file("valgrind/memcheck.h" HAVE_VALGRIND)
# check_include_file_cxx("memory" HAVE_MEMORY)
# check_include_file_cxx("tr1/array" HAVE_TR1_ARRAY)
# check_include_file_cxx("tr1/memory" HAVE_TR1_MEMORY)
#
# ##############
# # determine C++11 (former C++0x) feature support
# set(CMAKE_REQUIRED_FLAGS "-std=c++0x")
#
# include(CheckCXXSourceCompiles)
#
# # nullptr
# CHECK_CXX_SOURCE_COMPILES(
# " int main(void) {
# char* ch = nullptr;
# return 0; }
# " HAVE_NULLPTR
# )
#
# # tuple
# CHECK_CXX_SOURCE_COMPILES(
# " #include <tuple>
# int main(void) {
# return 0; }
# " HAVE_TUPLE
# )
#
# # constexpr
# CHECK_CXX_SOURCE_COMPILES(
# " int main(void) {
......@@ -110,19 +34,6 @@ finalize_dune_project(GENERATE_CONFIG_H_CMAKE)
# " HAVE_CONSTEXPR
# )
#
# # array and fill
# # CHECK_CXX_SOURCE_COMPILES("
# # #include <array>
# #
# # int main(void)
# # {
# # std::array<int,2> a;
# # a.fill(9);
# # return 0;
# # }
# # " HAVE_ARRAY
# # ) # commented out due to a bug in dune-common <= 2.1.1
#
# # __attribute__((always_inline))
# CHECK_CXX_SOURCE_COMPILES(
# "
......@@ -130,168 +41,9 @@ finalize_dune_project(GENERATE_CONFIG_H_CMAKE)
# int main(void) { foo(); return 0; };
# " HAVE_ATTRIBUTE_ALWAYS_INLINE
# )
#
# # __attribute__((unused))
# CHECK_CXX_SOURCE_COMPILES(
# "
# int main(void) { int __attribute__((unused)) foo; return 0; };
# " HAS_ATTRIBUTE_UNUSED
# )
#
# # __attribute__((deprecated))
# CHECK_CXX_SOURCE_COMPILES(
# "
# #define DEP __attribute__((deprecated))
# class bar { bar() DEP; };
# class peng { } DEP;
# template <class T>
# class t_bar { t_bar() DEP; };
# template <class T>
# class t_peng { t_peng() {}; } DEP;
# void foo() DEP;
# void foo() {};
# int main(void) { return 0; };
# " HAS_ATTRIBUTE_DEPRECATED
# )
#
# # __attribute__((deprecated("msg")))
# CHECK_CXX_SOURCE_COMPILES("
# #define DEP __attribute__((deprecated(\"message\")))
# class bar { bar() DEP; };
# class peng { } DEP;
# template <class T>
# class t_bar { t_bar() DEP; };
# template <class T>
# class t_peng { t_peng() {}; } DEP;
# void foo() DEP;
# void foo() {};
# int main(void) { return 0; };
# " HAS_ATTRIBUTE_DEPRECATED_MSG
# )
#
# # static assert
# CHECK_CXX_SOURCE_COMPILES("
# int main(void) {
# static_assert(true,\"MSG\");
# return 0; }
# " HAVE_STATIC_ASSERT
# )
#
# # variadic template support
# CHECK_CXX_SOURCE_COMPILES("
# #include <cassert>
#
# template<typename... T>
# int addints(T... x);
#
# int add_ints()
# {
# return 0;
# }
#
# template<typename T1, typename... T>
# int add_ints(T1 t1, T... t)
# {
# return t1 + add_ints(t...);
# }
#
# int main(void)
# {
# assert( 5 == add_ints(9,3,-5,-2) );
# return 0;
# }
# " HAVE_VARIADIC_TEMPLATES
# )
#
# # SFINAE on variadic template constructors within template classes
# CHECK_CXX_SOURCE_COMPILES("
# #include <functional>
#
# template<typename... U>
# struct A
# {
# template<typename... T,
# typename = typename std::enable_if<(sizeof...(T) < 2)>::type
# >
# A(T... t)
# : i(1)
# {}
#
# template<typename... T,
# typename = typename std::enable_if<(sizeof...(T) >= 2)>::type,
# typename = void
# >
# A(T... t)
# : i(-1)
# {}
#
# A()
# : i(1)
# {}
#
# int i;
# };
#
# int main(void)
# {
# return (A<int>().i + A<int>(2).i + A<int>("foo",3.4).i + A<int>(8,'a',A<int>()).i == 0 ? 0 : 1);
# }
# " HAVE_VARIADIC_CONSTRUCTOR_SFINAE
# )
#
# # rvalue references
# CHECK_CXX_SOURCE_COMPILES("
# #include <cassert>
# #include <utility>
# int foo(int&& x) { return 1; }
# int foo(const int& x) { return -1; }
#
# template<typename T>
# int forward(T&& x)
# {
# return foo(std::forward<T>(x));
# }
#
# int main(void)
# {
# int i = 0;
# assert( forward(i) + forward(int(2)) == 0);
# return 0;
# }
# " HAVE_RVALUE_REFERENCES
# )
#
# find_package(SharedPtr)
#
# ##############
# # use this macros in the CMakelists of the subdirectories.
#
# # -> for TARGET_LINK_LIBRARIES
# set(DumuxLinkLibraries
# # "dumux" # the DUMUX library. CMake replaces this by the proper file location
# ${DUNE_common_LIBRARIES}
# ${DUNE_geometry_LIBRARIES}
# ${DUNE_grid_LIBRARIES}
# ${DUNE_mux_LIBRARIES}
# "-lm -fprofile-arcs -ftest-coverage")
#
# # -> for INCLUDE_DIRECTORIES
# set(DumuxIncludeDirectories
# ${CMAKE_CURRENT_BINARY_DIR}
# ${CMAKE_SOURCE_DIR}
# ${DUNE_grid_INCLUDE_DIRS}
# ${DUNE_geometry_INCLUDE_DIRS}
# ${DUNE_common_INCLUDE_DIRS}
# ${DUNE_istl_INCLUDE_DIRS}
# ${DUNE_localfunctions_INCLUDE_DIRS}
# ${DUNE_pdelab_INCLUDE_DIRS})
#
# if(BOOST_FOUND)
# set(DumuxLinkDirectories "${DumuxLinkDirectories} ${Boost_LIBRARY_DIRS}")
# set(DumuxLinkLibraries "${DumuxLinkLibraries} ${Boost_LIBRARIES}")
# set(DumuxIncludeDirectories "${DumuxIncludeDirectories} ${Boost_INCLUDE_DIR}")
# endif(BOOST_FOUND)
#
# ##############
# # Check for patched DUNE-PDELab
# include(CMakePushCheckState)
......@@ -312,119 +64,8 @@ finalize_dune_project(GENERATE_CONFIG_H_CMAKE)
# " DUNE_PDELAB_IS_PATCHED_FOR_DUMUX
# )
# cmake_pop_check_state()
#
# ##############
# # set appropriate compiler flags for debug/release compilation modes
# add_definitions("-std=c++0x -Wall -Wno-sign-compare -fno-strict-aliasing -DUSE_AMGBACKEND")
#
# if(("${CMAKE_BUILD_TYPE}" STREQUAL "debug") OR (NOT (DEFINED "${CMAKE_BUILD_TYPE}")))
# add_definitions(-DNDEBUG)
# # debug mode
# add_definitions("-g -O0 -fprofile-arcs -ftest-coverage")
# # add_definitions(-DDEBUG -DDUNE_DEVEL_MODE=1 -DDUNE_ISTL_WITH_CHECKING)
# else()
# # Release mode
# add_definitions("-O3 -march=native")
# endif( )
#
# ##############
# # deal with the config.h include file...
# macro(SetConfigHVar ConfigHName CMakeName)
# if(${CMakeName})
# set(${ConfigHName} ${${CMakeName}})
# else(${CMakeName})
# set(${ConfigHName} 0)
# endif(${CMakeName})
# endmacro(SetConfigHVar)
#
# SetConfigHVar(HAVE_BOOST Boost_FOUND)
# SetConfigHVar(HAVE_DUNE DUNE_common_FOUND)
# SetConfigHVar(HAVE_DUNE_GRID DUNE_grid_FOUND)
# SetConfigHVar(HAVE_DUNE_ISTL DUNE_istl_FOUND)
# SetConfigHVar(HAVE_DUNE_LOCALFUNCTIONS DUNE_localfunctions_FOUND)
# SetConfigHVar(HAVE_DUNE_PDELAB DUNE_pdelab_FOUND)
# SetConfigHVar(HAVE_MPI MPI_FOUND)
# SetConfigHVar(HAVE_SUPERLU SUPERLU_FOUND)
# SetConfigHVar(PROJECT_NAME ProjectName)
# SetConfigHVar(PROJECT_VERSION ProjectVersion)
# SetConfigHVar(PROJECT_MAINTAINER ProjectMaintainer)
# SetConfigHVar(PROJECT_MAINTAINER_EMAIL ProjectMaintainerEmail)
# ##############
#
# ##############
# # add dune-common version from dune.module to config.h
# if(DUNE_common_DIR)
# file(READ "${DUNE_common_DIR}/dune.module" DUNE_COMMON_MODULE)
# else()
# file(READ "${DUNE_DIR}/dune-common/dune.module" DUNE_COMMON_MODULE)
# endif(DUNE_common_DIR)
#
# # find version string
# string(REGEX REPLACE ".*Version:[ ]*([^ \n]+).*" "\\1" DUNE_COMMON_VERSION "${DUNE_COMMON_MODULE}")
# string(REGEX REPLACE "([0-9]).*" "\\1" DUNE_COMMON_VERSION_MAJOR "${DUNE_COMMON_VERSION}")
# string(REGEX REPLACE "[0-9]*\\.([0-9]).*" "\\1" DUNE_COMMON_VERSION_MINOR "${DUNE_COMMON_VERSION}")
# string(REGEX REPLACE "[0-9]*\\.[0-9]*\\.([0-9]).*" "\\1" DUNE_COMMON_VERSION_REVISION "${DUNE_COMMON_VERSION}")
#
# # remove false matches
# string(REGEX MATCH "[^0-9]" NON_NUMBER_CHARACTER "${DUNE_COMMON_VERSION_MINOR}")
# if(NON_NUMBER_CHARACTER)
# set(DUNE_COMMON_VERSION_MINOR "0")
# endif(NON_NUMBER_CHARACTER)
# string(REGEX MATCH "[^0-9]" NON_NUMBER_CHARACTER "${DUNE_COMMON_VERSION_REVISION}")
# if(NON_NUMBER_CHARACTER)
# set(DUNE_COMMON_VERSION_REVISION "0")
# endif(NON_NUMBER_CHARACTER)
# ##############
#
# ##############
# # adapt build system to detected packages
#
# # deal with UG
# if(UG_FOUND)
# set(UG_CPPFLAGS "-I${UG_INCLUDE_DIRS} -DENABLE_UG=1")
# set(UG_LIBS "-L. ${UG_LIBRARIES}")
# set(HAVE_UG "ENABLE_UG")
# else(UG_FOUND)
# set(HAVE_UG 0)
# endif(UG_FOUND)
#
# # deal with ALUGrid
# if(ALUGrid_FOUND)
# add_definitions(-DENABLE_ALUGRID=1)
# set(DumuxIncludeDirectories ${DumuxIncludeDirectories} ${ALUGrid_INCLUDE_DIRS})
# set(DumuxLinkLibraries ${DumuxLinkLibraries} ${ALUGrid_LIBRARIES})
# endif(ALUGrid_FOUND)
# SetConfigHVar(HAVE_ALUGRID ALUGrid_FOUND)
#
# # deal with Alberta
# if(Alberta_FOUND)
# set(DumuxIncludeDirectories ${DumuxIncludeDirectories} ${Alberta_INCLUDE_DIRS})
# set(DumuxLinkLibraries ${DumuxLinkLibraries} ${Alberta_LIBRARIES})
# endif(Alberta_FOUND)
# SetConfigHVar(HAVE_ALBERTA Alberta_FOUND)
#
# # deal with METIS
# if(METIS_FOUND)
# set(DumuxIncludeDirectories ${DumuxIncludeDirectories} ${METIS_INCLUDE_DIRS})
# set(DumuxLinkLibraries ${DumuxLinkLibraries} ${METIS_LIBRARIES})
# endif(METIS_FOUND)
# SetConfigHVar(HAVE_METIS METIS_FOUND)
# ##############
#
# if(MPI_FOUND)
# set(TMP ${MPI_COMPILE_FLAGS})
# separate_arguments(TMP)
# add_definitions(${TMP})
# add_definitions(-DENABLE_MPI=1)
# # add_definitions(-DModelP) # tell UG that the model is parallelized
# set(DumuxLinkLibraries ${DumuxLinkLibraries} ${MPI_LIBRARIES})
# set(DumuxIncludeDirectories ${DumuxIncludeDirectories} ${MPI_INCLUDE_PATH})
# endif(MPI_FOUND)
#
# # actually write the config.h file to disk
# configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h )
# #add_definitions(-DHAVE_CONFIG_H)
#
# ##############
# # tell cmake that we've got a few subdirectories. (that's the
# # directories where the actual programs are)
......
......@@ -6,7 +6,7 @@
/* begin private */
/* Name of package */
#define PACKAGE "@DUNE_MOD_NAME"
#define PACKAGE "@DUNE_MOD_NAME@"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "@DUNE_MAINTAINER@"
......
add_subdirectory("implicit")
add_subdirectory("common")
add_subdirectory("decoupled")
add_subdirectory("freeflow")
add_subdirectory("implicit")
add_subdirectory("material")
# build target for the simple twophase lens problem in a general definition for both box and decoupled model
# build target for the simple twophase lens problem in a general
# definition for both box and decoupled model
add_executable("test_generalproblem2p" test_generalproblem2p.cc)
target_link_libraries("test_generalproblem2p" ${DumuxLinkLibraries})
# add required libraries and includes to the build flags
link_directories(${DumuxLinkDirectories})
include_directories(${DumuxIncludeDirectories})
set(NORMALTESTS test_generalproblem2p)
set(ALLTESTS ${NORMALTESTS})
# We do not want want to build the tests during make all,
# but just build them on demand
add_directory_test_target(_test_target)
add_dependencies(${_test_target} ${ALLTESTS})
foreach(_exe ${ALLTESTS})
target_link_libraries(${_exe} ${DUNE_LIBS})
add_test(${_exe} ${_exe})
endforeach(_exe ${ALLTESTS})
\ No newline at end of file
# build the test for the property system
add_executable("test_propertysystem" test_propertysystem.cc)
target_link_libraries("test_propertysystem" ${DumuxLinkLibraries})
# add required libraries and includes to the build flags
link_directories(${DumuxLinkDirectories})
include_directories(${DumuxIncludeDirectories})
set(NORMALTESTS test_propertysystem)
set(ALLTESTS ${NORMALTESTS})
# We do not want want to build the tests during make all,
# but just build them on demand
add_directory_test_target(_test_target)
add_dependencies(${_test_target} ${ALLTESTS})
foreach(_exe ${ALLTESTS})
target_link_libraries(${_exe} ${DUNE_LIBS})
add_test(${_exe} ${_exe})
endforeach(_exe ${ALLTESTS})
\ No newline at end of file
# add build targets
add_executable("test_spline" test_spline.cc)
target_link_libraries("test_spline" ${DumuxLinkLibraries})
# add required libraries and includes to the build flags
link_directories(${DumuxLinkDirectories})
include_directories(${DumuxIncludeDirectories})
set(NORMALTESTS test_spline)
set(ALLTESTS ${NORMALTESTS})
# We do not want want to build the tests during make all,
# but just build them on demand
add_directory_test_target(_test_target)
add_dependencies(${_test_target} ${ALLTESTS})
foreach(_exe ${ALLTESTS})
target_link_libraries(${_exe} ${DUNE_LIBS})
add_test(${_exe} ${_exe})
endforeach(_exe ${ALLTESTS})
Supports Markdown
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