Commit 7aef2864 authored by Praetorius, Simon's avatar Praetorius, Simon

Merge branch 'issue/cmake_2-8-10' into 'master'

Issue/cmake 2 8 10

Rewritten the cmake configuration for cmake version 2.8.10 in the same style as cmake 3.0 variant

See merge request !11
parents 1efa4a14 7d4dfda1
## This file should be placed in the root directory of your project.
## Then modify the CMakeLists.txt file in the root directory of your
## project to incorporate the testing dashboard.
##
## # The following are required to submit to the CDash dashboard:
## ENABLE_TESTING()
## INCLUDE(CTest)
set(CTEST_PROJECT_NAME "AMDiS")
set(CTEST_NIGHTLY_START_TIME "00:00:00 EST")
set(CTEST_DROP_METHOD "http")
set(CTEST_DROP_SITE "my.cdash.org")
set(CTEST_DROP_LOCATION "/submit.php?project=AMDiS")
set(CTEST_DROP_SITE_CDASH TRUE)
# set(CTEST_USE_LAUNCHERS 1)
\ No newline at end of file
<html>
<head>
<title> Using AMDiS with cmake </title>
<style type="text/css" >
.desc { background-color:#E0E0E0; margin-left:100px }
</style >
</head>
<body>
<h1> Using AMDiS with cmake </h1>
With this short page, I will show you, how to use the cmake buildsystem with AMDiS. The introduction consists of two main parts:
<ol>
<li> <a href="#compiling" > compiling and installing AMDiS with CMake </a ></li>
<li> <a href="#using" > using the cmake installed AMDiS in your project </a ></li>
<li> <a href="#faq" > some frequently asked questions </a ></li>
</ol>
<h2> <a name="compiling" > Compiling and installing AMDiS with CMake </a > </h2>
<h3> configure </h3>
There are 3 different configure tools for CMake:
<ul> <li> cmake (non interactive) </li>
<li> ccmake (interactive on command line) </li>
<li> cmake-gui (qt-based gui) </li></ul>
<p>I will use the cmake and ccmake. The autoconf/automake implementation was used directly inside the AMDiS source directory (i.e. the directory you get through svn). To use the CMake buildsystem, I recommend a different directory structure for building and compiling AMDiS. The script <a href="https://fusionforge.zih.tu-dresden.de/frs/download.php/34/getamdis_cmake.sh" >getamdis_cmake.sh</a>, which can be found on <a href="https://fusionforge.zih.tu-dresden.de" >https://fusionforge.zih.tu-dresden.de</a>, creates such a directory structure.</p>
Assume, you have AMDiS downloaded in the directory
<pre class="desc" >
${HOME}/work/ </pre>
, the AMDiS source directory is
<pre class="desc">
${HOME}/work/amdis/AMDiS </pre>
. To configure and compile AMDiS I recommend using out of source builds. This means, you should create a directory amdis_build
<pre class="desc">
mkdir ${HOME}/work/amdis_build </pre>
and do the remaining work from there.
<pre class="desc">
cd ${HOME}/work/amdis_build </pre>
The simplest configuration of AMDiS, i.e. without umfpack and parallelization, only sets the install destination to the directory "${HOME}/programs/". To do this, you have to call cmake with your install destination and the AMDiS source directory as commandline arguments
<pre class="desc" >
cmake -DCMAKE_INSTALL_PREFIX=${HOME}/programs/ ../amdis/AMDiS</pre>
Compilation and installation is the same as with automake/autoconf:
<pre class="desc">
make && make install </pre >
The last command will install AMDiS to ${HOME}/programs
<h2> <a name="using" > Using the cmake installed AMDiS in your project </a > </h2>
A cmake-project consists of the source files and a file CMakeLists.txt, which contains a description of needed libraries, headers and programs. If you have a simple project with one program "fooProg", which have to compile only one source file "src/foo.cc", your CMakeLists.txt consist of the following lines:
<pre class="desc" >
project(projectName) <br>
cmake_minimum_required(VERSION 2.8)<br><br>
find_package(AMDIS REQUIRED)<br>
if(AMDIS_FOUND)<br>
include(${AMDIS_USE_FILE})<br>
add_executable(fooProg src/foo.cc)<br>
target_link_libraries(fooProg ${AMDIS_LIBRARIES})<br>
endif(AMDIS_FOUND)<br>
</pre >
The first two lines
<pre class="desc" >
project(projectName) <br>
cmake_minimum_required(VERSION 2.8)
</pre >
tell cmake the name of your project and that you whish to use only cmake versions newer than 2.8.<br>
The line
<pre class="desc" >
find_package(AMDIS REQUIRED)
</pre >
tells cmake, that you want to use AMDiS and it should complain if AMDiS was not found. CMake will print an error message, bu will not stop the execution! With the command
<pre class="desc" >
include(${AMDIS_USE_FILE})
</pre >
we read an AMDiS specific configuration file, which sets some compilerflags and adds the include directorys. The program is added with
<pre class="desc" >
add_executable(fooProg src/foo.cc)
</pre >
and we have to tell cmake, that we need the library amdis and each library amdis depends on. This is done with the command
<pre class="desc" >
target_link_libraries(fooProg ${AMDIS_LIBRARIES})
</pre >
If cmake does not find AMDiS, you have to set the variable AMDIS_DIR to the directory containing the file AMDiSConfig.cmake. This file resides in
<pre class="desc" >
${CMAKE_INSTALL_PREFIX}/share/amdis/
</pre >
where CMAKE_INSTALL_PREFIX is the directory you choose during installation of amdis.
<h2 > <a name="faq" > Frequently asked questions </a ></h2 >
<h3 > Boost </h3>
If you have different boost versions on your system and you do not want to use the standard version in /usr/lib and /usr/include, you should set the environment variable BOOST_ROOT to your boost-installation.
<h3 > I will not set the AMDIS_DIR in every project. </h3 >
If you always use the same AMDiS directory, you can add the directory to your PATH variable.
</body>
</html>
This diff is collapsed.
# globally add compile options and include directories # globally add compile options and include directories
add_definitions(${AMDIS_COMPILEFLAGS}) add_definitions(${AMDIS_COMPILEFLAGS})
include_directories(${AMDIS_INCLUDE_DIRS}) include_directories(${AMDIS_INCLUDE_DIRS})
This diff is collapsed.
SET (CTEST_SOURCE_DIRECTORY @CMAKE_CURRENT_SOURCE_DIR@)
SET (CTEST_BINARY_DIRECTORY @CMAKE_CURRENT_BINARY_DIR@)
SET (CTEST_COMMAND "${CMAKE_CTEST_COMMAND}")
SET (CTEST_BUILD_COMMAND ${CTEST_BINARY_DIRECTORY}/myMake.sh)
set(CTEST_UPDATE_COMMAND ${CTEST_SOURCE_DIRECTORY}/MySvn.sh)
#set(CTEST_UPDATE_OPTIONS "--username studentiwr --password iwr_ws09")
set(CTEST_SITE @SITE@)
set(CTEST_BUILD_NAME @BUILDNAME@)
ctest_start(@CTEST_MODEL@)
ctest_build()
ctest_submit()
set(COMPILER_TEST_DIR ${CMAKE_BINARY_DIR}/CMakeFiles/compilerTest)
file(WRITE ${COMPILER_TEST_DIR}/CMakeLists.txt
"project(compilerTest)
cmake_minimum_required(VERSION 2.8)
add_definitions(-std=c++11)
# VARIADIC CLASS_TEMPLATES
add_executable(test_variadic_templ_class test_variadic_templ_class.cpp)
target_link_libraries(test_variadic_templ_class)
# VARIADIC FUNCTION TEMPLATES
add_executable(test_variadic_templ_fct test_variadic_templ_fct.cpp)
target_link_libraries(test_variadic_templ_fct)
# ALIAS TEMPLATES
add_executable(test_alias_templates test_alias_templates.cpp)
target_link_libraries(test_alias_templates)
# DECLTYPE
add_executable(test_decltype test_decltype.cpp)
target_link_libraries(test_decltype)
# AUTO SPECIFIER
add_executable(test_auto test_auto.cpp)
target_link_libraries(test_auto)
# CONSTEXPR
add_executable(test_constexpr test_constexpr.cpp)
target_link_libraries(test_constexpr)
# DELEGATING CONSTRUCTORS
add_executable(test_delegating_constructors test_delegating_constructors.cpp)
target_link_libraries(test_delegating_constructors)
# RANGE-BASED FOR LOOPS
add_executable(test_range_based_for test_range_based_for.cpp)
target_link_libraries(test_range_based_for)")
file(WRITE ${COMPILER_TEST_DIR}/test_variadic_templ_class.cpp
"template<class... Ts> struct A{}; int main(){A<int, double> a;}")
file(WRITE ${COMPILER_TEST_DIR}/test_variadic_templ_fct.cpp
"template<class... Ts> void foo(Ts... ts){}; int main(){foo(1, 2.0, 3.0f);}")
file(WRITE ${COMPILER_TEST_DIR}/test_alias_templates.cpp
"template<class T> struct A{}; template<class T> using B=A<T>; int main(){B<int> b;}")
file(WRITE ${COMPILER_TEST_DIR}/test_decltype.cpp
"int main(){decltype(1) a = 1;}")
file(WRITE ${COMPILER_TEST_DIR}/test_auto.cpp
"int main(){auto a = 1;}")
file(WRITE ${COMPILER_TEST_DIR}/test_constexpr.cpp
"constexpr int foo(){return 1;}; int main(){static constexpr int f = foo();}")
file(WRITE ${COMPILER_TEST_DIR}/test_delegating_constructors.cpp
"struct A{ A(){} A(int) : A(){} }; int main(){ A a(1);}")
file(WRITE ${COMPILER_TEST_DIR}/test_range_based_for.cpp
"int main(){ int vec[10]; for (int& elem : vec) { elem = 1; } }")
set(COMPILER_CXX11_FEATURES "")
try_compile(TEST_VARIADIC_TEMPL_CLASS ${COMPILER_TEST_DIR} ${COMPILER_TEST_DIR} compilerTest test_variadic_templ_class)
try_compile(TEST_VARIADIC_TEMPL_FCT ${COMPILER_TEST_DIR} ${COMPILER_TEST_DIR} compilerTest test_variadic_templ_fct)
if (TEST_VARIADIC_TEMPL_CLASS AND TEST_VARIADIC_TEMPL_FCT)
message("Compiler supports variadic class/ function templates")
list(APPEND COMPILER_CXX11_FEATURES "-DHAS_VARIADIC_TEMPLATES=1")
endif()
try_compile(TEST_ALIAS_TEMPLATES ${COMPILER_TEST_DIR} ${COMPILER_TEST_DIR} compilerTest test_alias_templates)
if (TEST_ALIAS_TEMPLATES)
message("Compiler supports alias-templates")
list(APPEND COMPILER_CXX11_FEATURES "-DHAS_ALIAS_TEMPLATES=1")
endif()
try_compile(TEST_DECLTYPE ${COMPILER_TEST_DIR} ${COMPILER_TEST_DIR} compilerTest test_decltype)
if (TEST_DECLTYPE)
message("Compiler supports decltype")
list(APPEND COMPILER_CXX11_FEATURES "-DHAS_DECLTYPE=1")
endif()
try_compile(TEST_AUTO_SPECIFIER ${COMPILER_TEST_DIR} ${COMPILER_TEST_DIR} compilerTest test_auto)
if (TEST_AUTO_SPECIFIER)
message("Compiler supports auto")
list(APPEND COMPILER_CXX11_FEATURES "-DHAS_AUTO=1")
endif()
try_compile(TEST_CONSTEXPR ${COMPILER_TEST_DIR} ${COMPILER_TEST_DIR} compilerTest test_constexpr)
if (TEST_CONSTEXPR)
message("Compiler supports constexpr")
list(APPEND COMPILER_CXX11_FEATURES "-DHAS_CONSTEXPR=1")
endif()
try_compile(TEST_DELEGATING_CONSTRUCTORS ${COMPILER_TEST_DIR} ${COMPILER_TEST_DIR} compilerTest test_delegating_constructors)
if (TEST_DELEGATING_CONSTRUCTORS)
message("Compiler supports delegating constructors")
list(APPEND COMPILER_CXX11_FEATURES "-DHAS_DELEGATING_CONSTRUCTORS=1")
endif()
try_compile(TEST_RANGED_BASED_FOR ${COMPILER_TEST_DIR} ${COMPILER_TEST_DIR} compilerTest test_range_based_for)
if (TEST_RANGED_BASED_FOR)
message("Compiler supports range-based for loops")
list(APPEND COMPILER_CXX11_FEATURES "-DHAS_RANGE_BASED_FOR=1")
endif()
\ No newline at end of file
# CorrectWindowsPaths - this module defines one macro
#
# CONVERT_CYGWIN_PATH( PATH )
# This uses the command cygpath (provided by cygwin) to convert
# unix-style paths into paths useable by cmake on windows
macro (CONVERT_CYGWIN_PATH _path)
if (WIN32)
EXECUTE_PROCESS(COMMAND cygpath.exe -m ${${_path}}
OUTPUT_VARIABLE ${_path})
string (STRIP ${${_path}} ${_path})
endif (WIN32)
endmacro (CONVERT_CYGWIN_PATH)
This diff is collapsed.
...@@ -21,7 +21,14 @@ ...@@ -21,7 +21,14 @@
# # Make temporary files, run programs, etc, to determine FOO_INCLUDES and FOO_LIBRARIES # # Make temporary files, run programs, etc, to determine FOO_INCLUDES and FOO_LIBRARIES
# endif (NOT foo_current) # endif (NOT foo_current)
# #
# MULTIPASS_SOURCE_RUNS (Name INCLUDES LIBRARIES SOURCE RUNS LANGUAGE)
# Always runs the given test, use this when you need to re-run tests
# because parent variables have made old cache entries stale. The LANGUAGE
# variable is either C or CXX indicating which compiler the test should
# use.
# MULTIPASS_C_SOURCE_RUNS (Name INCLUDES LIBRARIES SOURCE RUNS) # MULTIPASS_C_SOURCE_RUNS (Name INCLUDES LIBRARIES SOURCE RUNS)
# DEPRECATED! This is only included for backwards compatability. Use
# the more general MULTIPASS_SOURCE_RUNS instead.
# Always runs the given test, use this when you need to re-run tests # Always runs the given test, use this when you need to re-run tests
# because parent variables have made old cache entries stale. # because parent variables have made old cache entries stale.
...@@ -39,7 +46,7 @@ macro (FIND_PACKAGE_MULTIPASS _name _current) ...@@ -39,7 +46,7 @@ macro (FIND_PACKAGE_MULTIPASS _name _current)
# The name of the stored value for the given state # The name of the stored value for the given state
set (_stored_var PACKAGE_MULTIPASS_${_NAME}_${_state}) set (_stored_var PACKAGE_MULTIPASS_${_NAME}_${_state})
if (NOT "${${_stored_var}}" STREQUAL "${${_NAME}_${_state}}") if (NOT "${${_stored_var}}" STREQUAL "${${_NAME}_${_state}}")
set (_states_current "NO") set (_states_current "NO")
endif (NOT "${${_stored_var}}" STREQUAL "${${_NAME}_${_state}}") endif (NOT "${${_stored_var}}" STREQUAL "${${_NAME}_${_state}}")
set (${_stored_var} "${${_NAME}_${_state}}" CACHE INTERNAL "Stored state for ${_name}." FORCE) set (${_stored_var} "${${_NAME}_${_state}}" CACHE INTERNAL "Stored state for ${_name}." FORCE)
list (REMOVE_AT _args 0) list (REMOVE_AT _args 0)
...@@ -61,7 +68,7 @@ macro (FIND_PACKAGE_MULTIPASS _name _current) ...@@ -61,7 +68,7 @@ macro (FIND_PACKAGE_MULTIPASS _name _current)
if (_cmd STREQUAL "DEPENDENTS") if (_cmd STREQUAL "DEPENDENTS")
list (REMOVE_AT _args 0) list (REMOVE_AT _args 0)
foreach (dep ${_args}) foreach (dep ${_args})
set (${_NAME}_${dep} "NOTFOUND" CACHE INTERNAL "Cleared" FORCE) set (${_NAME}_${dep} "NOTFOUND" CACHE INTERNAL "Cleared" FORCE)
endforeach (dep) endforeach (dep)
endif (_cmd STREQUAL "DEPENDENTS") endif (_cmd STREQUAL "DEPENDENTS")
set (${_NAME}_FOUND "NOTFOUND" CACHE INTERNAL "Cleared" FORCE) set (${_NAME}_FOUND "NOTFOUND" CACHE INTERNAL "Cleared" FORCE)
...@@ -70,9 +77,9 @@ macro (FIND_PACKAGE_MULTIPASS _name _current) ...@@ -70,9 +77,9 @@ macro (FIND_PACKAGE_MULTIPASS _name _current)
endmacro (FIND_PACKAGE_MULTIPASS) endmacro (FIND_PACKAGE_MULTIPASS)
macro (MULTIPASS_C_SOURCE_RUNS includes libraries source runs) macro (MULTIPASS_SOURCE_RUNS includes libraries source runs language)
include (CheckCSourceRuns) include (Check${language}SourceRuns)
# This is a ridiculous hack. CHECK_C_SOURCE_* thinks that if the # This is a ridiculous hack. CHECK_${language}_SOURCE_* thinks that if the
# *name* of the return variable doesn't change, then the test does # *name* of the return variable doesn't change, then the test does
# not need to be re-run. We keep an internal count which we # not need to be re-run. We keep an internal count which we
# increment to guarantee that every test name is unique. If we've # increment to guarantee that every test name is unique. If we've
...@@ -86,6 +93,14 @@ macro (MULTIPASS_C_SOURCE_RUNS includes libraries source runs) ...@@ -86,6 +93,14 @@ macro (MULTIPASS_C_SOURCE_RUNS includes libraries source runs)
set (testname MULTIPASS_TEST_${MULTIPASS_TEST_COUNT}_${runs}) set (testname MULTIPASS_TEST_${MULTIPASS_TEST_COUNT}_${runs})
set (CMAKE_REQUIRED_INCLUDES ${includes}) set (CMAKE_REQUIRED_INCLUDES ${includes})
set (CMAKE_REQUIRED_LIBRARIES ${libraries}) set (CMAKE_REQUIRED_LIBRARIES ${libraries})
check_c_source_runs ("${source}" ${testname}) if(${language} STREQUAL "C")
check_c_source_runs ("${source}" ${testname})
elseif(${language} STREQUAL "CXX")
check_cxx_source_runs ("${source}" ${testname})
endif()
set (${runs} "${${testname}}") set (${runs} "${${testname}}")
endmacro (MULTIPASS_SOURCE_RUNS)
macro (MULTIPASS_C_SOURCE_RUNS includes libraries source runs)
multipass_source_runs("${includes}" "${libraries}" "${source}" ${runs} "C")
endmacro (MULTIPASS_C_SOURCE_RUNS) endmacro (MULTIPASS_C_SOURCE_RUNS)
find_file(HYPRE_H HYPRE.h)
find_library(HYPRE_LIB HYPRE)
if(HYPRE_H AND HYPRE_LIB)
set(HAVE_HYPRE ON)
find_package(MPI REQUIRED)
#append each library in the hypre_lib directory beginning with HYPRE to the list of hypre libraries
get_filename_component(HLIB_PATH ${HYPRE_LIB} PATH)
file(GLOB HYPRE_OTHER ${HLIB_PATH}/${CMAKE_SHARED_LIBRARY_PREFIX}HYPRE*${CMAKE_SHARED_LIBRARY_SUFFIX})
find_library(LAPACK_LIB lapack)
set(HYPRE_LIBRARIES ${MPI_LIBRARIES} ${HYPRE_LIB} ${HYPRE_OTHER} ${LAPACK_LIB})
message("hypre libraries: ${HYPRE_LIBRARIES}")
get_filename_component(HYPRE_INCLUDE_DIRECTORIES ${HYPRE_H} PATH)
list(APPEND HYPRE_INCLUDE_DIRECTORIES ${MPI_CXX_INCLUDE_PATH})
else()
if(HAVE_HYPRE)
message("could not find hypre:")
message("library: ${HYPRE_LIB}")
message("header: ${HYPRE_H}")
endif()
set(HAVE_HYPRE FALSE)
endif()
This diff is collapsed.
...@@ -38,23 +38,34 @@ ...@@ -38,23 +38,34 @@
# #
# assuming both directories exist. # assuming both directories exist.
# Note: as currently implemented, the -I/string will be picked up mistakenly (cry, cry) # Note: as currently implemented, the -I/string will be picked up mistakenly (cry, cry)
include (CorrectWindowsPaths)
macro (RESOLVE_LIBRARIES LIBS LINK_LINE) macro (RESOLVE_LIBRARIES LIBS LINK_LINE)
string (REGEX MATCHALL "((-L|-l|-Wl)([^\" ]+|\"[^\"]+\")|/[^\" ]+(a|so|dll))" _all_tokens "${LINK_LINE}") string (REGEX MATCHALL "((-L|-l|-Wl)([^\" ]+|\"[^\"]+\")|[^\" ]+\\.(a|so|dll|lib))" _all_tokens "${LINK_LINE}")
set (_libs_found) set (_libs_found "")
set (_directory_list) set (_directory_list "")
foreach (token ${_all_tokens}) foreach (token ${_all_tokens})
if (token MATCHES "-L([^\" ]+|\"[^\"]+\")") if (token MATCHES "-L([^\" ]+|\"[^\"]+\")")
# If it's a library path, add it to the list # If it's a library path, add it to the list
string (REGEX REPLACE "^-L" "" token ${token}) string (REGEX REPLACE "^-L" "" token ${token})
string (REGEX REPLACE "//" "/" token ${token}) string (REGEX REPLACE "//" "/" token ${token})
convert_cygwin_path(token)
list (APPEND _directory_list ${token}) list (APPEND _directory_list ${token})
elseif (token MATCHES "^(-l([^\" ]+|\"[^\"]+\")|/[^\" ]+(a|so|dll))") elseif (token MATCHES "^(-l([^\" ]+|\"[^\"]+\")|[^\" ]+\\.(a|so|dll|lib))")
# It's a library, resolve the path by looking in the list and then (by default) in system directories # It's a library, resolve the path by looking in the list and then (by default) in system directories
string (REGEX REPLACE "^-l" "" token ${token}) if (WIN32) #windows expects "libfoo", linux expects "foo"
set (_root) string (REGEX REPLACE "^-l" "lib" token ${token})
if (token MATCHES "^/") # We have an absolute path, add root to the search path else (WIN32)
set (_root "/") string (REGEX REPLACE "^-l" "" token ${token})
endif (WIN32)
set (_root "")
if (token MATCHES "^/") # We have an absolute path
#separate into a path and a library name:
string (REGEX MATCH "[^/]*\\.(a|so|dll|lib)$" libname ${token})
string (REGEX MATCH ".*[^${libname}$]" libpath ${token})
convert_cygwin_path(libpath)
set (_directory_list ${_directory_list} ${libpath})
set (token ${libname})
endif (token MATCHES "^/") endif (token MATCHES "^/")
set (_lib "NOTFOUND" CACHE FILEPATH "Cleared" FORCE) set (_lib "NOTFOUND" CACHE FILEPATH "Cleared" FORCE)
find_library (_lib ${token} HINTS ${_directory_list} ${_root}) find_library (_lib ${token} HINTS ${_directory_list} ${_root})
...@@ -78,10 +89,11 @@ endmacro (RESOLVE_LIBRARIES) ...@@ -78,10 +89,11 @@ endmacro (RESOLVE_LIBRARIES)
macro (RESOLVE_INCLUDES INCS COMPILE_LINE) macro (RESOLVE_INCLUDES INCS COMPILE_LINE)
string (REGEX MATCHALL "-I([^\" ]+|\"[^\"]+\")" _all_tokens "${COMPILE_LINE}") string (REGEX MATCHALL "-I([^\" ]+|\"[^\"]+\")" _all_tokens "${COMPILE_LINE}")
set (_incs_found) set (_incs_found "")
foreach (token ${_all_tokens}) foreach (token ${_all_tokens})
string (REGEX REPLACE "^-I" "" token ${token}) string (REGEX REPLACE "^-I" "" token ${token})
string (REGEX REPLACE "//" "/" token ${token}) string (REGEX REPLACE "//" "/" token ${token})
convert_cygwin_path(token)
if (EXISTS ${token}) if (EXISTS ${token})
list (APPEND _incs_found ${token}) list (APPEND _incs_found ${token})
else (EXISTS ${token}) else (EXISTS ${token})
......
#this files sets the cmake variable AMDIS_SUB_MINOR to the subversion global revision
#if the global revision could not be determined, the variable remains empty
#TODO: git compatibility
macro(Subversion_CHECK_WC dir prefix)
set(_Subversion_SAVED_LC_ALL "$ENV{LC_ALL}")
set(ENV{LC_ALL} C)
execute_process(COMMAND ${Subversion_SVN_EXECUTABLE} info ${dir}
OUTPUT_VARIABLE ${prefix}_WC_INFO
ERROR_VARIABLE Subversion_svn_info_error
RESULT_VARIABLE Subversion_svn_info_result
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(${Subversion_svn_info_result} EQUAL 0)
set(${prefix} TRUE)
#message(SEND_ERROR "Command \"${Subversion_SVN_EXECUTABLE} info ${dir}\" failed with output:\n${Subversion_svn_info_error}")
else()
set(${prefix} FALSE)
endif()
# restore the previous LC_ALL
set(ENV{LC_ALL} ${_Subversion_SAVED_LC_ALL})
endmacro()
find_package(Subversion)
if(Subversion_FOUND)
#CMake Version 3.5.2: fatal error in Subversion_WC_INFO if CMAKE_CURRENT_SOURCE_DIR is not a working directory
Subversion_CHECK_WC(${CMAKE_CURRENT_SOURCE_DIR} svn_check)
if(svn_check)
Subversion_WC_INFO(${CMAKE_CURRENT_SOURCE_DIR} svn_info)
#message("svn-rev: ${svn_info_WC_REVISION}")
set(AMDIS_SUB_MINOR "${svn_info_WC_REVISION}")
endif()
endif()
# specify the target and requirements for the composite fem library
set(COMPOSITE_SOURCE_DIR ${SOURCE_DIR}/compositeFEM)
list(APPEND COMPOSITE_FEM_SRC
${COMPOSITE_SOURCE_DIR}/CFE_Integration.cc
${COMPOSITE_SOURCE_DIR}/CFE_NormAndErrorFcts.cc
${COMPOSITE_SOURCE_DIR}/CompositeFEMMethods.cc
${COMPOSITE_SOURCE_DIR}/CompositeFEMOperator.cc
${COMPOSITE_SOURCE_DIR}/LevelSetAdaptMesh.cc
${COMPOSITE_SOURCE_DIR}/PenaltyOperator.cc
${COMPOSITE_SOURCE_DIR}/ElementLevelSet.cc
${COMPOSITE_SOURCE_DIR}/SubPolytope.cc
${COMPOSITE_SOURCE_DIR}/SubElementAssembler.cc)
list(APPEND COMPILEFLAGS "-DHAVE_COMPOSITE_FEM=1")
list(APPEND AMDIS_INCLUDE_DIRS ${COMPOSITE_SOURCE_DIR})
# specify how to install this target:
# -----------------------------------
file(GLOB COMPOSITE_HEADERS "${COMPOSITE_SOURCE_DIR}/*.h*")
install(FILES ${COMPOSITE_HEADERS} DESTINATION include/amdis/compositeFEM)
if (ENABLE_EXTENSIONS)
option(ENABLE_BASE_PROBLEMS "Use base_problems" true)
mark_as_advanced(ENABLE_BASE_PROBLEMS)
find_path(EXTENSIONS_DIR NAMES Helpers.h
HINTS ${BASE_DIR}/../extensions
DOC "Path to AMDiS extensions.")
if (EXTENSIONS_DIR)
if (NOT EXISTS ${EXTENSIONS_DIR}/Helpers.h OR NOT EXISTS ${EXTENSIONS_DIR}/ExtendedProblemStat.h)
message(FATAL_ERROR "Wrong extensions directory! Directory must contain the files 'Helpers.h' and 'ExtendedProblemStat.h'")
endif ()
list(APPEND EXTENSIONS_SRC
${EXTENSIONS_DIR}/Helpers.cc
${EXTENSIONS_DIR}/BackgroundMesh.cc
${EXTENSIONS_DIR}/GeometryTools.cc
${EXTENSIONS_DIR}/POperators.cc
${EXTENSIONS_DIR}/SingularDirichletBC2.cc
${EXTENSIONS_DIR}/time/ExtendedRosenbrockStationary.cc
${EXTENSIONS_DIR}/pugixml/src/pugixml.cpp
)
list(APPEND COMPILEFLAGS "-DHAVE_EXTENSIONS=1")
list(APPEND AMDIS_INCLUDE_DIRS
${EXTENSIONS_DIR}
${EXTENSIONS_DIR}/time
${EXTENSIONS_DIR}/nanoflann
${EXTENSIONS_DIR}/pugixml/src
)
set(INSTALL_SUBDIRS . time preconditioner nanoflann)
if (ENABLE_SEQ_PETSC)
list(APPEND EXTENSIONS_SRC
${EXTENSIONS_DIR}/preconditioner/PetscPreconPfc.cc
${EXTENSIONS_DIR}/preconditioner/PetscPreconPfcDiag.cc
${EXTENSIONS_DIR}/preconditioner/PetscPreconCahnHilliard.cc)
endif (ENABLE_SEQ_PETSC)
if (ENABLE_PARALLEL_DOMAIN)
list(APPEND EXTENSIONS_SRC
${EXTENSIONS_DIR}/preconditioner/PetscSolverPfc.cc
${EXTENSIONS_DIR}/preconditioner/PetscSolverPfc_diag.cc)
endif (ENABLE_PARALLEL_DOMAIN)
if (ENABLE_BASE_PROBLEMS)
if (ENABLE_REINIT)
list(APPEND EXTENSIONS_SRC
${EXTENSIONS_DIR}/base_problems/CahnHilliard.cc
${EXTENSIONS_DIR}/base_problems/CahnHilliard_RB.cc
${EXTENSIONS_DIR}/base_problems/CahnHilliardNavierStokes.cc
${EXTENSIONS_DIR}/base_problems/CahnHilliardNavierStokes_RB.cc
${EXTENSIONS_DIR}/base_problems/CahnHilliardNavierStokes_TwoPhase.cc
${EXTENSIONS_DIR}/base_problems/CahnHilliardNavierStokes_TwoPhase_RB.cc)
endif (ENABLE_REINIT)
list(APPEND EXTENSIONS_SRC
${EXTENSIONS_DIR}/base_problems/DiffuseDomainFsi.cc
${EXTENSIONS_DIR}/base_problems/LinearElasticity.cc
${EXTENSIONS_DIR}/base_problems/LinearElasticityPhase.cc
${EXTENSIONS_DIR}/base_problems/NavierStokesCahnHilliard.cc
${EXTENSIONS_DIR}/base_problems/NavierStokesPhase_TaylorHood.cc
${EXTENSIONS_DIR}/base_problems/NavierStokes_TaylorHood.cc
${EXTENSIONS_DIR}/base_problems/NavierStokes_TaylorHood_RB.cc
${EXTENSIONS_DIR}/base_problems/NavierStokes_TH_MultiPhase.cc
${EXTENSIONS_DIR}/base_problems/NavierStokes_TH_MultiPhase_RB.cc
${EXTENSIONS_DIR}/base_problems/PhaseFieldCrystal.cc
${EXTENSIONS_DIR}/base_problems/PhaseFieldCrystal_Phase.cc
${EXTENSIONS_DIR}/base_problems/PhaseFieldCrystal_RB.cc
${EXTENSIONS_DIR}/base_problems/PolarizationField.cc
${EXTENSIONS_DIR}/base_problems/QuasiCrystal.cc
${EXTENSIONS_DIR}/base_problems/QuasiCrystal_RB.cc)
# ${EXTENSIONS_DIR}/base_problems/NavierStokes_Chorin.cc
# ${EXTENSIONS_DIR}/base_problems/NavierStokesPhase_Chorin.cc
# ${EXTENSIONS_DIR}/base_problems/VacancyPhaseFieldCrystal.cc
list(APPEND COMPILEFLAGS "-DHAVE_BASE_PROBLEMS=1")
list(APPEND AMDIS_INCLUDE_DIRS ${EXTENSIONS_DIR}/base_problems)
list(APPEND INSTALL_SUBDIRS base_problems)
endif (ENABLE_BASE_PROBLEMS)
# specify how to install this target:
# -----------------------------------
foreach (SUBDIR ${INSTALL_SUBDIRS})
file(GLOB HEADERS "${EXTENSIONS_DIR}/${SUBDIR}/*.h*")
install(FILES ${HEADERS} DESTINATION include/amdis/extensions/${SUBDIR}/)
endforeach ()
file(GLOB HEADERS "${EXTENSIONS_DIR}/pugixml/src/*.hpp")
install(FILES ${HEADERS} DESTINATION include/amdis/extensions/pugixml/)
endif (EXTENSIONS_DIR)
endif (ENABLE_EXTENSIONS)
if (ENABLE_PARALLEL_DOMAIN)
option(ENABLE_ZOLTAN "Add support for the Parallel Partitioning suite Zoltan" false)
option(ENABLE_PARALLEL_SOLVERS "Add some problem dependent solver, e.g. Feti, Navier-Stokes and Cahn-Hilliard" true)
option(ENABLE_BDDCML "Add support for the BDDCML library" false)
mark_as_advanced(ENABLE_PARALLEL_SOLVERS)
mark_as_advanced(ENABLE_BDDCML)
set(PARALLEL_DOMAIN_AMDIS_SRC
${SOURCE_DIR}/parallel/DofComm.cc
${SOURCE_DIR}/parallel/CheckerPartitioner.cc
${SOURCE_DIR}/parallel/ElementObjectDatabase.cc
${SOURCE_DIR}/parallel/InteriorBoundary.cc
${SOURCE_DIR}/parallel/MeshDistributor.cc
${SOURCE_DIR}/parallel/MeshLevelData.cc
${SOURCE_DIR}/parallel/MeshManipulation.cc
${SOURCE_DIR}/parallel/MeshPartitioner.cc
${SOURCE_DIR}/parallel/MpiHelper.cc
${SOURCE_DIR}/parallel/ParallelDebug.cc
${SOURCE_DIR}/parallel/ParallelDofMapping.cc
${SOURCE_DIR}/parallel/ParallelProblemStat.cc
${SOURCE_DIR}/parallel/ParallelSolver.cc
${SOURCE_DIR}/parallel/PeriodicMap.cc
${SOURCE_DIR}/parallel/ParMetisPartitioner.cc
${SOURCE_DIR}/parallel/StdMpi.cc
)
list(APPEND COMPILEFLAGS "-DHAVE_PARALLEL_DOMAIN_AMDIS=1")
enable_mpi(COMPILEFLAGS AMDIS_INCLUDE_DIRS _)
enable_petsc(COMPILEFLAGS AMDIS_INCLUDE_DIRS _)
# add support for the zoltan library
if (ENABLE_ZOLTAN)
enable_zoltan(COMPILEFLAGS AMDIS_INCLUDE_DIRS _)
list(APPEND PARALLEL_DOMAIN_AMDIS_SRC
${SOURCE_DIR}/parallel/ZoltanPartitioner.cc)
endif (ENABLE_ZOLTAN)
if (ENABLE_BDDCML)
enable_bddcml(COMPILEFLAGS AMDIS_INCLUDE_DIRS _)
list(APPEND PARALLEL_DOMAIN_AMDIS_SRC
${SOURCE_DIR}/parallel/BddcMlSolver.cc)
endif (ENABLE_BDDCML)
# add some more source-files that need petsc
list(APPEND PARALLEL_DOMAIN_AMDIS_SRC
${SOURCE_DIR}/parallel/MatrixNnzStructure.cc
${SOURCE_DIR}/parallel/ParallelCoarseSpaceSolver.cc
<