diff --git a/AMDiS/CTestConfig.cmake b/AMDiS/CTestConfig.cmake deleted file mode 100644 index 3a83a9275bbbc03f117631358a4d93c13c0bb661..0000000000000000000000000000000000000000 --- a/AMDiS/CTestConfig.cmake +++ /dev/null @@ -1,16 +0,0 @@ -## 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 diff --git a/AMDiS/HOWTO_cmake.html b/AMDiS/HOWTO_cmake.html deleted file mode 100644 index 94fbdcafcdaeaed8989cf4295154dc5960b141ee..0000000000000000000000000000000000000000 --- a/AMDiS/HOWTO_cmake.html +++ /dev/null @@ -1,96 +0,0 @@ - - - Using AMDiS with cmake - - - -

Using AMDiS with cmake

-With this short page, I will show you, how to use the cmake buildsystem with AMDiS. The introduction consists of two main parts: -
    -
  1. compiling and installing AMDiS with CMake
  2. -
  3. using the cmake installed AMDiS in your project
  4. -
  5. some frequently asked questions
  6. -
- -

Compiling and installing AMDiS with CMake

-

configure

-There are 3 different configure tools for CMake: - - -

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 getamdis_cmake.sh, which can be found on https://fusionforge.zih.tu-dresden.de, creates such a directory structure.

-Assume, you have AMDiS downloaded in the directory -
-${HOME}/work/ 
-, the AMDiS source directory is -
-${HOME}/work/amdis/AMDiS 
-. To configure and compile AMDiS I recommend using out of source builds. This means, you should create a directory amdis_build -
-mkdir ${HOME}/work/amdis_build 
-and do the remaining work from there. -
-cd ${HOME}/work/amdis_build 
- 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 -
-cmake -DCMAKE_INSTALL_PREFIX=${HOME}/programs/ ../amdis/AMDiS
- -Compilation and installation is the same as with automake/autoconf: -
-make && make install 
-The last command will install AMDiS to ${HOME}/programs - -

Using the cmake installed AMDiS in your project

-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: -
-project(projectName) 
-cmake_minimum_required(VERSION 2.8)

- -find_package(AMDIS REQUIRED)
-if(AMDIS_FOUND)
- include(${AMDIS_USE_FILE})
- add_executable(fooProg src/foo.cc)
- target_link_libraries(fooProg ${AMDIS_LIBRARIES})
-endif(AMDIS_FOUND)
-
- -The first two lines -
-project(projectName) 
-cmake_minimum_required(VERSION 2.8) -
-tell cmake the name of your project and that you whish to use only cmake versions newer than 2.8.
-The line -
-find_package(AMDIS REQUIRED)
-
-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 -
-	include(${AMDIS_USE_FILE})
-
-we read an AMDiS specific configuration file, which sets some compilerflags and adds the include directorys. The program is added with -
-	add_executable(fooProg src/foo.cc)
-
-and we have to tell cmake, that we need the library amdis and each library amdis depends on. This is done with the command -
-	target_link_libraries(fooProg ${AMDIS_LIBRARIES})
-
- -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 -
-  ${CMAKE_INSTALL_PREFIX}/share/amdis/
-
- where CMAKE_INSTALL_PREFIX is the directory you choose during installation of amdis. - -

Frequently asked questions

-

Boost

-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. - -

I will not set the AMDIS_DIR in every project.

-If you always use the same AMDiS directory, you can add the directory to your PATH variable. - - diff --git a/AMDiS/cmake/AMDISConfig.cmake.in b/AMDiS/cmake/AMDISConfig.cmake.in index d7057d007c6e6ba5472f6c4f527f2573f647a243..9f3d57839b20a773f87b83bd617bee9129e6ae7a 100644 --- a/AMDiS/cmake/AMDISConfig.cmake.in +++ b/AMDiS/cmake/AMDISConfig.cmake.in @@ -1,491 +1,239 @@ -#This configuration file is shipped with the great FEM-Toolbox AMDiS. -#It simplifies the configure of different amdis-version and sets some variables. -#We set the following variables: -# AMDIS_INCLUDE_DIR the amdis-directory only -# AMDIS_INCLUDE_DIRS all include directories (mtl, umfpack, parmetis, metis, ...) -# AMDIS_LIBRARIES the needed libraries -# AMDIS_LIBRARY_DIRS the link directories -# AMDiS_COMPILEFLAGS some compile flags for amdis +# This configuration file is shipped with the FEM-Toolbox AMDiS. +# It simplifies the configure of different amdis-versions. # +# We set the following variables: +# AMDIS_INCLUDE_DIRS all include directories (mtl, umfpack, parmetis, metis, ...) +# AMDIS_LIBRARIES the needed libraries +# AMDiS_COMPILEFLAGS some compile flags for amdis # -# For a fast start, you use this package in the following way -# simply look for it, possibly set the AMDiS directory -# find_package(AMDiS ) -# include(${AMDIS_USE_FILE}) -# add_executable(yourTarget ) -# target_link_libraries(yourTarget ${AMDIS_LIBRARIES}) +# Use this package in the following way: # +# find_package(AMDiS REQUIRED [PARALLEL|SEQUENTIAL]) +# add_executable(yourTarget ) +# include_directories(${AMDIS_INCLUDE_DIRS}) +# compile_definitions(${AMDIS_COMPILEFLAGS}) +# target_link_libraries(yourTarget ${AMDIS_LIBRARIES}) # -#The AMDIS_USE_FILE adds the include and link-directories for amdis to cmake. +# The default component for this package is SEQUENTIAL. # -#If you use the parallel amdis-version, the AMDIS_USE_FILE also trys to detect -#the mpi and petsc configuration. If those versions don't fit your needs, -#you can change the corresponding directories, or simply do this work at your own -#and omit the AMDIS_USE_FILE. Then you also have to set the flags, include -#and library directories. - -################## ONLY WORKAROUND AND WARNING ################### -#if(NOT "$ENV{LIBRARY_PATH}" STREQUAL "") -# message(WARNING "the environment variable LIBRARY_PATH is set. this can lead to problems during linking. \n You can unset it in your CMakeLists.txt with the command unset(ENV{LIBRARY_PATH}).\n") -#endif() -################################################################## -# try to detect the AMDiS include directory -# ------------------------------------------- -find_file(_AMDIS_H AMDiS.h PATHS ${AMDIS_INCLUDE_DIR} ${AMDIS_DIR}/../../include/amdis/ /usr/include/amdis/) -if(_AMDIS_H) - get_filename_component(AMDIS_INCLUDE_DIR ${_AMDIS_H} PATH CACHE) - set(AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}) -else() - message(ERROR "could not detect the AMDiS include directory. Please set the variable AMDIS_INCLUDE_DIR to the directory containing the AMDiS headers.") -endif() -unset(_AMDIS_H CACHE) -# set(MTL_DIR @MTL_INCLUDE_DIR@ CACHE PATH "the mtl directory") -list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/mtl4) - -# AMDiS base libraries -# -------------------- -find_library(_AMDIS_LIB amdis PATHS ${AMDIS_LIBRARY_DIR} ${AMDIS_DIR}/../../lib/amdis/ /usr/include/amdis) -if(_AMDIS_LIB) - get_filename_component(AMDIS_LIBRARY_DIR ${_AMDIS_LIB} PATH CACHE) - set(AMDIS_LIBRARY_DIRS ${AMDIS_LIBRARY_DIR}) - set(AMDIS_LIBRARIES "${_AMDIS_LIB}" CACHE STRING "amdis libraries") -else() - message(ERROR "could not detect the AMDiS library directory. Please set the variable AMDIS_LIBRARY_DIR to the directory containg the AMDiS library") -endif() -unset(_AMDIS_LIB CACHE) +if (${CMAKE_VERSION} VERSION_LESS "2.8.10") + message(FATAL_ERROR "The Configuration file was created for CMake version >= 2.8.10") +endif () +list(APPEND CMAKE_MODULE_PATH ${AMDIS_DIR}) -# Boost libraries -# --------------- -set(AMDIS_HAS_PARALLEL_DOMAIN @ENABLE_PARALLEL_DOMAIN@) -set(AMDIS_NEED_COMPRESSION @ENABLE_COMPRESSION@) +set(IS_AMDISCONFIG true) -set(BOOST_LIBS_REQUIRED system iostreams filesystem program_options date_time) -if(WIN32) - list(APPEND BOOST_LIBS_REQUIRED zlib) - if (AMDIS_NEED_COMPRESSION) - list(APPEND BOOST_LIBS_REQUIRED bzip2) - endif () -endif() - -set(BOOST_VERSION "1.42") -if(AMDIS_HAS_PARALLEL_DOMAIN) - set(BOOST_VERSION "1.48") -endif(AMDIS_HAS_PARALLEL_DOMAIN) - -if(WIN32) - set(Boost_USE_STATIC_LIBS ON) - find_package(Boost ${BOOST_VERSION} REQUIRED ${BOOST_LIBS_REQUIRED}) -else() - set(Boost_USE_STATIC_LIBS OFF) - find_package(Boost ${BOOST_VERSION} REQUIRED ${BOOST_LIBS_REQUIRED}) -endif() -if(Boost_FOUND) - list(APPEND AMDIS_LIBRARIES ${Boost_LIBRARIES}) - list(APPEND AMDIS_LIBRARY_DIRS ${Boost_LIBRARY_DIRS}) - list(APPEND AMDIS_INCLUDE_DIRS ${Boost_INCLUDE_DIR}) -else() - message(ERROR "Boost libraries not found") -endif(Boost_FOUND) - -# more libraries and include-directories added by default -# ------------------------------------------------------- -list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/reinit) -list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/compositeFEM) -list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/muparser) - -# ------------------------------------------------------------------ - -set(AMDIS_NEED_ZOLTAN @ENABLE_ZOLTAN@) -set(AMDIS_OPENMP @ENABLE_OPENMP@) +set(AMDIS_USE_FILE ${AMDIS_DIR}/AMDISUse.cmake) set(AMDIS_NEED_CXX11 @ENABLE_CXX11@) set(AMDIS_NEED_UMFPACK @ENABLE_UMFPACK@) -set(AMDIS_NEED_HYPRE @ENABLE_HYPRE@) -set(AMDIS_NEED_SEQ_PETSC @ENABLE_SEQ_PETSC@) -set(AMDIS_NEED_PNG @ENABLE_PNG@) -set(AMDIS_NEED_BDDCML @ENABLE_BDDCML@) -set(AMDIS_NEED_MKL @ENABLE_MKL@) +set(AMDIS_NEED_COMPRESSION @ENABLE_COMPRESSION@) set(AMDIS_NEED_EXTENSIONS @ENABLE_EXTENSIONS@) set(AMDIS_NEED_BASE_PROBLEMS @ENABLE_BASE_PROBLEMS@) -set(AMDIS_USE_FILE ${AMDIS_DIR}/AMDISUse.cmake) -set(AMDIS_COMPILEFLAGS "@COMPILEFLAGS@") -set(AMDIS_VERSION @CurrentRevision@) -set(AMDIS_MAJOR_VERSION @AMDIS_MAJOR@) -set(AMDIS_MINOR_VERSION @AMDIS_MINOR@) -set(AMDIS_SUB_MINOR_VERSION @AMDIS_SUB_MINOR@) +set(AMDIS_NEED_REINIT @ENABLE_REINIT@) +set(AMDIS_NEED_COMPOSITE_FEM @ENABLE_COMPOSITE_FEM@) +set(AMDIS_NEED_ZOLTAN @ENABLE_ZOLTAN@) +set(AMDIS_NEED_BDDCML @ENABLE_BDDCML@) +set(AMDIS_NEED_HYPRE @ENABLE_HYPRE@) +set(AMDIS_NEED_PNG @ENABLE_PNG@) +set(AMDIS_NEED_SEQ_PETSC @ENABLE_SEQ_PETSC@) + +set(BUILD_SHARED_LIBS @BUILD_SHARED_LIBS@) +set(CMAKE_BUILD_TYPE @CMAKE_BUILD_TYPE@) + +set(AMDIS_COMPILEFLAGS "") +set(AMDIS_INCLUDE_DIRS "") +set(AMDIS_LIBRARIES "") + +# Include macros +# ---------------- +include(enable_cxx11) +include(enable_mtl4) +include(enable_boost) +include(enable_umfpack) +include(enable_petsc) +include(enable_zoltan) +include(enable_bddcml) +include(enable_hypre) +include(enable_png) -if(CMAKE_BUILD_TYPE STREQUAL "") - set(CMAKE_BUILD_TYPE "Release") -endif() if (AMDIS_NEED_CXX11) + enable_cxx11(AMDIS_NEED_CXX11 AMDIS_COMPILEFLAGS) + if (NOT AMDIS_NEED_CXX11) + message(FATAL_ERROR "AMDiS was compiled with c++11 support, but the current compiler does not support this feature!") + endif (NOT AMDIS_NEED_CXX11) list(APPEND AMDIS_COMPILEFLAGS "-DHAS_CXX11=1") - if (${CMAKE_VERSION} VERSION_GREATER "3.0") - set(CMAKE_CXX_STANDARD 11) - set(CMAKE_CXX_STANDARD_REQUIRED ON) - else() - if (CMAKE_COMPILER_IS_GNUCXX) - set(GXX_MIN_VER "4.8") - if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS GXX_MIN_VER) - message (FATAL_ERROR "For C++11-Features the G++ Compiler must be at least version $GXX_MIN_VER") - endif () - list(APPEND AMDIS_COMPILEFLAGS "-std=gnu++11") - elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - set(CLANG_MIN_VER "3.0") - if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS CLANG_MIN_VER) - message (FATAL_ERROR "For C++11-Features the Clang Compiler must be at least version $CLANG_MIN_VER") - endif () - list(APPEND AMDIS_COMPILEFLAGS "-std=c++11") - elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") - set(INTEL_MIN_VER "12.1") - if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS INTEL_MIN_VER) - message (FATAL_ERROR "For C++11-Features the Intel C++ Compiler must be at least version $INTEL_MIN_VER") - endif () - list(APPEND AMDIS_COMPILEFLAGS "-std=c++11") - elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") - set(MSVC_MIN_VER "12.0") - if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS MSVC_MIN_VER) - message (FATAL_ERROR "For C++11-Features the MSVC C++ Compiler must be at least version $MSVC_MIN_VER") - endif () - endif () - endif() else () list(APPEND AMDIS_COMPILEFLAGS "-DHAS_CXX11=0") endif (AMDIS_NEED_CXX11) -#load mpi-compiler for use with parmetis and parallel_domain -if(AMDIS_HAS_PARALLEL_DOMAIN) - find_package(MPI REQUIRED) - list(APPEND AMDIS_LIBRARIES ${MPI_LIBRARIES}) - list(APPEND AMDIS_COMPILEFLAGS ${MPI_COMPILE_FLAGS}) - list(APPEND AMDIS_INCLUDE_DIRS ${MPI_INCLUDE_PATH}) - - find_library(PARMETIS_LIB parmetis) - if(PARMETIS_LIB) - list(APPEND AMDIS_LIBRARIES ${PARMETIS_LIB}) - else(PARMETIS_LIB) - message(FATAL_ERROR "could not find the parmetis libraries needed by amdis") - endif(PARMETIS_LIB) - find_library(METIS_LIB metis) - if(METIS_LIB) - list(APPEND AMDIS_LIBRARIES ${METIS_LIB}) - else(METIS_LIB) - message(FATAL_ERROR "could not find the metis libraries needed by amdis") - endif(METIS_LIB) - - if(AMDIS_HAS_PARALLEL_DOMAIN STREQUAL "PETSC") - set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${AMDIS_DIR}) - set(PETSC_EXECUTABLE_RUNS ON) - find_package(PETSc REQUIRED) - if(PETSC_FOUND) - list(APPEND AMDIS_LIBRARIES ${PETSC_LIBRARY_SYS} ${PETSC_LIBRARIES}) - list(APPEND AMDIS_INCLUDE_DIRS ${PETSC_INCLUDES}) - else() - message(FATAL_ERROR "Could not find PETSc!") - endif(PETSC_FOUND) - elseif(AMDIS_HAS_PARALLEL_DOMAIN STREQUAL "PMTL") - find_package(MTL REQUIRED) - list(APPEND AMDIS_LIBRARIES ${MTL_LIBRARIES}) - endif() - -elseif(AMDIS_NEED_SEQ_PETSC) - find_package(MPI REQUIRED) - if(MPI_FOUND) - list(APPEND AMDIS_LIBRARIES ${MPI_LIBRARIES}) - list(APPEND AMDIS_COMPILEFLAGS ${MPI_COMPILE_FLAGS}) - list(APPEND AMDIS_INCLUDE_DIRS ${MPI_INCLUDE_PATH}) - endif(MPI_FOUND) - - set(CMAKE_MODULE_PATH ${AMDIS_DIR}) - set(PETSC_EXECUTABLE_RUNS ON) - find_package(PETSc REQUIRED) - if(PETSC_FOUND) - list(APPEND AMDIS_LIBRARIES ${PETSC_LIBRARY_SYS} ${PETSC_LIBRARIES}) - list(APPEND AMDIS_INCLUDE_DIRS ${PETSC_INCLUDES}) - else() - message(FATAL_ERROR "Could not find PETSc!") - endif(PETSC_FOUND) -endif() - -if(AMDIS_NEED_HYPRE) - find_package(HYPRE REQUIRED HINTS ${AMDIS_DIR}) - if(HAVE_HYPRE) - if(NOT MPI_FOUND) - find_package(MPI REQUIRED) - if(MPI_FOUND) - list(APPEND AMDIS_LIBRARIES ${MPI_LIBRARIES}) - list(APPEND AMDIS_COMPILEFLAGS ${MPI_COMPILE_FLAGS}) - list(APPEND AMDIS_INCLUDE_DIRS ${MPI_INCLUDE_PATH}) - endif() - endif() - list(APPEND AMDIS_INCLUDE_DIRS ${HYPRE_INCLUDE_DIRECTORIES}) - list(APPEND AMDIS_COMPILEFLAGS "-DMTL_HAS_HYPRE") - list(APPEND AMDIS_LIBRARIES ${HYPRE_LIBRARIES} ) - endif() -endif(AMDIS_NEED_HYPRE) - -if(AMDIS_OPENMP) - if(CMAKE_CXX_COMPILER MATCHES ".*icpc") - list(APPEND AMDIS_COMPILEFLAGS "-openmp") - list(APPEND AMDIS_LIBRARIES "-openmp") - else() - list(APPEND AMDIS_COMPILEFLAGS "-fopenmp") - list(APPEND AMDIS_LIBRARIES "-fopenmp") - endif() -endif(AMDIS_OPENMP) - - -# AMDiS-Extensions library -# ------------------------ -if(AMDIS_NEED_EXTENSIONS) - list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/extensions) - list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/extensions/time) - list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/extensions/nanoflann) - list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/extensions/pugixml) - - find_library(_EXTENSIONS_LIB extensions PATHS ${AMDIS_LIBRARY_DIR} ${AMDIS_DIR}/../../lib/amdis/) - if(_EXTENSIONS_LIB) + +# try to detect the AMDiS include directory +# ------------------------------------------- +find_file(_AMDIS_H AMDiS.h PATHS ${AMDIS_DIR}/../../include/amdis/) +if (_AMDIS_H) + get_filename_component(AMDIS_INCLUDE_DIR ${_AMDIS_H} PATH CACHE) + list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}) +else () + message(ERROR "Could not detect the AMDiS include directory. Please set the variable AMDIS_INCLUDE_DIR to the directory containing the AMDiS headers.") +endif () +unset(_AMDIS_H CACHE) + + +# MTL4 libraries +# -------------------- +enable_mtl4(AMDIS_COMPILEFLAGS AMDIS_INCLUDE_DIRS AMDIS_LIBRARIES ON) + + +if (AMDIS_FIND_REQUIRED_PARALLEL AND AMDIS_FIND_REQUIRED_SEQUENTIAL) + message(WARNING "Choose either SEQUENTIAL or PARALLEL as component, not both! Falling back to the default SEQUENTIAL.") + set(AMDIS_FIND_REQUIRED_PARALLEL OFF) +endif () + +# enable component PARALLEL +# ------------------------- +if (AMDIS_FIND_REQUIRED_PARALLEL) + set(AMDIS_HAS_PARALLEL_DOMAIN ON) + set(POSTFIX "-parallel") +else () + set(AMDIS_HAS_PARALLEL_DOMAIN OFF) + set(POSTFIX "") +endif (AMDIS_FIND_REQUIRED_PARALLEL) + + +# AMDiS base libraries +# -------------------- +find_library(_AMDIS_LIB amdis${POSTFIX} PATHS ${AMDIS_DIR}/../../lib/amdis/) +if (_AMDIS_LIB) + list(APPEND AMDIS_LIBRARIES ${_AMDIS_LIB}) +else () + message(ERROR "Could not detect the AMDiS${POSTFIX} library. Please set the variable _AMDIS_LIB to the AMDiS${POSTFIX} library.") +endif () +unset(_AMDIS_LIB CACHE) + + +# Boost libraries +# --------------- +if (NOT BOOST_ROOT) + set(BOOST_ROOT @BOOST_ROOT@) +endif (NOT BOOST_ROOT) +if (NOT BOOST_LIBRARYDIR) + set(BOOST_LIBRARYDIR @BOOST_LIBRARYDIR@) +endif (NOT BOOST_LIBRARYDIR) +enable_boost(AMDIS_COMPILEFLAGS AMDIS_INCLUDE_DIRS AMDIS_LIBRARIES ON) + + +# umfpack library +# -------------------- +if (AMDIS_NEED_UMFPACK) + set(AMDIS_SuiteSparse_DIR @SuiteSparse_DIR@) + set(AMDIS_UMFPACK_INCLUDE_DIR @UMFPACK_INCLUDE_DIRS@) + set(AMDIS_UMFPACK_LIB_DIR ${AMDIS_UMFPACK_INCLUDE_DIR}/../include) + enable_umfpack(AMDIS_COMPILEFLAGS AMDIS_INCLUDE_DIRS AMDIS_LIBRARIES ON) +endif (AMDIS_NEED_UMFPACK) + + +# amdis extensions +# ---------------- +if (AMDIS_NEED_EXTENSIONS) + find_library(_EXTENSIONS_LIB amdis${POSTFIX}_extensions PATHS ${AMDIS_DIR}/../../lib/amdis/) + if (_EXTENSIONS_LIB) + list(APPEND AMDIS_INCLUDE_DIRS + ${AMDIS_INCLUDE_DIR}/extensions + ${AMDIS_INCLUDE_DIR}/extensions/nanoflann + ${AMDIS_INCLUDE_DIR}/extensions/pugixml + ${AMDIS_INCLUDE_DIR}/extensions/time) + list(APPEND AMDIS_COMPILEFLAGS "-DHAVE_EXTENSIONS=1") list(APPEND AMDIS_LIBRARIES ${_EXTENSIONS_LIB}) - endif() + if (AMDIS_NEED_BASE_PROBLEMS) + list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/extensions/base_problems) + endif (AMDIS_NEED_BASE_PROBLEMS) + else () + message(FATAL_ERROR "Extensions library not found") + endif () unset(_EXTENSIONS_LIB CACHE) -endif(AMDIS_NEED_EXTENSIONS) - -# AMDiS BaseProblems libraries -# ---------------------------- -if(AMDIS_NEED_BASE_PROBLEMS) - list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/base_problems) - - find_library(_BASE_PROBLEMS_LIB base_problems PATHS ${AMDIS_LIBRARY_DIR} ${AMDIS_DIR}/../../lib/amdis/) - if(_BASE_PROBLEMS_LIB) - list(APPEND AMDIS_LIBRARIES ${_BASE_PROBLEMS_LIB}) - endif() - unset(_BASE_PROBLEMS_LIB CACHE) -endif(AMDIS_NEED_BASE_PROBLEMS) - -# ---------------------------- - -find_library(_REINIT_LIB reinit PATHS ${AMDIS_LIBRARY_DIR} ${AMDIS_DIR}/../../lib/amdis/) -find_library(_COMPOSITE_FEM_LIB compositeFEM PATHS ${AMDIS_LIBRARY_DIR} ${AMDIS_DIR}/../../lib/amdis/) -find_library(_MUPARSER_LIB muparser PATHS ${AMDIS_LIBRARY_DIR} ${AMDIS_DIR}/../../lib/amdis/) - -if(_REINIT_LIB) - list(APPEND AMDIS_LIBRARIES ${_REINIT_LIB}) -else() - message(ERROR "Reinit library not found") -endif() -unset(_REINIT_LIB CACHE) -if(_COMPOSITE_FEM_LIB) - list(APPEND AMDIS_LIBRARIES ${_COMPOSITE_FEM_LIB}) -else() - message(ERROR "CompositeFEM library not found") -endif() -unset(_COMPOSITE_FEM_LIB CACHE) -if(_MUPARSER_LIB) +endif (AMDIS_NEED_EXTENSIONS) + + +# reinit library +# -------------- +if (AMDIS_NEED_REINIT) + find_library(_REINIT_LIB amdis${POSTFIX}_reinit PATHS ${AMDIS_DIR}/../../lib/amdis/) + if (_REINIT_LIB) + list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/reinit) + list(APPEND AMDIS_LIBRARIES ${_REINIT_LIB}) + else () + message(FATAL_ERROR "Reinit library not found") + endif () + unset(_REINIT_LIB CACHE) +endif (AMDIS_NEED_REINIT) + + +# compositeFEM library +# -------------------- +if (AMDIS_NEED_COMPOSITE_FEM) + find_library(_COMPOSITE_FEM_LIB amdis${POSTFIX}_compositeFEM PATHS ${AMDIS_DIR}/../../lib/amdis/) + if (_COMPOSITE_FEM_LIB) + list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/compositeFEM) + list(APPEND AMDIS_LIBRARIES ${_COMPOSITE_FEM_LIB}) + else () + message(FATAL_ERROR "CompositeFEM library not found") + endif () + unset(_COMPOSITE_FEM_LIB CACHE) +endif (AMDIS_NEED_COMPOSITE_FEM) + + +# muparser library +# -------------------- +find_library(_MUPARSER_LIB muparser PATHS ${AMDIS_DIR}/../../lib/amdis/) +if (_MUPARSER_LIB) + list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/muparser) list(APPEND AMDIS_LIBRARIES ${_MUPARSER_LIB}) -else() +else () message(ERROR "MuParser library not found") -endif() +endif () unset(_MUPARSER_LIB CACHE) -# ---------------------------- - -if(AMDIS_NEED_UMFPACK) - if (WIN32) - set(SuiteSparse_USE_LAPACK_BLAS ON) - endif (WIN32) - find_package(SuiteSparse QUIET) - if (SuiteSparse_FOUND) - include(${USE_SuiteSparse}) - list(APPEND AMDIS_LIBRARIES ${SuiteSparse_LIBRARIES}) - list(APPEND AMDIS_INCLUDE_DIRS ${SuiteSparse_INCLUDE_DIR} ${SuiteSparse_METIS_INCLUDE_DIR}) - message("AMDIS_INCLUDE_DIRS = ${AMDIS_INCLUDE_DIRS}") - else (SuiteSparse_FOUND) - - set(AMDIS_UMFPACK_PATH @UMFPACK_PATH@) - list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_UMFPACK_PATH}) - find_library(UMFPACK_LIB umfpack - HINTS ENV LIBRARY_PATH - DOC "The UMFPACK library") - if(UMFPACK_LIB) - list(APPEND AMDIS_LIBRARIES ${UMFPACK_LIB}) - else() - message(FATAL_ERROR "Could not find the UMFPACK library") - endif() - if("$ENV{BLA_VENDOR}" STREQUAL "ACML") - find_library(ACML_LIBRARY acml HINTS ENV ACML_LIB) - if(ACML_LIBRARY) - list(APPEND AMDIS_LIBRARIES ${ACML_LIBRARY}) #fortran ffio m rt) #needed for open64 - else() - message(FATAL_ERROR "could not find the acml libraries, required by acml blas") - endif(ACML_LIBRARY) - else() - find_library(BLAS_LIBRARY NAMES "blas" "goto" "mkl" - HINTS ENV MKL_LIB - DOC "The BLAS library") - if(BLAS_LIBRARY) - list(APPEND AMDIS_LIBRARIES ${BLAS_LIBRARY}) - list(APPEND AMDIS_LIBRARY_DIRS ${BLAS_LIBRARY_DIR}) - else() - find_package(BLAS) - if(BLAS_FOUND) - list(APPEND AMDIS_LIBRARIES ${BLAS_LIBRARIES}) - else() - message(STATUS "Could not find the BLAS library. Please set the variable BLAS_LIBRARY to the blas library with full path") - endif() - endif() - endif("$ENV{BLA_VENDOR}" STREQUAL "ACML") - - find_library(AMD_LIB amd - HINTS ENV LIBRARY_PATH - DOC "The AMD library") - if(AMD_LIB) - list(APPEND AMDIS_LIBRARIES ${AMD_LIB}) - else() - message(FATAL_ERROR "Could not find the AMD library.") - endif() - #check for if we need cholmod - set(_CHOLMOD_TEST_DIR ${CMAKE_BINARY_DIR}/CMakeFiles/cholmodTest/) - file(WRITE ${_CHOLMOD_TEST_DIR}/CMakeLists.txt "project(cholmodTest) - cmake_minimum_required(VERSION 2.8) - include_directories(${AMDIS_INCLUDE_DIRS}) - add_executable(cholmodTest cholmodTest.cpp) - target_link_libraries(cholmodTest ${AMDIS_LIBRARIES})") - file(WRITE ${_CHOLMOD_TEST_DIR}/cholmodTest.cpp "#include - - #include \"umfpack.h\" - - int n = 5 ; - - int Ap [ ] = {0, 2, 5, 9, 10, 12} ; - - int Ai [ ] = { 0, 1, 0, 2, 4, 1, 2, 3, 4, 2, 1, 4} ; - - double Ax [ ] = {2., 3., 3., -1., 4., 4., -3., 1., 2., 2., 6., 1.} ; - - double b [ ] = {8., 45., -3., 3., 19.} ; - - double x [5] ; - - int main (void) - - { - - double *null = (double *) NULL ; - - int i ; - - void *Symbolic, *Numeric ; - - double stats [2]; - umfpack_tic (stats); - - (void) umfpack_di_symbolic (n, n, Ap, Ai, Ax, &Symbolic, null, null) ; - - (void) umfpack_di_numeric (Ap, Ai, Ax, Symbolic, &Numeric, null, null) ; - - umfpack_di_free_symbolic (&Symbolic) ; - - (void) umfpack_di_solve (UMFPACK_A, Ap, Ai, Ax, x, b, Numeric, null, null) ; - - umfpack_di_free_numeric (&Numeric) ; - - umfpack_toc (stats); - - - return (0) ; - - }") - # "#include - # int main(int , char* argv[]) { double c[UMFPACK_CONTROL]; umfpack_dl_defaults(c); return 0;}") - try_compile(CHOLMOD_TEST ${_CHOLMOD_TEST_DIR}/build ${_CHOLMOD_TEST_DIR} cholmodTest - OUTPUT_VARIABLE CHOLMOD_OUT) - if(NOT CHOLMOD_TEST) - file(APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log "cholmodTest-output: \n ${CHOLMOD_OUT}") - find_library(CHOLMOD_LIB cholmod) - find_library(COLAMD_LIB colamd) - - if(CHOLMOD_LIB) - list(APPEND AMDIS_LIBRARIES ${CHOLMOD_LIB}) - else() - message(FATAL_ERROR "your umfpack seems to need cholmod, but cmake could not find it") - endif() - if(COLAMD_LIB) - list(APPEND AMDIS_LIBRARIES ${COLAMD_LIB}) - else() - message(FATAL_ERROR "your umfpack seems to need colamd, but cmake could not find it") - endif() - - #test with cholmod and colamd.. - file(WRITE ${_CHOLMOD_TEST_DIR}/CMakeLists.txt "project(cholmodTest) - cmake_minimum_required(VERSION 2.8) - include_directories(${AMDIS_INCLUDE_DIRS}) - add_executable(cholmodTest cholmodTest.cpp) - target_link_libraries(cholmodTest ${AMDIS_LIBRARIES})") - try_compile(CHOLMOD_TEST2 ${_CHOLMOD_TEST_DIR}/build ${_CHOLMOD_TEST_DIR} cholmodTest - OUTPUT_VARIABLE CHOLMOD_OUT) - if(NOT CHOLMOD_TEST2) - file(APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log "cholmodTest2-output: \n ${CHOLMOD_OUT}") - find_library(SUITESPARSECONFIG_LIB suitesparseconfig) - if(SUITESPARSECONFIG_LIB) - list(APPEND AMDIS_LIBRARIES ${SUITESPARSECONFIG_LIB}) - else() - message(STATUS "your umfpack seems to need suitesparseconfig, but cmake could not find it") - endif() - endif() - - endif() - endif () -endif(AMDIS_NEED_UMFPACK) - -# PNG library -# ----------- -if(AMDIS_NEED_PNG) - set(AMDIS_PNG_PATH @PNG_PATH@) - list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_PNG_PATH}) +# Additional libraries +# ================================================================================================== - find_library(PNG_LIB png - HINTS ENV LIBRARY_PATH - DOC "The PNG library") - if(PNG_LIB) - list(APPEND AMDIS_LIBRARIES ${PNG_LIB}) - else() - message(FATAL_ERROR "Could not find the PNG library") - endif() -endif(AMDIS_NEED_PNG) +if (AMDIS_HAS_PARALLEL_DOMAIN) + enable_mpi(AMDIS_COMPILEFLAGS AMDIS_INCLUDE_DIRS AMDIS_LIBRARIES ON) + enable_petsc(AMDIS_COMPILEFLAGS AMDIS_INCLUDE_DIRS AMDIS_LIBRARIES ON) + list(APPEND AMDIS_COMPILEFLAGS "-DHAVE_PARALLEL_DOMAIN_AMDIS=1") +endif (AMDIS_HAS_PARALLEL_DOMAIN) -# BDDCML-library +# Zoltan library # -------------- -if(AMDIS_NEED_BDDCML) - set(AMDIS_BDDCML_PATH @BDDCML_PATH@) - list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_BDDCML_PATH}) +if (AMDIS_NEED_ZOLTAN) + enable_zoltan(AMDIS_COMPILEFLAGS AMDIS_INCLUDE_DIRS AMDIS_LIBRARIES ON) +endif () - set(AMDIS_BDDCML_LIB @BDDCML_LIB@) - list(APPEND AMDIS_LIBRARIES ${AMDIS_BDDCML_LIB}) - set(AMDIS_BDDCML_LINK_LIST @BDDCML_LINK_LIST@) - list(APPEND AMDIS_LIBRARIES ${AMDIS_BDDCML_LINK_LIST}) -endif(AMDIS_NEED_BDDCML) +# BDDCML library +# -------------- +if (AMDIS_NEED_BDDCML) + enable_bddcml(AMDIS_COMPILEFLAGS AMDIS_INCLUDE_DIRS AMDIS_LIBRARIES ON) +endif () -# Zoltan library + +# Hypre library +# -------------- +if (AMDIS_NEED_HYPRE) + enable_hypre(AMDIS_COMPILEFLAGS AMDIS_INCLUDE_DIRS AMDIS_LIBRARIES ON) +endif () + +if (ENABLE_PNG) + enable_png(AMDIS_COMPILEFLAGS AMDIS_INCLUDE_DIRS AMDIS_LIBRARIES ON) +endif (ENABLE_PNG) + +# Sequential PETSc library # -------------- -if(AMDIS_NEED_ZOLTAN) - find_library(ZOLTAN_LIB zoltan - HINTS ENV LIBRARY_PATH - DOC "full path to the zoltan library") - - if(ZOLTAN_LIB) - list(APPEND AMDIS_LIBRARIES ${ZOLTAN_LIB}) - else() - message(FATAL_ERROR "Could not find zoltan library!") - endif() -endif() - - -if(${AMDIS_FIND_COMPONENTS} MATCHES umfpack ) - if(NOT AMDIS_NEED_UMFPACK) - set(AMDIS_umfpack_FOUND FALSE) - message(SEND_ERROR "The selected amdis was not compiled with umfpack") - endif() -endif() +if (AMDIS_NEED_SEQ_PETSC AND NOT AMDIS_HAS_PARALLEL_DOMAIN) + enable_mpi(AMDIS_COMPILEFLAGS AMDIS_INCLUDE_DIRS AMDIS_LIBRARIES ON) + enable_petsc(AMDIS_COMPILEFLAGS AMDIS_INCLUDE_DIRS AMDIS_LIBRARIES ON) + list(APPEND COMPILEFLAGS "-DHAVE_SEQ_PETSC=1") +endif () \ No newline at end of file diff --git a/AMDiS/cmake/AMDISUse.cmake b/AMDiS/cmake/AMDISUse.cmake index a80f9c805c0764a4080fde33cd20d93932e71401..b8f70ce059c49125d973cdbec4e31b352e4803d1 100644 --- a/AMDiS/cmake/AMDISUse.cmake +++ b/AMDiS/cmake/AMDISUse.cmake @@ -1,4 +1,3 @@ -# globally add compile options and include directories +# globally add compile options and include directories add_definitions(${AMDIS_COMPILEFLAGS}) include_directories(${AMDIS_INCLUDE_DIRS}) - diff --git a/AMDiS/cmake/CMakeLists.txt b/AMDiS/cmake/CMakeLists.txt index c90ddddb5afa9cd138cf10c721b42833e59816a3..67a892b4023f370ae38aa70822f310014396b7b6 100644 --- a/AMDiS/cmake/CMakeLists.txt +++ b/AMDiS/cmake/CMakeLists.txt @@ -1,539 +1,284 @@ -cmake_minimum_required(VERSION 2.8.10) -project(AMDIS) -cmake_policy(SET CMP0017 OLD) -if(POLICY CMP0042) - cmake_policy(SET CMP0042 NEW) -endif() -if(POLICY CMP0054) - cmake_policy(SET CMP0054 NEW) -endif() - -SET(LIB_DIR ${AMDIS_SOURCE_DIR}/lib) -SET(SOURCE_DIR ${AMDIS_SOURCE_DIR}/src) - -#define the build type, empty can be everything and nothing -if(CMAKE_BUILD_TYPE STREQUAL "") - set(CMAKE_BUILD_TYPE "Release") -endif() - -#TODO: use the cmake build type -SET(MTL_INCLUDE_DIR ${LIB_DIR}/mtl4/ CACHE PATH "mtl4 directory") - -set(CurrentRevision "1.1") -if(NOT AMDIS_MAJOR) - set(AMDIS_MAJOR "1") -endif() -if(NOT AMDIS_MINOR) - set(AMDIS_MINOR "1") -endif() -list(APPEND COMPILEFLAGS "-DAMDIS_VERSION=${CurrentRevision}") - - -if(CMAKE_CXX_COMPILER MATCHES ".*icpc") - Message("Compiler: Intel") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -diag-disable 654 -diag-disable 858") -endif() - - -SET(ENABLE_PARALLEL_DOMAIN "OFF" CACHE STRING "use parallel domain decomposition. please set to one of: PMTL, PETSC, OFF" ) -option(ENABLE_CXX11 "Enable C++11 compiler features" false) -option(ENABLE_SEQ_PETSC "Use sequential PETSc solvers" false) -option(ENABLE_UMFPACK "Use of UMFPACK solver" false) +cmake_minimum_required(VERSION 2.8.10 FATAL_ERROR) +project(AMDiS) + +set(BASE_DIR ${AMDiS_SOURCE_DIR}) +set(SOURCE_DIR ${BASE_DIR}/src) +list(APPEND CMAKE_MODULE_PATH ${BASE_DIR}/cmake) + +if (NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE "Release") +endif () + +# Include macros +include(enable_cxx11) +include(enable_mtl4) +include(enable_boost) +include(enable_umfpack) +include(enable_petsc) +include(enable_zoltan) +include(enable_bddcml) +include(enable_hypre) +include(enable_png) + +# ------------------------------------------------------------------------------ + +#some options to control the build process +option(ENABLE_PARALLEL_DOMAIN "Use parallel domain decomposition" false) +option(ENABLE_UMFPACK "Enable support for the UMFPACK solver" true) +option(ENABLE_EXTENSIONS "Use extensions for AMDiS" false) option(ENABLE_HYPRE "Use HYPRE AMG solver" false) -option(ENABLE_PNG "use png reader/writer" false) -option(ENABLE_BDDCML "Use of BDDCML library" false) -mark_as_advanced(ENABLE_BDDCML) -option(ENABLE_EXTENSIONS "Use extensions" false) -option(ENABLE_OPENMP "Use OpenMP" false) -option(ENABLE_COMPRESSION "Use output compression" false) -option(ENABLE_OUTPUT "AMDiS output printing, disable only for debugging!" true) -mark_as_advanced(ENABLE_OUTPUT) - - -find_package(Boost 1.44 REQUIRED) -if (Boost_FOUND) - list(APPEND AMDIS_INCLUDE_DIRS ${Boost_INCLUDE_DIR}) - message("boost lib-dirs: ${Boost_LIBRARY_DIRS}") - message("use the boost dir: ${Boost_INCLUDE_DIR}") - #if (WIN32) - #message("the windows find_boost does not set the boost library paths, please set it") - #SET(Boost_LIBRARY_DIRS CACHE PATH "The directory containing the boost libraries") - #endif (WIN32) - list(APPEND AMDIS_LINK_DIRS ${Boost_LIBRARY_DIRS}) -endif (Boost_FOUND) - - -SET(AMDIS_SRC ${SOURCE_DIR}/AdaptBase.cc - ${SOURCE_DIR}/AdaptInfo.cc - ${SOURCE_DIR}/AdaptInstationary.cc - ${SOURCE_DIR}/AdaptStationary.cc - ${SOURCE_DIR}/AMDiS.cc - ${SOURCE_DIR}/Assembler.cc - ${SOURCE_DIR}/BasisFunction.cc - ${SOURCE_DIR}/Boundary.cc - ${SOURCE_DIR}/BoundaryManager.cc - ${SOURCE_DIR}/BoundaryObject.cc - ${SOURCE_DIR}/Bubble.cc - ${SOURCE_DIR}/Cholesky.cc - ${SOURCE_DIR}/CoarseningManager.cc - ${SOURCE_DIR}/CoarseningManager1d.cc - ${SOURCE_DIR}/CoarseningManager2d.cc - ${SOURCE_DIR}/CoarseningManager3d.cc - ${SOURCE_DIR}/ComponentTraverseInfo.cc - ${SOURCE_DIR}/CouplingIterationInterface.cc - ${SOURCE_DIR}/CreatorMap.cc - ${SOURCE_DIR}/DOFAdmin.cc - ${SOURCE_DIR}/DOFIndexed.cc - ${SOURCE_DIR}/DOFMatrix.cc - ${SOURCE_DIR}/DOFVector.cc - ${SOURCE_DIR}/Debug.cc - ${SOURCE_DIR}/DirichletBC.cc - ${SOURCE_DIR}/DualTraverse.cc - ${SOURCE_DIR}/ElInfo.cc - ${SOURCE_DIR}/ElInfo1d.cc - ${SOURCE_DIR}/ElInfo2d.cc - ${SOURCE_DIR}/ElInfo3d.cc - ${SOURCE_DIR}/ElInfoStack.cc - ${SOURCE_DIR}/Element.cc - ${SOURCE_DIR}/ElementData.cc - ${SOURCE_DIR}/ElementDofIterator.cc - ${SOURCE_DIR}/ElementRegion_ED.cc - ${SOURCE_DIR}/FiniteElemSpace.cc - ${SOURCE_DIR}/FirstOrderAssembler.cc - ${SOURCE_DIR}/FirstOrderTerm.cc - ${SOURCE_DIR}/FixVec.cc - ${SOURCE_DIR}/Global.cc - ${SOURCE_DIR}/GlobalDOFNumbering.cc - ${SOURCE_DIR}/GlobalElementNumbering.cc - ${SOURCE_DIR}/Initfile.cc - ${SOURCE_DIR}/Lagrange.cc - ${SOURCE_DIR}/LeafData.cc - ${SOURCE_DIR}/Line.cc - ${SOURCE_DIR}/MacroElement.cc - ${SOURCE_DIR}/Marker.cc - ${SOURCE_DIR}/MatrixVector.cc - ${SOURCE_DIR}/Mesh.cc - ${SOURCE_DIR}/MeshStructure.cc - ${SOURCE_DIR}/Operator.cc - ${SOURCE_DIR}/OperatorTerm.cc - ${SOURCE_DIR}/Parametric.cc - ${SOURCE_DIR}/PeriodicBC.cc - ${SOURCE_DIR}/ProblemInstat.cc - ${SOURCE_DIR}/ProblemInterpol.cc - ${SOURCE_DIR}/ProblemStat.cc - ${SOURCE_DIR}/ProblemStatDbg.cc - ${SOURCE_DIR}/Projection.cc - ${SOURCE_DIR}/QPInfo.cc - ${SOURCE_DIR}/QPsiPhi.cc - ${SOURCE_DIR}/Quadrature.cc - ${SOURCE_DIR}/RCNeighbourList.cc - ${SOURCE_DIR}/Recovery.cc - ${SOURCE_DIR}/RefinementManager.cc - ${SOURCE_DIR}/RefinementManager1d.cc - ${SOURCE_DIR}/RefinementManager2d.cc - ${SOURCE_DIR}/RefinementManager3d.cc - ${SOURCE_DIR}/RobinBC.cc - ${SOURCE_DIR}/ScalableQuadrature.cc - ${SOURCE_DIR}/SecondOrderAssembler.cc - ${SOURCE_DIR}/SecondOrderTerm.cc - ${SOURCE_DIR}/Serializer.cc - ${SOURCE_DIR}/StandardProblemIteration.cc - ${SOURCE_DIR}/SubAssembler.cc - ${SOURCE_DIR}/SubElInfo.cc - ${SOURCE_DIR}/SubQuadrature.cc - ${SOURCE_DIR}/SurfaceQuadrature.cc - ${SOURCE_DIR}/SurfaceRegion_ED.cc - ${SOURCE_DIR}/SystemVector.cc - ${SOURCE_DIR}/Tetrahedron.cc - ${SOURCE_DIR}/Timer.cc - ${SOURCE_DIR}/Traverse.cc - ${SOURCE_DIR}/Triangle.cc - ${SOURCE_DIR}/VertexVector.cc - ${SOURCE_DIR}/ZeroOrderAssembler.cc - ${SOURCE_DIR}/ZeroOrderTerm.cc - ${SOURCE_DIR}/est/Estimator.cc - ${SOURCE_DIR}/est/RecoveryEstimator.cc - ${SOURCE_DIR}/est/ResidualEstimator.cc - ${SOURCE_DIR}/est/SimpleResidualEstimator.cc - ${SOURCE_DIR}/io/ArhReader.cc - ${SOURCE_DIR}/io/detail/ArhReader.cc - ${SOURCE_DIR}/io/Arh2Reader.cc - ${SOURCE_DIR}/io/Arh2Writer.cc - ${SOURCE_DIR}/io/Arh3Reader.cc - ${SOURCE_DIR}/io/Arh3Writer.cc - ${SOURCE_DIR}/io/detail/Arh2Reader.cc - ${SOURCE_DIR}/io/detail/ArhWriter.cc - ${SOURCE_DIR}/io/detail/Arh2Writer.cc - ${SOURCE_DIR}/io/detail/Arh3Reader.cc - ${SOURCE_DIR}/io/detail/Arh3Writer.cc - ${SOURCE_DIR}/io/DofWriter.cc - ${SOURCE_DIR}/io/ElementFileWriter.cc - ${SOURCE_DIR}/io/FileWriterInterface.cc - ${SOURCE_DIR}/io/FileWriter.cc - ${SOURCE_DIR}/io/GNUPlotWriter.cc - ${SOURCE_DIR}/io/MacroInfo.cc - ${SOURCE_DIR}/io/MacroReader.cc - ${SOURCE_DIR}/io/MacroWriter.cc - ${SOURCE_DIR}/io/PngReader.cc - ${SOURCE_DIR}/io/PngWriter.cc - ${SOURCE_DIR}/io/PovrayWriter.cc - ${SOURCE_DIR}/io/Spreadsheet.cc - ${SOURCE_DIR}/io/ValueReader.cc - ${SOURCE_DIR}/io/ValueWriter.cc - ${SOURCE_DIR}/io/VtkWriter.cc - ${SOURCE_DIR}/io/VtkVectorWriter.cc - ${SOURCE_DIR}/io/detail/VtkWriter.cc - ${SOURCE_DIR}/nonlin/ProblemNonLin.cc - ${SOURCE_DIR}/solver/SolverMatrix.cc - ${SOURCE_DIR}/time/RosenbrockAdaptInstationary.cc - ${SOURCE_DIR}/time/RosenbrockMethod.cc - ${SOURCE_DIR}/time/RosenbrockStationary.cc - ) - - -include(cmake/enable_cxx11.cmake) -include(cmake/enable_parallel_domain.cmake) -include(cmake/enable_seq_petsc.cmake) -include(cmake/enable_umfpack.cmake) -include(cmake/enable_hypre.cmake) -include(cmake/enable_png.cmake) -include(cmake/enable_bddcml.cmake) -include(cmake/enable_extensions.cmake) -include(cmake/enable_openmp.cmake) -include(cmake/SetSubMinorRevision.cmake) - -if(ENABLE_COMPRESSION) - list(APPEND COMPILEFLAGS "-DHAVE_COMPRESSION=1") -endif(ENABLE_COMPRESSION) - -if(NOT ENABLE_OUTPUT) - message(WARNING "AMDiS cout output disabled!") - list(APPEND COMPILEFLAGS "-DSUPPRESS_OUTPUT") -endif(NOT ENABLE_OUTPUT) - -if(ENABLE_MARMOT) - Message("please set marmotcc manually") -endif(ENABLE_MARMOT) - -# TODO: make composidte-fem and reinit a subproject -# add_subdirectory(${SOURCE_DIR}/compositeFEM [binarydir]) - -# composite fem includes -SET(COMPOSITE_SOURCE_DIR ${SOURCE_DIR}/compositeFEM) -SET(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 ) - -# reinit includes -set(REINIT_SOURCE_DIR ${SOURCE_DIR}/reinit) -file(GLOB REINIT_SRC ${REINIT_SOURCE_DIR}/*.cc) -list(APPEND AMDIS_INCLUDE_DIRS ${REINIT_SOURCE_DIR}) - -# muparser includes -set(MUPARSER_SOURCE_DIR ${AMDIS_SOURCE_DIR}/lib/muparser_v134) -file(GLOB MUPARSER_SRC ${MUPARSER_SOURCE_DIR}/src/*.cpp) -list(APPEND AMDIS_INCLUDE_DIRS ${MUPARSER_SOURCE_DIR}/include) - -# mtl4 includes -list(APPEND AMDIS_INCLUDE_DIRS ${MTL_INCLUDE_DIR}) -list(APPEND AMDIS_INCLUDE_DIRS ${SOURCE_DIR}) +option(ENABLE_PNG "Use png reader/writer" false) +option(ENABLE_SEQ_PETSC "Use sequential PETSc solvers" false) +# enable/disable some more features +option(ENABLE_COMPRESSION "Use output compression for vtu and arh files" true) +mark_as_advanced(ENABLE_COMPRESSION) + +option(ENABLE_REINIT "Compile reinit library" true) +mark_as_advanced(ENABLE_REINIT) + +option(ENABLE_COMPOSITE_FEM "Compile compositeFEM library" true) +mark_as_advanced(ENABLE_COMPOSITE_FEM) + +option(BUILD_SHARED_LIBS "Build all libraries as shared or static, default: shared" true) +mark_as_advanced(BUILD_SHARED_LIBS) + +if (MSVC) + set(BUILD_SHARED_LIBS false) + mark_as_advanced(BUILD_SHARED_LIBS) + message(WARNING "Currently we can only build static libraries with Visual Studio") +endif (MSVC) + +# ------------------------------------------------------------------------------ + +include_directories(${SOURCE_DIR}) +set(AMDIS_INCLUDE_DIRS "") +set(COMPILEFLAGS "") + +enable_cxx11(ENABLE_CXX11 COMPILEFLAGS) +if (ENABLE_CXX11) + list(APPEND COMPILEFLAGS "-DHAS_CXX11=1") +else () + list(APPEND COMPILEFLAGS "-DHAS_CXX11=0") +endif (ENABLE_CXX11) + +enable_mtl4(COMPILEFLAGS AMDIS_INCLUDE_DIRS _) +enable_boost(COMPILEFLAGS AMDIS_INCLUDE_DIRS _) + +if (ENABLE_UMFPACK) + enable_umfpack(COMPILEFLAGS AMDIS_INCLUDE_DIRS _) +endif (ENABLE_UMFPACK) + +if (ENABLE_PNG) + enable_png(COMPILEFLAGS AMDIS_INCLUDE_DIRS _) +endif (ENABLE_PNG) + +# ------------------------------------------------------------------------------ + +set(AMDIS_SRC "") +list(APPEND AMDIS_SRC + ${SOURCE_DIR}/AdaptBase.cc + ${SOURCE_DIR}/AdaptInfo.cc + ${SOURCE_DIR}/AdaptInstationary.cc + ${SOURCE_DIR}/AdaptStationary.cc + ${SOURCE_DIR}/AMDiS.cc + ${SOURCE_DIR}/Assembler.cc + ${SOURCE_DIR}/BasisFunction.cc + ${SOURCE_DIR}/Boundary.cc + ${SOURCE_DIR}/BoundaryManager.cc + ${SOURCE_DIR}/BoundaryObject.cc + ${SOURCE_DIR}/Bubble.cc + ${SOURCE_DIR}/Cholesky.cc + ${SOURCE_DIR}/CoarseningManager.cc + ${SOURCE_DIR}/CoarseningManager1d.cc + ${SOURCE_DIR}/CoarseningManager2d.cc + ${SOURCE_DIR}/CoarseningManager3d.cc + ${SOURCE_DIR}/ComponentTraverseInfo.cc + ${SOURCE_DIR}/CouplingIterationInterface.cc + ${SOURCE_DIR}/CreatorMap.cc + ${SOURCE_DIR}/DOFAdmin.cc + ${SOURCE_DIR}/DOFIndexed.cc + ${SOURCE_DIR}/DOFMatrix.cc + ${SOURCE_DIR}/DOFVector.cc + ${SOURCE_DIR}/DirichletBC.cc + ${SOURCE_DIR}/DualTraverse.cc + ${SOURCE_DIR}/ElInfo.cc + ${SOURCE_DIR}/ElInfo1d.cc + ${SOURCE_DIR}/ElInfo2d.cc + ${SOURCE_DIR}/ElInfo3d.cc + ${SOURCE_DIR}/ElInfoStack.cc + ${SOURCE_DIR}/Element.cc + ${SOURCE_DIR}/ElementData.cc + ${SOURCE_DIR}/ElementDofIterator.cc + ${SOURCE_DIR}/ElementRegion_ED.cc + ${SOURCE_DIR}/FiniteElemSpace.cc + ${SOURCE_DIR}/FirstOrderAssembler.cc + ${SOURCE_DIR}/FirstOrderTerm.cc + ${SOURCE_DIR}/FixVec.cc + ${SOURCE_DIR}/Global.cc + ${SOURCE_DIR}/Initfile.cc + ${SOURCE_DIR}/Lagrange.cc + ${SOURCE_DIR}/LeafData.cc + ${SOURCE_DIR}/Line.cc + ${SOURCE_DIR}/MacroElement.cc + ${SOURCE_DIR}/Marker.cc + ${SOURCE_DIR}/MatrixVector.cc + ${SOURCE_DIR}/Mesh.cc + ${SOURCE_DIR}/MeshStructure.cc + ${SOURCE_DIR}/Operator.cc + ${SOURCE_DIR}/OperatorTerm.cc + ${SOURCE_DIR}/Parametric.cc + ${SOURCE_DIR}/PeriodicBC.cc + ${SOURCE_DIR}/ProblemInstat.cc + ${SOURCE_DIR}/ProblemInterpol.cc + ${SOURCE_DIR}/ProblemStat.cc + ${SOURCE_DIR}/Projection.cc + ${SOURCE_DIR}/QPInfo.cc + ${SOURCE_DIR}/QPsiPhi.cc + ${SOURCE_DIR}/Quadrature.cc + ${SOURCE_DIR}/RCNeighbourList.cc + ${SOURCE_DIR}/Recovery.cc + ${SOURCE_DIR}/RefinementManager.cc + ${SOURCE_DIR}/RefinementManager1d.cc + ${SOURCE_DIR}/RefinementManager2d.cc + ${SOURCE_DIR}/RefinementManager3d.cc + ${SOURCE_DIR}/RobinBC.cc + ${SOURCE_DIR}/ScalableQuadrature.cc + ${SOURCE_DIR}/SecondOrderAssembler.cc + ${SOURCE_DIR}/SecondOrderTerm.cc + ${SOURCE_DIR}/Serializer.cc + ${SOURCE_DIR}/StandardProblemIteration.cc + ${SOURCE_DIR}/SubAssembler.cc + ${SOURCE_DIR}/SubElInfo.cc + ${SOURCE_DIR}/SubQuadrature.cc + ${SOURCE_DIR}/SurfaceQuadrature.cc + ${SOURCE_DIR}/SurfaceRegion_ED.cc + ${SOURCE_DIR}/SystemVector.cc + ${SOURCE_DIR}/Tetrahedron.cc + ${SOURCE_DIR}/Timer.cc + ${SOURCE_DIR}/Traverse.cc + ${SOURCE_DIR}/Triangle.cc + ${SOURCE_DIR}/VertexVector.cc + ${SOURCE_DIR}/ZeroOrderAssembler.cc + ${SOURCE_DIR}/ZeroOrderTerm.cc + ${SOURCE_DIR}/est/Estimator.cc + ${SOURCE_DIR}/est/RecoveryEstimator.cc + ${SOURCE_DIR}/est/ResidualEstimator.cc + ${SOURCE_DIR}/est/SimpleResidualEstimator.cc + ${SOURCE_DIR}/io/ArhReader.cc + ${SOURCE_DIR}/io/detail/ArhReader.cc + ${SOURCE_DIR}/io/Arh2Reader.cc + ${SOURCE_DIR}/io/Arh2Writer.cc + ${SOURCE_DIR}/io/Arh3Reader.cc + ${SOURCE_DIR}/io/Arh3Writer.cc + ${SOURCE_DIR}/io/detail/Arh2Reader.cc + ${SOURCE_DIR}/io/detail/ArhWriter.cc + ${SOURCE_DIR}/io/detail/Arh2Writer.cc + ${SOURCE_DIR}/io/detail/Arh3Reader.cc + ${SOURCE_DIR}/io/detail/Arh3Writer.cc + ${SOURCE_DIR}/io/DofWriter.cc + ${SOURCE_DIR}/io/ElementFileWriter.cc + ${SOURCE_DIR}/io/FileWriterInterface.cc + ${SOURCE_DIR}/io/FileWriter.cc + ${SOURCE_DIR}/io/GNUPlotWriter.cc + ${SOURCE_DIR}/io/MacroInfo.cc + ${SOURCE_DIR}/io/MacroReader.cc + ${SOURCE_DIR}/io/MacroWriter.cc + ${SOURCE_DIR}/io/PngReader.cc + ${SOURCE_DIR}/io/PngWriter.cc + ${SOURCE_DIR}/io/PovrayWriter.cc + ${SOURCE_DIR}/io/Spreadsheet.cc + ${SOURCE_DIR}/io/ValueReader.cc + ${SOURCE_DIR}/io/ValueWriter.cc + ${SOURCE_DIR}/io/VtkWriter.cc + ${SOURCE_DIR}/io/VtkVectorWriter.cc + ${SOURCE_DIR}/io/detail/VtkWriter.cc + ${SOURCE_DIR}/nonlin/ProblemNonLin.cc + ${SOURCE_DIR}/solver/SolverMatrix.cc + ${SOURCE_DIR}/time/RosenbrockAdaptInstationary.cc + ${SOURCE_DIR}/time/RosenbrockMethod.cc + ${SOURCE_DIR}/time/RosenbrockStationary.cc +# debugging files + ${SOURCE_DIR}/Debug.cc + ${SOURCE_DIR}/GlobalDOFNumbering.cc # not used by any other class + ${SOURCE_DIR}/GlobalElementNumbering.cc # not used by any other class + ${SOURCE_DIR}/ProblemStatDbg.cc +) + +include(amdis_parallel) +include(amdis_extensions) +include(muparser) + +# ------------------------------------------------------------------------------ +if (ENABLE_PARALLEL_DOMAIN) + set(POSTFIX "-parallel") +else () + set(POSTFIX "") +endif (ENABLE_PARALLEL_DOMAIN) + +if (ENABLE_COMPRESSION) + list(APPEND COMPILEFLAGS "-DHAVE_COMPRESSION=1") +endif (ENABLE_COMPRESSION) + +if (ENABLE_REINIT) + include(amdis_reinit) +endif (ENABLE_REINIT) + +if (ENABLE_COMPOSITE_FEM) + include(amdis_compositeFEM) +endif (ENABLE_COMPOSITE_FEM) + +if (ENABLE_SEQ_PETSC) + include(amdis_seq_petsc) +endif (ENABLE_SEQ_PETSC) + +if (MSVC) + list(APPEND COMPILEFLAGS "-D_SCL_SECURE_NO_WARNINGS" "-D_CRT_SECURE_NO_WARNINGS") +endif (MSVC) + +# ------------------------------------------------------------------------------ include_directories(${AMDIS_INCLUDE_DIRS}) - -if(WIN32) - add_library(amdis STATIC ${AMDIS_SRC} ${PARALLEL_DOMAIN_AMDIS_SRC}) - add_library(compositeFEM STATIC ${COMPOSITE_FEM_SRC}) - add_library(reinit STATIC ${REINIT_SRC}) - add_library(muparser STATIC ${MUPARSER_SRC}) -else() - add_library(amdis SHARED ${AMDIS_SRC} ${PARALLEL_DOMAIN_AMDIS_SRC}) - add_library(compositeFEM SHARED ${COMPOSITE_FEM_SRC}) - add_library(reinit SHARED ${REINIT_SRC}) - add_library(muparser SHARED ${MUPARSER_SRC}) -endif() - - -list(APPEND AMDIS_LIBS amdis ${Boost_LIBRARIES}) - -# some special treatements for Windows systems -# -------------------------------------------- -if(WIN32) - list(APPEND COMPILEFLAGS "-D_SCL_SECURE_NO_WARNINGS" "-D_CRT_SECURE_NO_WARNINGS") -endif(WIN32) - -# some special treatements for MacOS Systems -# ------------------------------------------ -if(CMAKE_SYSTEM_NAME MATCHES Darwin) - if(CMAKE_COMPILER_IS_GNUCXX OR ${CMAKE_CXX_COMPILER_ID} STREQUAL Clang) - SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS} -flat_namespace -single_module -undefined dynamic_lookup") - SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS} -flat_namespace -single_module -undefined dynamic_lookup") - - set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -bind_at_load -m64") - set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -bind_at_load -m64") - endif() -endif() - - -message("compileflags: ${COMPILEFLAGS}") add_definitions(${COMPILEFLAGS}) -#dont change this destination. the GUI depends on it to guess the buildsystem - -FILE(GLOB HEADERS "${SOURCE_DIR}/*.h") -INSTALL(FILES ${HEADERS} - DESTINATION include/amdis/) -list(APPEND deb_add_dirs "include/amdis") - -FILE(GLOB HEADERS "${SOURCE_DIR}/config/*.h*") -INSTALL(FILES ${HEADERS} - DESTINATION include/amdis/config/) -list(APPEND deb_add_dirs "include/amdis/config") - -FILE(GLOB HEADERS "${SOURCE_DIR}/*.hh") -INSTALL(FILES ${HEADERS} - DESTINATION include/amdis/) - -FILE(GLOB HEADERS "${SOURCE_DIR}/*.hpp") -INSTALL(FILES ${HEADERS} - DESTINATION include/amdis/) - -FILE(GLOB HEADERS "${SOURCE_DIR}/parallel/*.h") -INSTALL(FILES ${HEADERS} - DESTINATION include/amdis/parallel/) -list(APPEND deb_add_dirs "include/amdis/parallel") - -FILE(GLOB HEADERS "${SOURCE_DIR}/nonlin/*.h") -INSTALL(FILES ${HEADERS} - DESTINATION include/amdis/nonlin/) -list(APPEND deb_add_dirs "include/amdis/nonlin") - -FILE(GLOB HEADERS "${SOURCE_DIR}/est/*.h") -INSTALL(FILES ${HEADERS} - DESTINATION include/amdis/est/) -list(APPEND deb_add_dirs "include/amdis/est") - -FILE(GLOB HEADERS "${SOURCE_DIR}/expressions/*.h*") -INSTALL(FILES ${HEADERS} - DESTINATION include/amdis/expressions/) -list(APPEND deb_add_dirs "include/amdis/expressions") - -FILE(GLOB HEADERS "${SOURCE_DIR}/operations/*.h*") -INSTALL(FILES ${HEADERS} - DESTINATION include/amdis/operations/) -list(APPEND deb_add_dirs "include/amdis/operations") - -FILE(GLOB HEADERS "${SOURCE_DIR}/traits/*.h*") -INSTALL(FILES ${HEADERS} - DESTINATION include/amdis/traits/) -list(APPEND deb_add_dirs "include/amdis/traits") - -FILE(GLOB HEADERS "${SOURCE_DIR}/utility/*.h*") -INSTALL(FILES ${HEADERS} - DESTINATION include/amdis/utility/) -list(APPEND deb_add_dirs "include/amdis/utility") - -FILE(GLOB HEADERS "${SOURCE_DIR}/time/*.h") -INSTALL(FILES ${HEADERS} - DESTINATION include/amdis/time/) -list(APPEND deb_add_dirs "include/amdis/time") - -FILE(GLOB HEADERS "${SOURCE_DIR}/traits/*.h*") -INSTALL(FILES ${HEADERS} - DESTINATION include/amdis/traits/) -list(APPEND deb_add_dirs "include/amdis/traits") - -FILE(GLOB HEADERS "${SOURCE_DIR}/solver/*.h") -INSTALL(FILES ${HEADERS} - DESTINATION include/amdis/solver) -list(APPEND deb_add_dirs "include/amdis/solver") - -FILE(GLOB HEADERS "${SOURCE_DIR}/solver/*.hh") -INSTALL(FILES ${HEADERS} - DESTINATION include/amdis/solver) -list(APPEND deb_add_dirs "include/amdis/solver") - -FILE(GLOB HEADERS "${SOURCE_DIR}/solver/details/*.h") -INSTALL(FILES ${HEADERS} - DESTINATION include/amdis/solver/details) -list(APPEND deb_add_dirs "include/amdis/solver/details") - -FILE(GLOB HEADERS "${SOURCE_DIR}/solver/itl/*.hpp") -INSTALL(FILES ${HEADERS} - DESTINATION include/amdis/solver/itl) -list(APPEND deb_add_dirs "include/amdis/solver/itl") - -FILE(GLOB HEADERS "${SOURCE_DIR}/solver/details/*.h") -INSTALL(FILES ${HEADERS} - DESTINATION include/amdis/solver/details) -list(APPEND deb_add_dirs "include/amdis/solver/details") - - -FILE(GLOB HEADERS "${SOURCE_DIR}/io/*.h") -INSTALL(FILES ${HEADERS} - DESTINATION include/amdis/io) -list(APPEND deb_add_dirs "include/amdis/io") - -FILE(GLOB HEADERS "${SOURCE_DIR}/io/*.hh") -INSTALL(FILES ${HEADERS} - DESTINATION include/amdis/io) - -FILE(GLOB HEADERS "${SOURCE_DIR}/io/detail/*h") -INSTALL(FILES ${HEADERS} - DESTINATION include/amdis/io/detail) -list(APPEND deb_add_dirs "include/amdis/io/detail") - -FILE(GLOB HEADERS "${REINIT_SOURCE_DIR}/*.h") -INSTALL(FILES ${HEADERS} - DESTINATION include/amdis/reinit) -list(APPEND deb_add_dirs "include/amdis/reinit") - -FILE(GLOB HEADERS "${COMPOSITE_SOURCE_DIR}/*.h") -INSTALL(FILES ${HEADERS} - DESTINATION include/amdis/compositeFEM) -list(APPEND deb_add_dirs "include/amdis/compositeFEM") - -FILE(GLOB HEADERS "${MUPARSER_SOURCE_DIR}/include/*.h") -INSTALL(FILES ${HEADERS} - DESTINATION include/amdis/muparser) -list(APPEND deb_add_dirs "include/amdis/muparser") - -list(APPEND deb_add_dirs "lib/amdis") -install(TARGETS amdis compositeFEM reinit muparser - DESTINATION lib/amdis/ ) - -configure_file(${AMDIS_SOURCE_DIR}/cmake/AMDISConfig.cmake.in - ${AMDIS_BINARY_DIR}/AMDISConfig.cmake - @ONLY - ) - -INSTALL(FILES ${AMDIS_BINARY_DIR}/AMDISConfig.cmake - DESTINATION share/amdis/) -list(APPEND deb_add_dirs "share/amdis/") - -FILE(GLOB CMAKE_FILES "${AMDIS_SOURCE_DIR}/cmake/*.cmake") -INSTALL(FILES ${CMAKE_FILES} - DESTINATION share/amdis/) - -#install mtl -INSTALL(DIRECTORY ${AMDIS_SOURCE_DIR}/lib/mtl4/ - DESTINATION include/amdis/mtl4/ - FILES_MATCHING PATTERN "*.hpp" - PATTERN ".svn" EXCLUDE - PATTERN ".svn/*" EXCLUDE - PATTERN "mtl4/libs" EXCLUDE - PATTERN "mtl4/extern" EXCLUDE - ) -FILE(GLOB_RECURSE mtl4_files - RELATIVE ${AMDIS_SOURCE_DIR}/lib/mtl4/boost/ - ${AMDIS_SOURCE_DIR}/lib/mtl4/boost/*.hpp) -foreach(mtl4_file in ${mtl4_files}) - get_filename_component(mtl4File_path ${mtl4_file} PATH) - list(APPEND deb_add_dirs "include/amdis/mtl4/boost/${mtl4File_path}") -endforeach(mtl4_file) - -#install documentation -FILE(GLOB DOCS "${AMDIS_SOURCE_DIR}/doc/*.pdf") -INSTALL(FILES ${DOCS} DESTINATION share/amdis/doc) -list(APPEND deb_add_dirs "share/amdis/doc") - -list(REMOVE_DUPLICATES deb_add_dirs) - -ENABLE_TESTING() -INCLUDE(CTest) -INCLUDE(Dart) -if(NOT CTEST_MODEL) - set(CTEST_MODEL "Experimental") -endif() -if( NOT N_TEST_PROC) - set(N_TEST_PROC "8") -endif() -configure_file(cmake/myMake.sh.in myMake.sh @ONLY) -configure_file(cmake/CTestScript.cmake.in CTestScript.cmake @ONLY) - - -# PACKAGES -# ======================================================== -set(CPACK_PACKAGE_NAME "AMDIS") -set(CPACK_PACKAGE_CONTACT "Andreas.Naumann@tu-dresden.de") -set(CPACK_PACKAGE_VERSION "${CurrentRevision}") -set(CPACK_GENERATOR "RPM" "DEB" "TGZ") -set(CPACK_INSTALL_PREFIX "/usr/") -set(CPACK_RESOURCE_FILE_LICENSE "${AMDIS_SOURCE_DIR}/license.opensource.txt") - -# library depends on boost, but boost libraries have version-number in name on some systems. -# so we have to find a workaround to enforce allowed boost versions -set(boost_ver ${Boost_MINOR_VERSION}) -math(EXPR boost_ver_start "${Boost_MINOR_VERSION}+1") -math(EXPR boost_ver_stop "${Boost_MINOR_VERSION}+10") - -set(boost_depends "libboost${Boost_MAJOR_VERSION}.${boost_ver}-dev (>= ${Boost_MAJOR_VERSION}.${boost_ver})") -set(boost_iostreams_depends "libboost-iostreams${Boost_MAJOR_VERSION}.${boost_ver}-dev (>= ${Boost_MAJOR_VERSION}.${boost_ver})") -set(boost_system_depends "libboost-system${Boost_MAJOR_VERSION}.${boost_ver}-dev (>= ${Boost_MAJOR_VERSION}.${boost_ver})") -set(boost_filesystem_depends "libboost-filesystem${Boost_MAJOR_VERSION}.${boost_ver}-dev (>= ${Boost_MAJOR_VERSION}.${boost_ver})") - -foreach(boost_ver RANGE ${boost_ver_start} ${boost_ver_stop}) - set(boost_depends "${boost_depends} | libboost${Boost_MAJOR_VERSION}.${boost_ver}-dev (>= ${Boost_MAJOR_VERSION}.${boost_ver})") - set(boost_iostreams_depends "${boost_iostreams_depends} | libboost-iostreams${Boost_MAJOR_VERSION}.${boost_ver}-dev (>= ${Boost_MAJOR_VERSION}.${boost_ver})") - set(boost_system_depends "${boost_system_depends} | libboost-system${Boost_MAJOR_VERSION}.${boost_ver}-dev (>= ${Boost_MAJOR_VERSION}.${boost_ver})") - set(boost_filesystem_depends "${boost_filesystem_depends} | libboost-filesystem${Boost_MAJOR_VERSION}.${boost_ver}-dev (>= ${Boost_MAJOR_VERSION}.${boost_ver})") -endforeach(boost_ver) - -configure_file(${AMDIS_SOURCE_DIR}/cmake/preinst.in - ${AMDIS_BINARY_DIR}/preinst - @ONLY) - -configure_file(${AMDIS_SOURCE_DIR}/cmake/postrm.in - ${AMDIS_BINARY_DIR}/postrm - @ONLY) - -#----Test if clang setup works---------------------------------------------------------------------- -set(COMPILER_VERSION "") -if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - exec_program(${CMAKE_C_COMPILER} ARGS "-v" OUTPUT_VARIABLE _clang_version_info) - string(REGEX REPLACE "^.*[ ]([0-9]+)\\.[0-9].*$" "\\1" CLANG_MAJOR "${_clang_version_info}") - string(REGEX REPLACE "^.*[ ][0-9]+\\.([0-9]).*$" "\\1" CLANG_MINOR "${_clang_version_info}") - set(COMPILER_VERSION "clang ${CLANG_MAJOR}.${CLANG_MINOR}") -endif() - -#---Obtain the major and minor version of the GNU compiler------------------------------------------- -if (CMAKE_COMPILER_IS_GNUCXX) - exec_program(${CMAKE_C_COMPILER} ARGS "-dumpversion" OUTPUT_VARIABLE _gcc_version_info) - string(REGEX REPLACE "^([0-9]+).*$" "\\1" GCC_MAJOR ${_gcc_version_info}) - string(REGEX REPLACE "^[0-9]+\\.([0-9]+).*$" "\\1" GCC_MINOR ${_gcc_version_info}) - string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*$" "\\1" GCC_PATCH ${_gcc_version_info}) - - if(GCC_PATCH MATCHES "\\.+") - set(GCC_PATCH "") - endif() - if(GCC_MINOR MATCHES "\\.+") - set(GCC_MINOR "") - endif() - if(GCC_MAJOR MATCHES "\\.+") - set(GCC_MAJOR "") - endif() - set(COMPILER_VERSION "gcc ${_gcc_version_info}") -endif() - -set(CPACK_RPM_PACKAGE_REQUIRES "boost-devel >= ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}, ${RPM_DEPEND_STR}") -set(CPACK_DEBIAN_PACKAGE_DEPENDS "${boost_depends},\\n ${boost_iostreams_depends},\\n ${boost_system_depends},\\n ${boost_filesystem_depends}") -set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "AMDiS (Adaptive Multi-Dimensional Simulations) - a C++ library to solve partial differential equations using adaptive finite elements. The main features of AMDiS are: - . - - full adaptive meshes in 1D, 2D and 3D - - adaptive time stepping strategies for time dependent equations - - uses high performance Krylov subspace solvers from MTL4 and the direct solvers UMFPACK and Intel's Pardiso - - parallelization of the overall finite element method with excelent scaling up to several thounds of processors - - uses PETSc for solving parallel distributed linear systems - - easy to use interface, no additional effort to run code in parallel! - . - The library is compiled with ${COMPILER_VERSION} and compiled/linked with boost ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}.") - -set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${AMDIS_BINARY_DIR}/preinst" "${AMDIS_BINARY_DIR}/postrm") - -include(CPack) +add_library(amdis${POSTFIX} ${AMDIS_SRC} ${PARALLEL_DOMAIN_AMDIS_SRC} ${EXTENSIONS_SRC}) +add_library(amdis${POSTFIX}_compositeFEM ${COMPOSITE_FEM_SRC}) +add_library(amdis${POSTFIX}_reinit ${REINIT_SRC}) + + +# specify how to install this target: +# ----------------------------------- +set(INSTALL_SUBDIRS . config nonlin est expressions operations traits + utility time solver solver/details solver/itl io io/detail) + +foreach (SUBDIR ${INSTALL_SUBDIRS}) + file(GLOB HEADERS "${SOURCE_DIR}/${SUBDIR}/*.h*") + install(FILES ${HEADERS} DESTINATION include/amdis/${SUBDIR}/) +endforeach () + +file(GLOB CMAKE_MACROS "${BASE_DIR}/cmake/enable_*.cmake") +install(FILES ${CMAKE_MACROS} DESTINATION share/amdis/) + +install(DIRECTORY ${BASE_DIR}/lib/mtl4/ DESTINATION include/amdis/mtl4/ + FILES_MATCHING PATTERN "*.hpp" + PATTERN ".svn" EXCLUDE + PATTERN ".svn/*" EXCLUDE + PATTERN "mtl4/libs" EXCLUDE + PATTERN "mtl4/extern" EXCLUDE) + +install(TARGETS + amdis${POSTFIX} + amdis${POSTFIX}_compositeFEM + amdis${POSTFIX}_reinit + DESTINATION lib/amdis/ ) + + +# generate configuration file: +# ---------------------------- +configure_file(${BASE_DIR}/cmake/AMDISConfig.cmake.in + ${AMDiS_BINARY_DIR}/AMDISConfig.cmake + @ONLY +) + +install(FILES ${AMDiS_BINARY_DIR}/AMDISConfig.cmake DESTINATION share/amdis/) +install(FILES ${BASE_DIR}/cmake/AMDISUse.cmake DESTINATION share/amdis/) diff --git a/AMDiS/cmake/CTestScript.cmake.in b/AMDiS/cmake/CTestScript.cmake.in deleted file mode 100644 index 7f7f2d221ee19f3729e6a7a965b1a948fbd26d87..0000000000000000000000000000000000000000 --- a/AMDiS/cmake/CTestScript.cmake.in +++ /dev/null @@ -1,12 +0,0 @@ -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() diff --git a/AMDiS/cmake/CompilerTest.cmake b/AMDiS/cmake/CompilerTest.cmake deleted file mode 100644 index 02275e0a7d0d56ec751371b1dd4716df341922e0..0000000000000000000000000000000000000000 --- a/AMDiS/cmake/CompilerTest.cmake +++ /dev/null @@ -1,93 +0,0 @@ - -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 struct A{}; int main(){A a;}") -file(WRITE ${COMPILER_TEST_DIR}/test_variadic_templ_fct.cpp - "template void foo(Ts... ts){}; int main(){foo(1, 2.0, 3.0f);}") -file(WRITE ${COMPILER_TEST_DIR}/test_alias_templates.cpp - "template struct A{}; template using B=A; int main(){B 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 diff --git a/AMDiS/cmake/CorrectWindowsPaths.cmake b/AMDiS/cmake/CorrectWindowsPaths.cmake new file mode 100644 index 0000000000000000000000000000000000000000..09bcdd67dcd04fd001d2b7acbd904b5014ebe42b --- /dev/null +++ b/AMDiS/cmake/CorrectWindowsPaths.cmake @@ -0,0 +1,14 @@ +# 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) + diff --git a/AMDiS/cmake/FindPETSc.cmake b/AMDiS/cmake/FindPETSc.cmake index 5a7483612d64cb27dee4f35025f897c610496a5a..2be7d1484ea5dbe6bee9a7d9c414588f4eb12039 100644 --- a/AMDiS/cmake/FindPETSc.cmake +++ b/AMDiS/cmake/FindPETSc.cmake @@ -1,6 +1,5 @@ # - Try to find PETSc # Once done this will define -# source: https://github.com/jedbrown/cmake-modules/blob/master/FindPETSc.cmake # # PETSC_FOUND - system has PETSc # PETSC_INCLUDES - the PETSc include directories @@ -10,8 +9,10 @@ # PETSC_MPIEXEC - Executable for running MPI programs # PETSC_VERSION - Version string (MAJOR.MINOR.SUBMINOR) # -# Hack: PETSC_VERSION currently decides on the version based on the -# layout. Otherwise we need to run C code to determine the version. +# Usage: +# find_package(PETSc COMPONENTS CXX) - required if build --with-clanguage=C++ --with-c-support=0 +# find_package(PETSc COMPONENTS C) - standard behavior of checking build using a C compiler +# find_package(PETSc) - same as above # # Setting these changes the behavior of the search # PETSC_DIR - directory in which PETSc resides @@ -21,6 +22,31 @@ # For details see the accompanying COPYING-CMAKE-SCRIPTS file. # +set(PETSC_VALID_COMPONENTS + C + CXX) + +if(NOT PETSc_FIND_COMPONENTS) + set(PETSC_LANGUAGE_BINDINGS "C") +else() + # Right now, this is designed for compatability with the --with-clanguage option, so + # only allow one item in the components list. + list(LENGTH ${PETSc_FIND_COMPONENTS} components_length) + if(${components_length} GREATER 1) + message(FATAL_ERROR "Only one component for PETSc is allowed to be specified") + endif() + # This is a stub for allowing multiple components should that time ever come. Perhaps + # to also test Fortran bindings? + foreach(component ${PETSc_FIND_COMPONENTS}) + list(FIND PETSC_VALID_COMPONENTS ${component} component_location) + if(${component_location} EQUAL -1) + message(FATAL_ERROR "\"${component}\" is not a valid PETSc component.") + else() + list(APPEND PETSC_LANGUAGE_BINDINGS ${component}) + endif() + endforeach() +endif() + function (petsc_get_version) if (EXISTS "${PETSC_DIR}/include/petscversion.h") file (STRINGS "${PETSC_DIR}/include/petscversion.h" vstrings REGEX "#define PETSC_VERSION_(RELEASE|MAJOR|MINOR|SUBMINOR|PATCH) ") @@ -43,12 +69,20 @@ function (petsc_get_version) endfunction () find_path (PETSC_DIR include/petsc.h - HINTS ENV PETSC_DIR + HINTS /usr/lib/petsc ENV PETSC_DIR PATHS - /usr/lib/petscdir/3.1 /usr/lib/petscdir/3.0.0 /usr/lib/petscdir/2.3.3 /usr/lib/petscdir/2.3.2 # Debian + # Debian paths + /usr/lib/petscdir/3.5.1 /usr/lib/petscdir/3.5 + /usr/lib/petscdir/3.4.2 /usr/lib/petscdir/3.4 + /usr/lib/petscdir/3.3 /usr/lib/petscdir/3.2 /usr/lib/petscdir/3.1 + /usr/lib/petscdir/3.0.0 /usr/lib/petscdir/2.3.3 /usr/lib/petscdir/2.3.2 + # MacPorts path + /opt/local/lib/petsc $ENV{HOME}/petsc DOC "PETSc Directory") +find_program (MAKE_EXECUTABLE NAMES make gmake) + if (PETSC_DIR AND NOT PETSC_ARCH) set (_petsc_arches $ENV{PETSC_ARCH} # If set, use environment variable first @@ -58,11 +92,11 @@ if (PETSC_DIR AND NOT PETSC_ARCH) foreach (arch ${_petsc_arches}) if (NOT PETSC_ARCH) find_path (petscconf petscconf.h - HINTS ${PETSC_DIR} - PATH_SUFFIXES ${arch}/include bmake/${arch} - NO_DEFAULT_PATH) + HINTS ${PETSC_DIR} + PATH_SUFFIXES ${arch}/include bmake/${arch} + NO_DEFAULT_PATH) if (petscconf) - set (PETSC_ARCH "${arch}" CACHE STRING "PETSc build architecture") + set (PETSC_ARCH "${arch}" CACHE STRING "PETSc build architecture") endif (petscconf) endif (NOT PETSC_ARCH) endforeach (arch) @@ -78,7 +112,10 @@ find_package_multipass (PETSc petsc_config_current # Determine whether the PETSc layout is old-style (through 2.3.3) or # new-style (>= 3.0.0) -if (EXISTS "${PETSC_DIR}/${PETSC_ARCH}/include/petscconf.h") # > 2.3.3 +if (EXISTS "${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/petscvariables") # > 3.5 + set (petsc_conf_rules "${PETSC_DIR}/lib/petsc/conf/rules") + set (petsc_conf_variables "${PETSC_DIR}/lib/petsc/conf/variables") +elseif (EXISTS "${PETSC_DIR}/${PETSC_ARCH}/include/petscconf.h") # > 2.3.3 set (petsc_conf_rules "${PETSC_DIR}/conf/rules") set (petsc_conf_variables "${PETSC_DIR}/conf/variables") elseif (EXISTS "${PETSC_DIR}/bmake/${PETSC_ARCH}/petscconf.h") # <= 2.3.3 @@ -87,9 +124,10 @@ elseif (EXISTS "${PETSC_DIR}/bmake/${PETSC_ARCH}/petscconf.h") # <= 2.3.3 elseif (PETSC_DIR) message (SEND_ERROR "The pair PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} do not specify a valid PETSc installation") endif () -petsc_get_version() if (petsc_conf_rules AND petsc_conf_variables AND NOT petsc_config_current) + petsc_get_version() + # Put variables into environment since they are needed to get # configuration (petscvariables) in the PETSc makefile set (ENV{PETSC_DIR} "${PETSC_DIR}") @@ -104,12 +142,12 @@ if (petsc_conf_rules AND petsc_conf_variables AND NOT petsc_config_current) include ${petsc_conf_rules} include ${petsc_conf_variables} show : - -@echo -n \${\${VARIABLE}} +\t-@echo -n \${\${VARIABLE}} ") macro (PETSC_GET_VARIABLE name var) set (${var} "NOTFOUND" CACHE INTERNAL "Cleared" FORCE) - execute_process (COMMAND ${CMAKE_MAKE_PROGRAM} --no-print-directory -f ${petsc_config_makefile} show VARIABLE=${name} + execute_process (COMMAND ${MAKE_EXECUTABLE} --no-print-directory -f ${petsc_config_makefile} show VARIABLE=${name} OUTPUT_VARIABLE ${var} RESULT_VARIABLE petsc_return) endmacro (PETSC_GET_VARIABLE) @@ -118,6 +156,7 @@ show : petsc_get_variable (PETSC_CCPPFLAGS petsc_cpp_line) petsc_get_variable (PETSC_INCLUDE petsc_include) petsc_get_variable (PCC petsc_cc) + petsc_get_variable (PCC_FLAGS petsc_cc_flags) petsc_get_variable (MPIEXEC petsc_mpiexec) # We are done with the temporary Makefile, calling PETSC_GET_VARIABLE after this point is invalid! file (REMOVE ${petsc_config_makefile}) @@ -126,11 +165,39 @@ show : # Extract include paths and libraries from compile command line resolve_includes (petsc_includes_all "${petsc_cpp_line}") + #on windows we need to make sure we're linking against the right + #runtime library + if (WIN32) + if (petsc_cc_flags MATCHES "-MT") + set(using_md False) + foreach(flag_var + CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE + CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO + CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE + CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) + if(${flag_var} MATCHES "/MD") + set(using_md True) + endif(${flag_var} MATCHES "/MD") + endforeach(flag_var) + if(${using_md} MATCHES "True") + message(WARNING "PETSc was built with /MT, but /MD is currently set. + See http://www.cmake.org/Wiki/CMake_FAQ#How_can_I_build_my_MSVC_application_with_a_static_runtime.3F") + endif(${using_md} MATCHES "True") + endif (petsc_cc_flags MATCHES "-MT") + endif (WIN32) + + include (CorrectWindowsPaths) + convert_cygwin_path(petsc_lib_dir) message (STATUS "petsc_lib_dir ${petsc_lib_dir}") macro (PETSC_FIND_LIBRARY suffix name) set (PETSC_LIBRARY_${suffix} "NOTFOUND" CACHE INTERNAL "Cleared" FORCE) # Clear any stale value, if we got here, we need to find it again - find_library (PETSC_LIBRARY_${suffix} NAMES ${name} HINTS ${petsc_lib_dir} NO_DEFAULT_PATH) + if (WIN32) + set (libname lib${name}) #windows expects "libfoo", linux expects "foo" + else (WIN32) + set (libname ${name}) + endif (WIN32) + find_library (PETSC_LIBRARY_${suffix} NAMES ${libname} HINTS ${petsc_lib_dir} NO_DEFAULT_PATH) set (PETSC_LIBRARIES_${suffix} "${PETSC_LIBRARY_${suffix}}") mark_as_advanced (PETSC_LIBRARY_${suffix}) endmacro (PETSC_FIND_LIBRARY suffix name) @@ -167,29 +234,42 @@ show : message (STATUS "Recognized PETSc install with single library for all packages") endif () - include (CheckCSourceRuns) + include(Check${PETSC_LANGUAGE_BINDINGS}SourceRuns) macro (PETSC_TEST_RUNS includes libraries runs) - multipass_c_source_runs ("${includes}" "${libraries}" " + if(${PETSC_LANGUAGE_BINDINGS} STREQUAL "C") + set(_PETSC_ERR_FUNC "CHKERRQ(ierr)") + elseif(${PETSC_LANGUAGE_BINDINGS} STREQUAL "CXX") + set(_PETSC_ERR_FUNC "CHKERRXX(ierr)") + endif() + if (PETSC_VERSION VERSION_GREATER 3.1) + set (_PETSC_TSDestroy "TSDestroy(&ts)") + else () + set (_PETSC_TSDestroy "TSDestroy(ts)") + endif () + + set(_PETSC_TEST_SOURCE " static const char help[] = \"PETSc test program.\"; -#include \"petscts.h\" +#include int main(int argc,char *argv[]) { PetscErrorCode ierr; TS ts; - ierr = PetscInitialize(&argc,&argv,0,help);CHKERRQ(ierr); - ierr = TSCreate(PETSC_COMM_WORLD,&ts);CHKERRQ(ierr); - ierr = TSSetFromOptions(ts);CHKERRQ(ierr); - ierr = TSDestroy(ts);CHKERRQ(ierr); - ierr = PetscFinalize();CHKERRQ(ierr); + ierr = PetscInitialize(&argc,&argv,0,help);${_PETSC_ERR_FUNC}; + ierr = TSCreate(PETSC_COMM_WORLD,&ts);${_PETSC_ERR_FUNC}; + ierr = TSSetFromOptions(ts);${_PETSC_ERR_FUNC}; + ierr = ${_PETSC_TSDestroy};${_PETSC_ERR_FUNC}; + ierr = PetscFinalize();${_PETSC_ERR_FUNC}; return 0; } -" ${runs}) +") + multipass_source_runs ("${includes}" "${libraries}" "${_PETSC_TEST_SOURCE}" ${runs} "${PETSC_LANGUAGE_BINDINGS}") if (${${runs}}) set (PETSC_EXECUTABLE_RUNS "YES" CACHE BOOL - "Can the system successfully run a PETSc executable? This variable can be manually set to \"YES\" to force CMake to accept a given PETSc configuration, but this will almost always result in a broken build. If you change PETSC_DIR, PETSC_ARCH, or PETSC_CURRENT you would have to reset this variable." FORCE) + "Can the system successfully run a PETSc executable? This variable can be manually set to \"YES\" to force CMake to accept a given PETSc configuration, but this will almost always result in a broken build. If you change PETSC_DIR, PETSC_ARCH, or PETSC_CURRENT you would have to reset this variable." FORCE) endif (${${runs}}) endmacro (PETSC_TEST_RUNS) + find_path (PETSC_INCLUDE_DIR petscts.h HINTS "${PETSC_DIR}" PATH_SUFFIXES include NO_DEFAULT_PATH) find_path (PETSC_INCLUDE_CONF petscconf.h HINTS "${PETSC_DIR}" PATH_SUFFIXES "${PETSC_ARCH}/include" "bmake/${PETSC_ARCH}" NO_DEFAULT_PATH) mark_as_advanced (PETSC_INCLUDE_DIR PETSC_INCLUDE_CONF) @@ -199,7 +279,7 @@ int main(int argc,char *argv[]) { if (petsc_works_minimal) message (STATUS "Minimal PETSc includes and libraries work. This probably means we are building with shared libs.") set (petsc_includes_needed "${petsc_includes_minimal}") - else (petsc_works_minimal) # Minimal includes fail, see if just adding full includes fixes it + else (petsc_works_minimal) # Minimal includes fail, see if just adding full includes fixes it petsc_test_runs ("${petsc_includes_all}" "${PETSC_LIBRARIES_TS}" petsc_works_allincludes) if (petsc_works_allincludes) # It does, we just need all the includes ( message (STATUS "PETSc requires extra include paths, but links correctly with only interface libraries. This is an unexpected configuration (but it seems to work fine).") @@ -207,21 +287,21 @@ int main(int argc,char *argv[]) { else (petsc_works_allincludes) # We are going to need to link the external libs explicitly resolve_libraries (petsc_libraries_external "${petsc_libs_external}") foreach (pkg SYS VEC MAT DM KSP SNES TS ALL) - list (APPEND PETSC_LIBRARIES_${pkg} ${petsc_libraries_external}) + list (APPEND PETSC_LIBRARIES_${pkg} ${petsc_libraries_external}) endforeach (pkg) petsc_test_runs ("${petsc_includes_minimal}" "${PETSC_LIBRARIES_TS}" petsc_works_alllibraries) if (petsc_works_alllibraries) - message (STATUS "PETSc only need minimal includes, but requires explicit linking to all dependencies. This is expected when PETSc is built with static libraries.") - set (petsc_includes_needed ${petsc_includes_minimal}) + message (STATUS "PETSc only need minimal includes, but requires explicit linking to all dependencies. This is expected when PETSc is built with static libraries.") + set (petsc_includes_needed ${petsc_includes_minimal}) else (petsc_works_alllibraries) - # It looks like we really need everything, should have listened to Matt - set (petsc_includes_needed ${petsc_includes_all}) - petsc_test_runs ("${petsc_includes_all}" "${PETSC_LIBRARIES_TS}" petsc_works_all) - if (petsc_works_all) # We fail anyways - message (STATUS "PETSc requires extra include paths and explicit linking to all dependencies. This probably means you have static libraries and something unexpected in PETSc headers.") - else (petsc_works_all) # We fail anyways - message (STATUS "PETSc could not be used, maybe the install is broken.") - endif (petsc_works_all) + # It looks like we really need everything, should have listened to Matt + set (petsc_includes_needed ${petsc_includes_all}) + petsc_test_runs ("${petsc_includes_all}" "${PETSC_LIBRARIES_TS}" petsc_works_all) + if (petsc_works_all) # We fail anyways + message (STATUS "PETSc requires extra include paths and explicit linking to all dependencies. This probably means you have static libraries and something unexpected in PETSc headers.") + else (petsc_works_all) # We fail anyways + message (STATUS "PETSc could not be used, maybe the install is broken.") + endif (petsc_works_all) endif (petsc_works_alllibraries) endif (petsc_works_allincludes) endif (petsc_works_minimal) diff --git a/AMDiS/cmake/FindPackageMultipass.cmake b/AMDiS/cmake/FindPackageMultipass.cmake index 7199e026db92465e81d2e730a4720a722fce4ff4..fbf06a7f0fc3aa20a0387f091eac4f74e7ffdab2 100644 --- a/AMDiS/cmake/FindPackageMultipass.cmake +++ b/AMDiS/cmake/FindPackageMultipass.cmake @@ -21,7 +21,14 @@ # # Make temporary files, run programs, etc, to determine FOO_INCLUDES and FOO_LIBRARIES # 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) +# 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 # because parent variables have made old cache entries stale. @@ -39,7 +46,7 @@ macro (FIND_PACKAGE_MULTIPASS _name _current) # The name of the stored value for the given state set (_stored_var PACKAGE_MULTIPASS_${_NAME}_${_state}) if (NOT "${${_stored_var}}" STREQUAL "${${_NAME}_${_state}}") - set (_states_current "NO") + set (_states_current "NO") endif (NOT "${${_stored_var}}" STREQUAL "${${_NAME}_${_state}}") set (${_stored_var} "${${_NAME}_${_state}}" CACHE INTERNAL "Stored state for ${_name}." FORCE) list (REMOVE_AT _args 0) @@ -61,7 +68,7 @@ macro (FIND_PACKAGE_MULTIPASS _name _current) if (_cmd STREQUAL "DEPENDENTS") list (REMOVE_AT _args 0) foreach (dep ${_args}) - set (${_NAME}_${dep} "NOTFOUND" CACHE INTERNAL "Cleared" FORCE) + set (${_NAME}_${dep} "NOTFOUND" CACHE INTERNAL "Cleared" FORCE) endforeach (dep) endif (_cmd STREQUAL "DEPENDENTS") set (${_NAME}_FOUND "NOTFOUND" CACHE INTERNAL "Cleared" FORCE) @@ -70,9 +77,9 @@ macro (FIND_PACKAGE_MULTIPASS _name _current) endmacro (FIND_PACKAGE_MULTIPASS) -macro (MULTIPASS_C_SOURCE_RUNS includes libraries source runs) - include (CheckCSourceRuns) - # This is a ridiculous hack. CHECK_C_SOURCE_* thinks that if the +macro (MULTIPASS_SOURCE_RUNS includes libraries source runs language) + include (Check${language}SourceRuns) + # This is a ridiculous hack. CHECK_${language}_SOURCE_* thinks that if the # *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 # 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) set (testname MULTIPASS_TEST_${MULTIPASS_TEST_COUNT}_${runs}) set (CMAKE_REQUIRED_INCLUDES ${includes}) 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}}") +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) diff --git a/AMDiS/cmake/HYPREConfig.cmake b/AMDiS/cmake/HYPREConfig.cmake deleted file mode 100644 index 6520d6e3013a992dbb752f0d827e6a224d0107c9..0000000000000000000000000000000000000000 --- a/AMDiS/cmake/HYPREConfig.cmake +++ /dev/null @@ -1,21 +0,0 @@ -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() diff --git a/AMDiS/cmake/PETScConfig.cmake b/AMDiS/cmake/PETScConfig.cmake deleted file mode 100644 index a082857accf24d41b2516c24778f71088cc532b5..0000000000000000000000000000000000000000 --- a/AMDiS/cmake/PETScConfig.cmake +++ /dev/null @@ -1,251 +0,0 @@ -# - Try to find PETSc -# Once done this will define -# source: https://github.com/jedbrown/cmake-modules/blob/master/FindPETSc.cmake -# -# PETSC_FOUND - system has PETSc -# PETSC_INCLUDES - the PETSc include directories -# PETSC_LIBRARIES - Link these to use PETSc -# PETSC_COMPILER - Compiler used by PETSc, helpful to find a compatible MPI -# PETSC_DEFINITIONS - Compiler switches for using PETSc -# PETSC_MPIEXEC - Executable for running MPI programs -# PETSC_VERSION - Version string (MAJOR.MINOR.SUBMINOR) -# -# Hack: PETSC_VERSION currently decides on the version based on the -# layout. Otherwise we need to run C code to determine the version. -# -# Setting these changes the behavior of the search -# PETSC_DIR - directory in which PETSc resides -# PETSC_ARCH - build architecture -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. -# - -function (petsc_get_version) - if (EXISTS "${PETSC_DIR}/include/petscversion.h") - file (STRINGS "${PETSC_DIR}/include/petscversion.h" vstrings REGEX "#define PETSC_VERSION_(RELEASE|MAJOR|MINOR|SUBMINOR|PATCH) ") - foreach (line ${vstrings}) - string (REGEX REPLACE " +" ";" fields ${line}) # break line into three fields (the first is always "#define") - list (GET fields 1 var) - list (GET fields 2 val) - set (${var} ${val} PARENT_SCOPE) - set (${var} ${val}) # Also in local scope so we have access below - endforeach () - if (PETSC_VERSION_RELEASE) - set (PETSC_VERSION "${PETSC_VERSION_MAJOR}.${PETSC_VERSION_MINOR}.${PETSC_VERSION_SUBMINOR}p${PETSC_VERSION_PATCH}" PARENT_SCOPE) - else () - # make dev version compare higher than any patch level of a released version - set (PETSC_VERSION "${PETSC_VERSION_MAJOR}.${PETSC_VERSION_MINOR}.${PETSC_VERSION_SUBMINOR}.99" PARENT_SCOPE) - endif () - else () - message (SEND_ERROR "PETSC_DIR can not be used, ${PETSC_DIR}/include/petscversion.h does not exist") - endif () -endfunction () - -find_path (PETSC_DIR include/petsc.h - HINTS ENV PETSC_DIR - PATHS - /usr/lib/petscdir/3.1 /usr/lib/petscdir/3.0.0 /usr/lib/petscdir/2.3.3 /usr/lib/petscdir/2.3.2 # Debian - $ENV{HOME}/petsc - DOC "PETSc Directory") - -if (PETSC_DIR AND NOT PETSC_ARCH) - set (_petsc_arches - $ENV{PETSC_ARCH} # If set, use environment variable first - linux-gnu-c-debug linux-gnu-c-opt # Debian defaults - x86_64-unknown-linux-gnu i386-unknown-linux-gnu) - set (petscconf "NOTFOUND" CACHE FILEPATH "Cleared" FORCE) - foreach (arch ${_petsc_arches}) - if (NOT PETSC_ARCH) - find_path (petscconf petscconf.h - HINTS ${PETSC_DIR} - PATH_SUFFIXES ${arch}/include bmake/${arch} - NO_DEFAULT_PATH) - if (petscconf) - set (PETSC_ARCH "${arch}" CACHE STRING "PETSc build architecture") - endif (petscconf) - endif (NOT PETSC_ARCH) - endforeach (arch) - set (petscconf "NOTFOUND" CACHE INTERNAL "Scratch variable" FORCE) -endif (PETSC_DIR AND NOT PETSC_ARCH) - -set (petsc_slaves LIBRARIES_SYS LIBRARIES_VEC LIBRARIES_MAT LIBRARIES_DM LIBRARIES_KSP LIBRARIES_SNES LIBRARIES_TS - INCLUDE_DIR INCLUDE_CONF) -include (cmake/FindPackageMultipass.cmake) -find_package_multipass (PETSc petsc_config_current - STATES DIR ARCH - DEPENDENTS INCLUDES LIBRARIES COMPILER MPIEXEC ${petsc_slaves}) - -# Determine whether the PETSc layout is old-style (through 2.3.3) or -# new-style (>= 3.0.0) -if (EXISTS "${PETSC_DIR}/${PETSC_ARCH}/include/petscconf.h") # > 2.3.3 - set (petsc_conf_rules "${PETSC_DIR}/conf/rules") - set (petsc_conf_variables "${PETSC_DIR}/conf/variables") -elseif (EXISTS "${PETSC_DIR}/bmake/${PETSC_ARCH}/petscconf.h") # <= 2.3.3 - set (petsc_conf_rules "${PETSC_DIR}/bmake/common/rules") - set (petsc_conf_variables "${PETSC_DIR}/bmake/common/variables") -elseif (PETSC_DIR) - message (SEND_ERROR "The pair PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} do not specify a valid PETSc installation") -else () - message (FATAL_ERROR "PETSc could not be found. Be sure to set PETSC_DIR and PETSC_ARCH.") -endif () -petsc_get_version() - -if (petsc_conf_rules AND petsc_conf_variables AND NOT petsc_config_current) - # Put variables into environment since they are needed to get - # configuration (petscvariables) in the PETSc makefile - set (ENV{PETSC_DIR} "${PETSC_DIR}") - set (ENV{PETSC_ARCH} "${PETSC_ARCH}") - - # A temporary makefile to probe the PETSc configuration - set (petsc_config_makefile "${PROJECT_BINARY_DIR}/Makefile.petsc") - file (WRITE "${petsc_config_makefile}" -"## This file was autogenerated by FindPETSc.cmake -# PETSC_DIR = ${PETSC_DIR} -# PETSC_ARCH = ${PETSC_ARCH} -include ${petsc_conf_rules} -include ${petsc_conf_variables} -show : - -@echo -n \${\${VARIABLE}} -") - - macro (PETSC_GET_VARIABLE name var) - set (${var} "NOTFOUND" CACHE INTERNAL "Cleared" FORCE) - execute_process (COMMAND ${CMAKE_MAKE_PROGRAM} --no-print-directory -f ${petsc_config_makefile} show VARIABLE=${name} - OUTPUT_VARIABLE ${var} - RESULT_VARIABLE petsc_return) - endmacro (PETSC_GET_VARIABLE) - petsc_get_variable (PETSC_LIB_DIR petsc_lib_dir) - petsc_get_variable (PETSC_EXTERNAL_LIB_BASIC petsc_libs_external) - petsc_get_variable (PETSC_CCPPFLAGS petsc_cpp_line) - petsc_get_variable (PETSC_INCLUDE petsc_include) - petsc_get_variable (PCC petsc_cc) - petsc_get_variable (MPIEXEC petsc_mpiexec) - # We are done with the temporary Makefile, calling PETSC_GET_VARIABLE after this point is invalid! - file (REMOVE ${petsc_config_makefile}) - - include (cmake/ResolveCompilerPaths.cmake) - # Extract include paths and libraries from compile command line - resolve_includes (petsc_includes_all "${petsc_cpp_line}") - - message (STATUS "petsc_lib_dir ${petsc_lib_dir}") - - macro (PETSC_FIND_LIBRARY suffix name) - set (PETSC_LIBRARY_${suffix} "NOTFOUND" CACHE INTERNAL "Cleared" FORCE) # Clear any stale value, if we got here, we need to find it again - find_library (PETSC_LIBRARY_${suffix} NAMES ${name} HINTS ${petsc_lib_dir} NO_DEFAULT_PATH) - set (PETSC_LIBRARIES_${suffix} "${PETSC_LIBRARY_${suffix}}") - mark_as_advanced (PETSC_LIBRARY_${suffix}) - endmacro (PETSC_FIND_LIBRARY suffix name) - - # Look for petscvec first, if it doesn't exist, we must be using single-library - petsc_find_library (VEC petscvec) - if (PETSC_LIBRARY_VEC) - petsc_find_library (SYS "petscsys;petsc") # libpetscsys is called libpetsc prior to 3.1 (when single-library was introduced) - petsc_find_library (MAT petscmat) - petsc_find_library (DM petscdm) - petsc_find_library (KSP petscksp) - petsc_find_library (SNES petscsnes) - petsc_find_library (TS petscts) - macro (PETSC_JOIN libs deps) - list (APPEND PETSC_LIBRARIES_${libs} ${PETSC_LIBRARIES_${deps}}) - endmacro (PETSC_JOIN libs deps) - petsc_join (VEC SYS) - petsc_join (MAT VEC) - petsc_join (DM MAT) - petsc_join (KSP DM) - petsc_join (SNES KSP) - petsc_join (TS SNES) - petsc_join (ALL TS) - else () - set (PETSC_LIBRARY_VEC "NOTFOUND" CACHE INTERNAL "Cleared" FORCE) # There is no libpetscvec - petsc_find_library (SINGLE petsc) - foreach (pkg SYS VEC MAT DM KSP SNES TS ALL) - set (PETSC_LIBRARIES_${pkg} "${PETSC_LIBRARY_SINGLE}") - endforeach () - endif () - if (PETSC_LIBRARY_TS) - message (STATUS "Recognized PETSc install with separate libraries for each package") - else () - message (STATUS "Recognized PETSc install with single library for all packages") - endif () - - include (CheckCSourceRuns) - macro (PETSC_TEST_RUNS includes libraries runs) - multipass_c_source_runs ("${includes}" "${libraries}" " -static const char help[] = \"PETSc test program.\"; -#include \"petscts.h\" -int main(int argc,char *argv[]) { - PetscErrorCode ierr; - TS ts; - - ierr = PetscInitialize(&argc,&argv,0,help);CHKERRQ(ierr); - ierr = TSCreate(PETSC_COMM_WORLD,&ts);CHKERRQ(ierr); - ierr = TSSetFromOptions(ts);CHKERRQ(ierr); - ierr = TSDestroy(ts);CHKERRQ(ierr); - ierr = PetscFinalize();CHKERRQ(ierr); - return 0; -} -" ${runs}) - if (${${runs}}) - set (PETSC_EXECUTABLE_RUNS "YES" CACHE BOOL - "Can the system successfully run a PETSc executable? This variable can be manually set to \"YES\" to force CMake to accept a given PETSc configuration, but this will almost always result in a broken build. If you change PETSC_DIR, PETSC_ARCH, or PETSC_CURRENT you would have to reset this variable." FORCE) - endif (${${runs}}) - endmacro (PETSC_TEST_RUNS) - - find_path (PETSC_INCLUDE_DIR petscts.h HINTS "${PETSC_DIR}" PATH_SUFFIXES include NO_DEFAULT_PATH) - find_path (PETSC_INCLUDE_CONF petscconf.h HINTS "${PETSC_DIR}" PATH_SUFFIXES "${PETSC_ARCH}/include" "bmake/${PETSC_ARCH}" NO_DEFAULT_PATH) - mark_as_advanced (PETSC_INCLUDE_DIR PETSC_INCLUDE_CONF) - set (petsc_includes_minimal ${PETSC_INCLUDE_CONF} ${PETSC_INCLUDE_DIR}) - - petsc_test_runs ("${petsc_includes_minimal}" "${PETSC_LIBRARIES_TS}" petsc_works_minimal) - if (petsc_works_minimal) - message (STATUS "Minimal PETSc includes and libraries work. This probably means we are building with shared libs.") - set (petsc_includes_needed "${petsc_includes_minimal}") - else (petsc_works_minimal) # Minimal includes fail, see if just adding full includes fixes it - petsc_test_runs ("${petsc_includes_all}" "${PETSC_LIBRARIES_TS}" petsc_works_allincludes) - if (petsc_works_allincludes) # It does, we just need all the includes ( - message (STATUS "PETSc requires extra include paths, but links correctly with only interface libraries. This is an unexpected configuration (but it seems to work fine).") - set (petsc_includes_needed ${petsc_includes_all}) - else (petsc_works_allincludes) # We are going to need to link the external libs explicitly - resolve_libraries (petsc_libraries_external "${petsc_libs_external}") - foreach (pkg SYS VEC MAT DM KSP SNES TS ALL) - list (APPEND PETSC_LIBRARIES_${pkg} ${petsc_libraries_external}) - endforeach (pkg) - petsc_test_runs ("${petsc_includes_minimal}" "${PETSC_LIBRARIES_TS}" petsc_works_alllibraries) - if (petsc_works_alllibraries) - message (STATUS "PETSc only need minimal includes, but requires explicit linking to all dependencies. This is expected when PETSc is built with static libraries.") - set (petsc_includes_needed ${petsc_includes_minimal}) - else (petsc_works_alllibraries) - # It looks like we really need everything, should have listened to Matt - set (petsc_includes_needed ${petsc_includes_all}) - petsc_test_runs ("${petsc_includes_all}" "${PETSC_LIBRARIES_TS}" petsc_works_all) - if (petsc_works_all) # We fail anyways - message (STATUS "PETSc requires extra include paths and explicit linking to all dependencies. This probably means you have static libraries and something unexpected in PETSc headers.") - else (petsc_works_all) # We fail anyways - message (STATUS "PETSc could not be used, maybe the install is broken.") - endif (petsc_works_all) - endif (petsc_works_alllibraries) - endif (petsc_works_allincludes) - endif (petsc_works_minimal) - - # We do an out-of-source build so __FILE__ will be an absolute path, hence __INSDIR__ is superfluous - if (${PETSC_VERSION} VERSION_LESS 3.1) - set (PETSC_DEFINITIONS "-D__SDIR__=\"\"" CACHE STRING "PETSc definitions" FORCE) - else () - set (PETSC_DEFINITIONS "-D__INSDIR__=" CACHE STRING "PETSc definitions" FORCE) - endif () - # Sometimes this can be used to assist FindMPI.cmake - set (PETSC_MPIEXEC ${petsc_mpiexec} CACHE FILEPATH "Executable for running PETSc MPI programs" FORCE) - set (PETSC_INCLUDES ${petsc_includes_needed} CACHE STRING "PETSc include path" FORCE) - set (PETSC_LIBRARIES ${PETSC_LIBRARIES_ALL} CACHE STRING "PETSc libraries" FORCE) - set (PETSC_COMPILER ${petsc_cc} CACHE FILEPATH "PETSc compiler" FORCE) - # Note that we have forced values for all these choices. If you - # change these, you are telling the system to trust you that they - # work. It is likely that you will end up with a broken build. - mark_as_advanced (PETSC_INCLUDES PETSC_LIBRARIES PETSC_COMPILER PETSC_DEFINITIONS PETSC_MPIEXEC PETSC_EXECUTABLE_RUNS) -endif () - -include (FindPackageHandleStandardArgs) -find_package_handle_standard_args (PETSc - "PETSc could not be found. Be sure to set PETSC_DIR and PETSC_ARCH." - PETSC_INCLUDES PETSC_LIBRARIES PETSC_EXECUTABLE_RUNS) diff --git a/AMDiS/cmake/ResolveCompilerPaths.cmake b/AMDiS/cmake/ResolveCompilerPaths.cmake index b398025e95518511f4e06ba218dcef386a4e8eaa..54787fa38ffa50136414e6c788c50fb3c63746b8 100644 --- a/AMDiS/cmake/ResolveCompilerPaths.cmake +++ b/AMDiS/cmake/ResolveCompilerPaths.cmake @@ -38,23 +38,34 @@ # # assuming both directories exist. # Note: as currently implemented, the -I/string will be picked up mistakenly (cry, cry) +include (CorrectWindowsPaths) macro (RESOLVE_LIBRARIES LIBS LINK_LINE) - string (REGEX MATCHALL "((-L|-l|-Wl)([^\" ]+|\"[^\"]+\")|/[^\" ]+(a|so|dll))" _all_tokens "${LINK_LINE}") - set (_libs_found) - set (_directory_list) + string (REGEX MATCHALL "((-L|-l|-Wl)([^\" ]+|\"[^\"]+\")|[^\" ]+\\.(a|so|dll|lib))" _all_tokens "${LINK_LINE}") + set (_libs_found "") + set (_directory_list "") foreach (token ${_all_tokens}) if (token MATCHES "-L([^\" ]+|\"[^\"]+\")") # If it's a library path, add it to the list string (REGEX REPLACE "^-L" "" token ${token}) string (REGEX REPLACE "//" "/" token ${token}) + convert_cygwin_path(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 - string (REGEX REPLACE "^-l" "" token ${token}) - set (_root) - if (token MATCHES "^/") # We have an absolute path, add root to the search path - set (_root "/") + if (WIN32) #windows expects "libfoo", linux expects "foo" + string (REGEX REPLACE "^-l" "lib" token ${token}) + else (WIN32) + 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 "^/") set (_lib "NOTFOUND" CACHE FILEPATH "Cleared" FORCE) find_library (_lib ${token} HINTS ${_directory_list} ${_root}) @@ -78,10 +89,11 @@ endmacro (RESOLVE_LIBRARIES) macro (RESOLVE_INCLUDES INCS COMPILE_LINE) string (REGEX MATCHALL "-I([^\" ]+|\"[^\"]+\")" _all_tokens "${COMPILE_LINE}") - set (_incs_found) + set (_incs_found "") foreach (token ${_all_tokens}) string (REGEX REPLACE "^-I" "" token ${token}) string (REGEX REPLACE "//" "/" token ${token}) + convert_cygwin_path(token) if (EXISTS ${token}) list (APPEND _incs_found ${token}) else (EXISTS ${token}) diff --git a/AMDiS/cmake/SetSubMinorRevision.cmake b/AMDiS/cmake/SetSubMinorRevision.cmake deleted file mode 100644 index a57d46753624e32e0e274f6c4bf7ed52ee52a4a8..0000000000000000000000000000000000000000 --- a/AMDiS/cmake/SetSubMinorRevision.cmake +++ /dev/null @@ -1,33 +0,0 @@ -#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() diff --git a/AMDiS/cmake/amdis_compositeFEM.cmake b/AMDiS/cmake/amdis_compositeFEM.cmake new file mode 100644 index 0000000000000000000000000000000000000000..e0b4c5c28131e0bd6aa5bb77f41858adc4bba5d6 --- /dev/null +++ b/AMDiS/cmake/amdis_compositeFEM.cmake @@ -0,0 +1,23 @@ +# 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) + diff --git a/AMDiS/cmake/amdis_extensions.cmake b/AMDiS/cmake/amdis_extensions.cmake new file mode 100644 index 0000000000000000000000000000000000000000..f2f5bb7f316a7a42e6f2b5c6006e8e767475962d --- /dev/null +++ b/AMDiS/cmake/amdis_extensions.cmake @@ -0,0 +1,94 @@ +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) diff --git a/AMDiS/cmake/amdis_parallel.cmake b/AMDiS/cmake/amdis_parallel.cmake new file mode 100644 index 0000000000000000000000000000000000000000..c5ea733b2d7d8ead3c2eb21941399c3f9f9d7df6 --- /dev/null +++ b/AMDiS/cmake/amdis_parallel.cmake @@ -0,0 +1,84 @@ +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 + ${SOURCE_DIR}/parallel/PetscHelper.cc + ${SOURCE_DIR}/parallel/PetscSolver.cc + ${SOURCE_DIR}/parallel/PetscSolverGlobalMatrix.cc + ${SOURCE_DIR}/parallel/PetscSolverGlobalBlockMatrix.cc + ${SOURCE_DIR}/solver/PetscTypes.cc + ) + + if (ENABLE_PARALLEL_SOLVERS) + list(APPEND PARALLEL_DOMAIN_AMDIS_SRC + ${SOURCE_DIR}/parallel/PetscSolverFeti.cc + ${SOURCE_DIR}/parallel/PetscSolverFetiDebug.cc + ${SOURCE_DIR}/parallel/PetscSolverFetiMonitor.cc + ${SOURCE_DIR}/parallel/PetscSolverFetiOperators.cc + ${SOURCE_DIR}/parallel/PetscSolverFetiTimings.cc + ${SOURCE_DIR}/parallel/PetscSolverNavierStokes.cc + ${SOURCE_DIR}/parallel/PetscSolverNSCH.cc + ${SOURCE_DIR}/parallel/PetscSolverCahnHilliard2.cc + ${SOURCE_DIR}/parallel/PetscSolverCahnHilliard.cc + ${SOURCE_DIR}/parallel/PetscSolverSchur.cc + ) + list(APPEND COMPILEFLAGS "-DHAVE_PARALLEL_SOLVERS=1") + endif (ENABLE_PARALLEL_SOLVERS) + + # specify how to install this target: + # ----------------------------------- + + file(GLOB AMDIS_PARALLEL_HEADERS "${SOURCE_DIR}/parallel/*.h") + install(FILES ${AMDIS_PARALLEL_HEADERS} DESTINATION include/amdis/parallel/) + + install(FILES + ${BASE_DIR}/cmake/ResolveCompilerPaths.cmake + ${BASE_DIR}/cmake/FindPackageMultipass.cmake + ${BASE_DIR}/cmake/CorrectWindowsPaths.cmake + ${BASE_DIR}/cmake/FindPETSc.cmake + DESTINATION share/amdis/) +endif (ENABLE_PARALLEL_DOMAIN) diff --git a/AMDiS/cmake/amdis_reinit.cmake b/AMDiS/cmake/amdis_reinit.cmake new file mode 100644 index 0000000000000000000000000000000000000000..3a1972ff0500493a9763c387ba174bf5ad2d74bc --- /dev/null +++ b/AMDiS/cmake/amdis_reinit.cmake @@ -0,0 +1,13 @@ +# specify the target and requirements for the reinit library + +set(REINIT_SOURCE_DIR ${SOURCE_DIR}/reinit) +file(GLOB REINIT_SRC ${REINIT_SOURCE_DIR}/*.cc) + +list(APPEND COMPILEFLAGS "-DHAVE_REINIT=1") +list(APPEND AMDIS_INCLUDE_DIRS ${REINIT_SOURCE_DIR}) + +# specify how to install this target: +# ----------------------------------- + +file(GLOB RINIT_HEADERS "${REINIT_SOURCE_DIR}/*.h*") +install(FILES ${RINIT_HEADERS} DESTINATION include/amdis/reinit) diff --git a/AMDiS/cmake/amdis_seq_petsc.cmake b/AMDiS/cmake/amdis_seq_petsc.cmake new file mode 100644 index 0000000000000000000000000000000000000000..71d949b0bd061a0ab601431fa724aa3907a0d025 --- /dev/null +++ b/AMDiS/cmake/amdis_seq_petsc.cmake @@ -0,0 +1,10 @@ +if (ENABLE_SEQ_PETSC) + enable_mpi(COMPILEFLAGS AMDIS_INCLUDE_DIRS _) + enable_petsc(COMPILEFLAGS AMDIS_INCLUDE_DIRS _) + + list(APPEND COMPILEFLAGS "-DHAVE_SEQ_PETSC=1") + + list(APPEND AMDIS_SRC + ${SOURCE_DIR}/solver/PetscSolver.cc + ${SOURCE_DIR}/solver/PetscTypes.cc) +endif (ENABLE_SEQ_PETSC) diff --git a/AMDiS/cmake/dummy.cc b/AMDiS/cmake/dummy.cc deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/AMDiS/cmake/enable_bddcml.cmake b/AMDiS/cmake/enable_bddcml.cmake index ecdbe778dc43fe92f90d3fc20a180118b3cadf4e..54e5959144355d473a0dc58f239ac51376780cf6 100644 --- a/AMDiS/cmake/enable_bddcml.cmake +++ b/AMDiS/cmake/enable_bddcml.cmake @@ -1,32 +1,35 @@ +macro(enable_bddcml _FLAGS_ _INC_DIRS_ _LIBS_) + if (${ARGC} GREATER 3) + set(LINK_EXECUTABLE ON) + else () + set(LINK_EXECUTABLE OFF) + endif () -if (ENABLE_BDDCML) - SET(BDDCML_LINK_LIST "" CACHE STRING "Further libraries to be linked with BDDCML") + SET(BDDCML_LINK_LIST "" CACHE STRING "Further libraries to be linked with BDDCML") - find_file(BDDCML_H bddcml_interface_c.h - HINTS ENV CPATH - DOC "Header bddcml_interface_c.h for the BDDCML library.") + find_file(BDDCML_H bddcml_interface_c.h + HINTS ENV CPATH + DOC "Header bddcml_interface_c.h for the BDDCML library.") - if(BDDCML_H) - get_filename_component(BDDCML_PATH ${BDDCML_H} PATH) - include_directories(${BDDCML_PATH}) - list(APPEND COMPILEFLAGS "-DHAVE_BDDC_ML=1") - list(APPEND COMPILEFLAGS "-DAdd_") - else() - message(FATAL_ERROR "Could not find BDDCML headers.") - endif() + if (BDDCML_H) + get_filename_component(BDDCML_PATH ${BDDCML_H} PATH) + list(APPEND ${_INC_DIRS_} ${BDDCML_PATH}) + list(APPEND ${_FLAGS_} "-DHAVE_BDDC_ML=1" "-DAdd_") + else() + message(FATAL_ERROR "Could not find BDDCML headers.") + endif() - find_library(BDDCML_LIB bddcml - HINTS ENV LIBRARY_PATH - DOC "BDDCML library") + if (LINK_EXECUTABLE) + find_library(BDDCML_LIB bddcml + HINTS ENV LIBRARY_PATH + DOC "BDDCML library") - if(BDDCML_LIB) - list(APPEND AMDIS_LIBS ${BDDCML_LIB}) - else() - message(FATAL_ERROR "Could not find the BDDCML library") - endif() + if(BDDCML_LIB) + list(APPEND ${_LIBS_} ${BDDCML_LIB}) + else() + message(FATAL_ERROR "Could not find the BDDCML library") + endif() + endif (LINK_EXECUTABLE) - - find_file(BLOPEX_PATH blopex - HINTS ENV CPATH - DOC "Path to BLOPEX library.") -endif (ENABLE_BDDCML) + list(APPEND ${_FLAGS_} "-DHAVE_BDDCML=1") +endmacro(enable_bddcml) diff --git a/AMDiS/cmake/enable_boost.cmake b/AMDiS/cmake/enable_boost.cmake new file mode 100644 index 0000000000000000000000000000000000000000..9a118cfd8724db800b0e191dd55c2e6c3c5d8e48 --- /dev/null +++ b/AMDiS/cmake/enable_boost.cmake @@ -0,0 +1,41 @@ +macro(enable_boost _FLAGS_ _INC_DIRS_ _LIBS_) + if (${ARGC} GREATER 3) + set(LINK_EXECUTABLE ON) + else () + set(LINK_EXECUTABLE OFF) + endif () + + if (BOOST_ROOT) + file(TO_CMAKE_PATH ${BOOST_ROOT} BOOST_ROOT) + endif (BOOST_ROOT) + if (BOOST_LIBRARYDIR) + file(TO_CMAKE_PATH ${BOOST_LIBRARYDIR} BOOST_LIBRARYDIR) + endif (BOOST_LIBRARYDIR) + + set(BOOST_VERSION "1.48") + set(BOOST_LIBS_REQUIRED system iostreams filesystem program_options date_time) + if (WIN32) + list(APPEND BOOST_LIBS_REQUIRED zlib) + if (ENABLE_COMPRESSION OR AMDIS_NEED_COMPRESSION) + list(APPEND BOOST_LIBS_REQUIRED bzip2) + endif (ENABLE_COMPRESSION OR AMDIS_NEED_COMPRESSION) + endif (WIN32) + + if (NOT BUILD_SHARED_LIBS) + set(Boost_USE_STATIC_LIBS ON) + endif (NOT BUILD_SHARED_LIBS) + find_package(Boost ${BOOST_VERSION} REQUIRED ${BOOST_LIBS_REQUIRED}) + if (Boost_FOUND) + list(APPEND ${_INC_DIRS_} ${Boost_INCLUDE_DIR}) + + if (LINK_EXECUTABLE) + list(APPEND ${_LIBS_} ${Boost_LIBRARIES}) + endif (LINK_EXECUTABLE) + + if (MSVC_SHARED_LIBS AND LINK_EXECUTABLE) + link_directories(${Boost_LIBRARY_DIRS}) + list(APPEND ${_FLAGS_} ${Boost_LIB_DIAGNOSTIC_DEFINITIONS}) + endif (MSVC_SHARED_LIBS AND LINK_EXECUTABLE) + endif (Boost_FOUND) + +endmacro(enable_boost) diff --git a/AMDiS/cmake/enable_cxx11.cmake b/AMDiS/cmake/enable_cxx11.cmake index 8b628c469950c0ad83e8bc80e5e7df1c4b7e5435..2f8a59a04f0895fa9014286340973e834261af78 100644 --- a/AMDiS/cmake/enable_cxx11.cmake +++ b/AMDiS/cmake/enable_cxx11.cmake @@ -1,8 +1,7 @@ include(CheckCXXCompilerFlag) include(CheckCXXSourceCompiles) -include(CheckIncludeFileCXX) -if (ENABLE_CXX11) +macro(enable_cxx11 _RESULT_ _FLAGS_) check_cxx_compiler_flag("-std=c++11" COMPILER_SUPPORTS_CXX11_FLAG) set(CXX11_CODE " @@ -21,16 +20,15 @@ if (ENABLE_CXX11) endif () if (COMPILER_SUPPORTS_CXX11_FLAG AND CXX11_COMPILES_WITH_CXX11_FLAG) - add_definitions("-std=c++11") + list(APPEND ${_FLAGS_} "-std=c++11") + set(${_RESULT_} true CACHE BOOL "Enable C++11 compiler features" FORCE) else () check_cxx_source_compiles("${CXX11_CODE}" CXX11_COMPILES) - if (NOT CXX11_COMPILES) - message (FATAL_ERROR "Compiler does not support C++11.") + if (CXX11_COMPILES) + set(${_RESULT_} true CACHE BOOL "Enable C++11 compiler features" FORCE) + else () + set(${_RESULT_} false CACHE BOOL "Enable C++11 compiler features" FORCE) endif () endif () - - list(APPEND COMPILEFLAGS "-DHAS_CXX11=1") -else () - list(APPEND COMPILEFLAGS "-DHAS_CXX11=0") -endif (ENABLE_CXX11) +endmacro(enable_cxx11) diff --git a/AMDiS/cmake/enable_extensions.cmake b/AMDiS/cmake/enable_extensions.cmake deleted file mode 100644 index 16d9d077e654b8e8cf3ceb213b792194af945796..0000000000000000000000000000000000000000 --- a/AMDiS/cmake/enable_extensions.cmake +++ /dev/null @@ -1,143 +0,0 @@ - -# TODO: make extensions a subproject -# add_subdirectory(${SOURCE_DIR}/compositeFEM [binarydir]) - -if (ENABLE_EXTENSIONS) - option(ENABLE_BASE_PROBLEMS "Use base_problems" true) - find_path(EXTENSIONS_DIR NAMES Helpers.h - HINTS ${CMAKE_CURRENT_SOURCE_DIR}/../extensions - DOC "Path to AMDiS extensions.") - if (EXTENSIONS_DIR) - if (NOT EXISTS ${EXTENSIONS_DIR}/Helpers.h OR NOT EXISTS ${EXTENSIONS_DIR}/base_problems/BaseProblem.h) - message(FATAL_ERROR "Wrong extensions directory! Directory must contain the 'Helpers.h' and the subdirectory 'base_problems'") - else() - - SET(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) - - 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/PetscSolverNavierStokes2.cc - ${EXTENSIONS_DIR}/preconditioner/PetscSolverPfc.cc - ${EXTENSIONS_DIR}/preconditioner/PetscSolverPfc_diag.cc) - endif(ENABLE_PARALLEL_DOMAIN) - - list(APPEND COMPILEFLAGS "-DHAVE_EXTENSIONS=1") - list(APPEND AMDIS_INCLUDE_DIRS ${EXTENSIONS_DIR}) - list(APPEND AMDIS_INCLUDE_DIRS ${EXTENSIONS_DIR}/time) - list(APPEND AMDIS_INCLUDE_DIRS ${EXTENSIONS_DIR}/nanoflann) - list(APPEND AMDIS_INCLUDE_DIRS ${EXTENSIONS_DIR}/pugixml/src) - if(WIN32) - add_library(extensions STATIC ${EXTENSIONS_SRC}) - else() - add_library(extensions SHARED ${EXTENSIONS_SRC}) - endif() - list(APPEND AMDIS_LIBS extensions) - - FILE(GLOB HEADERS "${EXTENSIONS_DIR}/*.h") - INSTALL(FILES ${HEADERS} - DESTINATION include/amdis/extensions/) - FILE(GLOB HEADERS "${EXTENSIONS_DIR}/*.hh") - INSTALL(FILES ${HEADERS} - DESTINATION include/amdis/extensions/) - - list(APPEND deb_add_dirs "include/amdis/extensions") - - FILE(GLOB HEADERS "${EXTENSIONS_DIR}/time/*.h") - INSTALL(FILES ${HEADERS} - DESTINATION include/amdis/extensions/time/) - FILE(GLOB HEADERS "${EXTENSIONS_DIR}/time/*.hh") - INSTALL(FILES ${HEADERS} - DESTINATION include/amdis/extensions/time/) - - FILE(GLOB HEADERS "${EXTENSIONS_DIR}/preconditioner/*.h") - INSTALL(FILES ${HEADERS} - DESTINATION include/amdis/extensions/preconditioner/) - FILE(GLOB HEADERS "${EXTENSIONS_DIR}/preconditioner/*.hh") - INSTALL(FILES ${HEADERS} - DESTINATION include/amdis/extensions/preconditioner/) - - list(APPEND deb_add_dirs "include/amdis/extensions/time") - - FILE(GLOB HEADERS "${EXTENSIONS_DIR}/nanoflann/*.hpp") - INSTALL(FILES ${HEADERS} - DESTINATION include/amdis/extensions/nanoflann/) - - list(APPEND deb_add_dirs "include/amdis/extensions/nanoflann") - - FILE(GLOB HEADERS "${EXTENSIONS_DIR}/pugixml/src/*.hpp") - INSTALL(FILES ${HEADERS} - DESTINATION include/amdis/extensions/pugixml/) - - list(APPEND deb_add_dirs "include/amdis/extensions/pugixml") - - install(TARGETS extensions - DESTINATION lib/amdis/ ) - -# === baseProblems ==================================================================== - - if(ENABLE_BASE_PROBLEMS) - SET(BASE_PROBLEMS_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 - ${EXTENSIONS_DIR}/base_problems/DiffuseDomainFsi.cc - ${EXTENSIONS_DIR}/base_problems/LinearElasticity.cc - ${EXTENSIONS_DIR}/base_problems/LinearElasticityPhase.cc -# ${EXTENSIONS_DIR}/base_problems/NavierStokes_Chorin.cc - ${EXTENSIONS_DIR}/base_problems/NavierStokesCahnHilliard.cc -# ${EXTENSIONS_DIR}/base_problems/NavierStokesPhase_Chorin.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/VacancyPhaseFieldCrystal.cc - ) - list(APPEND COMPILEFLAGS "-DHAVE_BASE_PROBLEMS=1") - list(APPEND AMDIS_INCLUDE_DIRS ${EXTENSIONS_DIR}/base_problems) - if(WIN32) - add_library(base_problems STATIC ${BASE_PROBLEMS_SRC}) - else() - add_library(base_problems SHARED ${BASE_PROBLEMS_SRC}) - endif() - list(APPEND AMDIS_LIBS base_problems) - - FILE(GLOB HEADERS "${EXTENSIONS_DIR}/base_problems/*.h") - INSTALL(FILES ${HEADERS} - DESTINATION include/amdis/base_problems/) - FILE(GLOB HEADERS "${EXTENSIONS_DIR}/base_problems/*.hh") - INSTALL(FILES ${HEADERS} - DESTINATION include/amdis/base_problems/) - - list(APPEND deb_add_dirs "include/amdis/base_problems") - - install(TARGETS base_problems - DESTINATION lib/amdis/ ) - - endif(ENABLE_BASE_PROBLEMS) - endif() - endif() -endif (ENABLE_EXTENSIONS) diff --git a/AMDiS/cmake/enable_hypre.cmake b/AMDiS/cmake/enable_hypre.cmake index 640c536c87cc7d00d1bbf17991929e1133c3c3cf..7bd469630f3a086c6064673df301a5fc3264b404 100644 --- a/AMDiS/cmake/enable_hypre.cmake +++ b/AMDiS/cmake/enable_hypre.cmake @@ -1,17 +1,54 @@ +macro(enable_hypre _FLAGS_ _INC_DIRS_ _LIBS_) + if (${ARGC} GREATER 3) + set(LINK_EXECUTABLE ON) + else () + set(LINK_EXECUTABLE OFF) + endif () -if (ENABLE_HYPRE) - include(cmake/HYPREConfig.cmake) - message("have hypre: ${HAVE_HYPRE}") - if (HAVE_HYPRE) - if (NOT MPI_FOUND) - find_package(MPI REQUIRED) - if (MPI_FOUND) - list(APPEND COMPILEFLAGS "${MPI_COMPILE_FLAGS}") - include_directories(${MPI_INCLUDE_PATH}) - endif() - endif() - include_directories(${HYPRE_INCLUDE_DIRECTORIES}) - list(APPEND COMPILEFLAGS "-DMTL_HAS_HYPRE") - list(APPEND MYLIBS ${HYPRE_LIBRARIES} ) - endif() -endif (ENABLE_HYPRE) + # MPI is required + if (LINK_EXECUTABLE) + enable_mpi(${_FLAGS_} ${_INC_DIRS_} ${_LIBS_} ON) + else () + enable_mpi(${_FLAGS_} ${_INC_DIRS_} ${_LIBS_}) + endif (LINK_EXECUTABLE) + + + find_file(_HYPRE_H HYPRE.h + HINTS ${PETSC_INCLUDE_DIRS}) + + if (_HYPRE_H) + get_filename_component(HYPRE_INCLUDE_DIRECTORIES ${HYPRE_H} PATH) + list(APPEND ${_INC_DIRS_} ${HYPRE_INCLUDE_DIRECTORIES}) + endif (_HYPRE_H) + + if (LINK_EXECUTABLE) + find_library(_HYPRE_LIB HYPRE + HINTS ${PETSC_LIBRARY_DIRS}) + + if(_HYPRE_LIB) + get_filename_component(HLIB_PATH ${_HYPRE_LIB} PATH) + file(GLOB HYPRE_OTHER ${HLIB_PATH}/${CMAKE_SHARED_LIBRARY_PREFIX}HYPRE*${CMAKE_SHARED_LIBRARY_SUFFIX}) + list(APPEND ${_LIBS_} ${_HYPRE_LIB} ${HYPRE_OTHER}) + endif (_HYPRE_LIB) + + # lapack library is required + find_library(LAPACK_LIB + NAMES lapack flapack + HINTS ${LAPACK_DIR}/lib ${PETSC_LIBRARY_DIRS} ${PETSC_DIR}/lib) + if (LAPACK_LIB) + set(LAPACK_LIBRARIES ${LAPACK_LIB}) + else (LAPACK_LIB) + find_package(LAPACK REQUIRED) + endif (LAPACK_LIB) + list(APPEND ${_LIBS_} ${LAPACK_LIBRARIES}) + endif (LINK_EXECUTABLE) + + + if (_HYPRE_H AND (NOT LINK_EXECUTABLE OR _HYPRE_LIB)) + set(HAVE_HYPRE ON) + list(APPEND ${_FLAGS_} "-DMTL_HAS_HYPRE") + else () + set(HAVE_HYPRE OFF) + endif () + +endmacro(enable_hypre) diff --git a/AMDiS/cmake/enable_mtl4.cmake b/AMDiS/cmake/enable_mtl4.cmake new file mode 100644 index 0000000000000000000000000000000000000000..cc7e6241bc191f60918f2bd71b4653c54d8c9770 --- /dev/null +++ b/AMDiS/cmake/enable_mtl4.cmake @@ -0,0 +1,32 @@ +macro(enable_mtl4 _FLAGS_ _INC_DIRS_ _LIBS_) + if (${ARGC} GREATER 3) + set(LINK_EXECUTABLE ON) + else () + set(LINK_EXECUTABLE OFF) + endif () + + if (LINK_EXECUTABLE) + list(APPEND ${_INC_DIRS_} ${AMDIS_INCLUDE_DIR}/mtl4) + else () + list(APPEND ${_INC_DIRS_} ${BASE_DIR}/lib/mtl4) + endif (LINK_EXECUTABLE) + + + if (ENABLE_CXX11 OR AMDIS_NEED_CXX11) + set (CXX_ELEVEN_FEATURE_LIST "MOVE" "AUTO" "RANGEDFOR" "INITLIST" "STATICASSERT" "DEFAULTIMPL") + foreach (feature ${CXX_ELEVEN_FEATURE_LIST}) + list(APPEND ${_FLAGS_} "-DMTL_WITH_${feature}") + endforeach () + endif () + + + if (ENABLE_OPENMP) + find_package(OpenMP REQUIRED) + if (OPENMP_FOUND) + list(APPEND ${_FLAGS_} "-DMTL_WITH_OPENMP" ${OpenMP_CXX_FLAGS}) + else () + message(FATAL_ERROR "OpenMP not found") + endif (OPENMP_FOUND) + endif (ENABLE_OPENMP) + +endmacro(enable_mtl4) diff --git a/AMDiS/cmake/enable_openmp.cmake b/AMDiS/cmake/enable_openmp.cmake deleted file mode 100644 index 99bd6f568f87277cc79dcbfb1db4aba1609c2af9..0000000000000000000000000000000000000000 --- a/AMDiS/cmake/enable_openmp.cmake +++ /dev/null @@ -1,8 +0,0 @@ - -if (ENABLE_OPENMP) - if(CMAKE_CXX_COMPILER MATCHES ".*icpc") - list(APPEND COMPILEFLAGS "-openmp") - else() - list(APPEND COMPILEFLAGS "-fopenmp") - endif() -endif (ENABLE_OPENMP) diff --git a/AMDiS/cmake/enable_parallel_domain.cmake b/AMDiS/cmake/enable_parallel_domain.cmake deleted file mode 100644 index 035ed4548e9d82e22902f82aa0ef714e896df52e..0000000000000000000000000000000000000000 --- a/AMDiS/cmake/enable_parallel_domain.cmake +++ /dev/null @@ -1,116 +0,0 @@ - -if (ENABLE_PARALLEL_DOMAIN) - option(USE_PETSC_DEV false) - mark_as_advanced(USE_PETSC_DEV) - option(ENABLE_ZOLTAN false) - - ### Search for MPI compiler and get compile flags and include paths. ### - - find_package(MPI REQUIRED) - if(MPI_FOUND) - list(APPEND COMPILEFLAGS "${MPI_COMPILE_FLAGS}") - include_directories(${MPI_INCLUDE_PATH}) - endif(MPI_FOUND) - - - - ### Search for ParMetis ### - - find_file(PARMETIS_HEADER_FILE "parmetis.h" PATH ENV CPATH) - if(PARMETIS_HEADER_FILE) - get_filename_component(PARMETIS_INCLUDE_PATH "${PARMETIS_HEADER_FILE}" PATH CACHE) - include_directories(${PARMETIS_INCLUDE_PATH}) - else() - message(FATAL_ERROR "Could not find ParMetis header file!") - endif(PARMETIS_HEADER_FILE) - -# find_file(PARMETIS_LIB_FILE "libparmetis.a" PATH ENV LIBRARY_PATH) -# if(PARMETIS_LIB_FILE) -# get_filename_component(PARMETIS_LINK_PATH "${PARMETIS_LIB_FILE}" PATH CACHE) -# link_directories(${PARMETIS_LINK_PATH}) -# else() -# message(FATAL_ERROR "Could not find ParMetis library file!") -# endif(PARMETIS_LIB_FILE) - - - - ### Search for Zoltan ### - - if(ENABLE_ZOLTAN) - find_file(ZOLTAN_HEADER_FILE "zoltan_cpp.h" PATH ENV CPATH) - if(ZOLTAN_HEADER_FILE) - get_filename_component(ZOLTAN_HEADER_DIR "${ZOLTAN_HEADER_FILE}" PATH CACHE) - include_directories(${ZOLTAN_HEADER_DIR}) - else() - message(FATAL_ERROR "Could not find Zoltan include file!") - endif(ZOLTAN_HEADER_FILE) - - list(APPEND COMPILEFLAGS "-DHAVE_ZOLTAN") - endif(ENABLE_ZOLTAN) - - - - list(APPEND COMPILEFLAGS "-DHAVE_PARALLEL_DOMAIN_AMDIS=1") - SET(PARALLEL_DOMAIN_AMDIS_SRC - ${SOURCE_DIR}/parallel/BddcMlSolver.cc - ${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 - ${SOURCE_DIR}/parallel/ZoltanPartitioner.cc) - - if(ENABLE_PARALLEL_DOMAIN STREQUAL "PETSC") - set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};/usr/share/cmake-2.8/Modules/;${AMDIS_SOURCE_DIR}/cmake") - set(PETSC_EXECUTABLE_RUNS ON) - find_package(PETSc REQUIRED) - include_directories(${PETSC_DIR}/include ${PETSC_DIR}/${PETSC_ARCH}/include) - list(APPEND COMPILEFLAGS "-DHAVE_PARALLEL_PETSC" "-DPETSC_VERSION=${PETSC_VERSION}") - list(APPEND AMDIS_INCLUDE_DIRS ${PETSC_DIR}/include ${PETSC_DIR}/${PETSC_ARCH}/include) - list(APPEND PARALLEL_DOMAIN_AMDIS_SRC - ${SOURCE_DIR}/parallel/MatrixNnzStructure.cc - ${SOURCE_DIR}/parallel/ParallelCoarseSpaceSolver.cc - ${SOURCE_DIR}/parallel/PetscHelper.cc - ${SOURCE_DIR}/parallel/PetscSolver.cc - ${SOURCE_DIR}/parallel/PetscSolverFeti.cc - ${SOURCE_DIR}/parallel/PetscSolverFetiDebug.cc - ${SOURCE_DIR}/parallel/PetscSolverFetiMonitor.cc - ${SOURCE_DIR}/parallel/PetscSolverFetiOperators.cc - ${SOURCE_DIR}/parallel/PetscSolverFetiTimings.cc - ${SOURCE_DIR}/parallel/PetscSolverGlobalMatrix.cc - ${SOURCE_DIR}/parallel/PetscSolverGlobalBlockMatrix.cc - ${SOURCE_DIR}/parallel/PetscSolverNavierStokes.cc - ${SOURCE_DIR}/parallel/PetscSolverNSCH.cc - ${SOURCE_DIR}/parallel/PetscSolverCahnHilliard2.cc - ${SOURCE_DIR}/parallel/PetscSolverCahnHilliard.cc - ${SOURCE_DIR}/parallel/PetscSolverSchur.cc - ${SOURCE_DIR}/solver/PetscTypes.cc) - elseif(ENABLE_PARALLEL_DOMAIN STREQUAL "PMTL") - set(MTL_INCLUDE_DIR "") - find_package(MTL REQUIRED) - list(APPEND COMPILEFLAGS "-DMTL_HAS_MPI" "-DHAVE_PARALLEL_MTL4") -# list(APPEND PARALLEL_DOMAIN_AMDIS_SRC -# ${SOURCE_DIR}/parallel/PMTL_ProblemStat.cc -# ) - list(APPEND AMDIS_LIBS ${MTL_LIBRARIES}) - else() - message(SEND_ERROR "Set the domain-decomposition version correctly.") - endif() - - INSTALL(FILES cmake/ResolveCompilerPaths.cmake cmake/FindPackageMultipass.cmake cmake/FindPETSc.cmake - DESTINATION share/amdis/) - if(USE_PETSC_DEV) - list(APPEND COMPILEFLAGS "-DHAVE_PETSC_DEV") - endif( USE_PETSC_DEV) -endif(ENABLE_PARALLEL_DOMAIN) diff --git a/AMDiS/cmake/enable_petsc.cmake b/AMDiS/cmake/enable_petsc.cmake new file mode 100644 index 0000000000000000000000000000000000000000..b6fd87616ce3af58473f1a7293c8e065b2addbcf --- /dev/null +++ b/AMDiS/cmake/enable_petsc.cmake @@ -0,0 +1,143 @@ +include(FindPkgConfig) + +macro(enable_mpi _FLAGS_ _INC_DIRS_ _LIBS_) + if (${ARGC} GREATER 3) + set(LINK_EXECUTABLE ON) + else () + set(LINK_EXECUTABLE OFF) + endif () + + find_package(MPI REQUIRED) + list(APPEND ${_INC_DIRS_} ${MPI_CXX_INCLUDE_PATH}) + list(APPEND ${_FLAGS_} ${MPI_CXX_COMPILE_FLAGS}) + + if (LINK_EXECUTABLE) + string(STRIP " ${MPI_CXX_LINK_FLAGS} " MPI_CXX_LINK_FLAGS_) + list(APPEND ${_FLAGS_} ${MPI_CXX_LINK_FLAGS_}) + list(APPEND ${_LIBS_} ${MPI_CXX_LIBRARIES}) + endif (LINK_EXECUTABLE) +endmacro(enable_mpi) + + +macro(enable_petsc _FLAGS_ _INC_DIRS_ _LIBS_) + if (${ARGC} GREATER 3) + set(LINK_EXECUTABLE ON) + else () + set(LINK_EXECUTABLE OFF) + endif () + + # PETSc library is required + find_file(PETSC_PKG_CONFIG "PETSc.pc" + HINTS ${PETSC_DIR}/lib/pkgconfig + $ENV{PETSC_DIR}/lib/pkgconfig + ${PETSC_ROOT}/lib/pkgconfig + $ENV{PETSC_ROOT}/lib/pkgconfig + /usr/lib/petsc/lib/pkgconfig + /usr/lib/petsc/linux-gnu-cxx-opt/lib/pkgconfig + /usr/lib/petsc/linux-gnu-c-opt/lib/pkgconfig) + if (PETSC_PKG_CONFIG) + get_filename_component(PETSC_PKG_CONFIG_PATH "${PETSC_PKG_CONFIG}" PATH CACHE) + set(ENV{PKG_CONFIG_PATH} ${PETSC_PKG_CONFIG_PATH}) + pkg_check_modules(PETSC REQUIRED PETSc>=3.3) + set(PETSC_DEFINITIONS ${PETSC_CFLAGS} ${PETSC_CFLAGS_OTHER}) + endif (PETSC_PKG_CONFIG) + + # check whether PETSc installation and configuration is valid + if (NOT PETSC_INCLUDE_DIRS) + set(PETSC_VALID ON) + else () + find_file(PETSC_HEADER_FILE "petsc.h" PATHS ${PETSC_INCLUDE_DIRS} NO_DEFAULT_PATH) + if (PETSC_HEADER_FILE) + set(PETSC_VALID ON) + else () + set(PETSC_VALID OFF) + endif () + endif (NOT PETSC_INCLUDE_DIRS) + + # if not valid, search again + if (NOT PETSC_VALID) + find_package(PETSc REQUIRED) + set(PETSC_INCLUDE_DIRS ${PETSC_INCLUDES}) + set(PETSC_LIBRARY_DIRS ${PETSC_LIB_DIR}) + message(STATUS " Found PETSc, version ${PETSC_VERSION}") + endif (NOT PETSC_VALID) + + list(APPEND ${_INC_DIRS_} ${PETSC_INCLUDE_DIRS}) + list(APPEND ${_FLAGS_} "-DHAVE_PARALLEL_PETSC=1" "-DPETSC_VERSION=${PETSC_VERSION}" ${PETSC_DEFINITIONS}) + + if (LINK_EXECUTABLE) + link_directories(${PETSC_LIBRARY_DIRS}) + list(APPEND ${_LIBS_} ${PETSC_LIBRARIES}) + endif (LINK_EXECUTABLE) + + + # parmetis is required + find_file(PARMETIS_HEADER_FILE "parmetis.h" + HINTS ${PARMETIS_DIR}/include ${PETSC_INCLUDE_DIRS} /usr/include/parmetis) + if (PARMETIS_HEADER_FILE) + get_filename_component(PARMETIS_INCLUDE_PATH "${PARMETIS_HEADER_FILE}" PATH CACHE) + list(APPEND ${_INC_DIRS_} ${PARMETIS_INCLUDE_PATH}) + else() + message(FATAL_ERROR "Could not find ParMetis header file 'parmetis.h'!") + endif (PARMETIS_HEADER_FILE) + + if (LINK_EXECUTABLE) + find_library(PARMETIS_LIB parmetis + HINTS ${PARMETIS_DIR}/lib ${PETSC_LIBRARY_DIRS}) + if (NOT PARMETIS_LIB) + message(FATAL_ERROR "Could not find the ParMetis libraries needed by amdis") + endif (NOT PARMETIS_LIB) + message(STATUS " Found ParMetis library ${PARMETIS_LIB}") + list(APPEND ${_LIBS_} ${PARMETIS_LIB}) + endif (LINK_EXECUTABLE) + + + # metis is required + find_file(METIS_HEADER_FILE "metis.h" + HINTS ${METIS_DIR}/include ${PETSC_INCLUDE_DIRS} /usr/include/metis) + if (METIS_HEADER_FILE) + get_filename_component(METIS_INCLUDE_PATH "${METIS_HEADER_FILE}" PATH CACHE) + list(APPEND ${_INC_DIRS_} ${METIS_INCLUDE_PATH}) + else() + message(FATAL_ERROR "Could not find Metis header file 'metis.h'!") + endif (METIS_HEADER_FILE) + + if (LINK_EXECUTABLE) + find_library(METIS_LIB metis + HINTS ${METIS_DIR}/lib ${PETSC_LIBRARY_DIRS}) + if (NOT METIS_LIB) + message(FATAL_ERROR "Could not find the Metis libraries needed by amdis") + endif (NOT METIS_LIB) + message(STATUS " Found Metis library ${METIS_LIB}") + list(APPEND ${_LIBS_} ${METIS_LIB}) + endif (LINK_EXECUTABLE) + + + # blas library is required + if (LINK_EXECUTABLE) + find_library(BLAS_LIB + NAMES blas fblas openblas + HINTS ${BLAS_DIR}/lib ${PETSC_LIBRARY_DIRS} /usr/lib/openblas-base /usr/lib/atlas-base) + if (BLAS_LIB) + set(BLAS_LIBRARIES ${BLAS_LIB}) + else (BLAS_LIB) + find_package(BLAS REQUIRED) + endif (BLAS_LIB) + list(APPEND ${_LIBS_} ${BLAS_LIBRARIES}) + endif (LINK_EXECUTABLE) + + + # lapack library is required + if (LINK_EXECUTABLE) + find_library(LAPACK_LIB + NAMES lapack flapack + HINTS ${LAPACK_DIR}/lib ${PETSC_LIBRARY_DIRS} ${PETSC_DIR}/lib) + if (LAPACK_LIB) + set(LAPACK_LIBRARIES ${LAPACK_LIB}) + else (LAPACK_LIB) + find_package(LAPACK REQUIRED) + endif (LAPACK_LIB) + list(APPEND ${_LIBS_} ${LAPACK_LIBRARIES}) + endif (LINK_EXECUTABLE) +endmacro(enable_petsc) + diff --git a/AMDiS/cmake/enable_png.cmake b/AMDiS/cmake/enable_png.cmake index 25b156c9af8bc1f1c822fda752b3c47fc4eb1066..5d9de50195e081cc87cedd5c3c4f71e3b6750b26 100644 --- a/AMDiS/cmake/enable_png.cmake +++ b/AMDiS/cmake/enable_png.cmake @@ -1,13 +1,31 @@ +macro(enable_png _FLAGS_ _INC_DIRS_ _LIBS_) + if (${ARGC} GREATER 3) + set(LINK_EXECUTABLE ON) + else () + set(LINK_EXECUTABLE OFF) + endif () -if (ENABLE_PNG) - find_file(PNG_H png.h - HINTS ENV CPATH /usr/include - DOC "headerfile png.h for PNG-READER") - if(PNG_H) - get_filename_component(PNG_PATH ${PNG_H} PATH) - include_directories(${PNG_PATH}) - list(APPEND COMPILEFLAGS "-DHAVE_PNG=1") + find_file(_PNG_H png.h + HINTS ENV CPATH /usr/include + DOC "headerfile png.h for PNG-READER") + + if (_PNG_H) + get_filename_component(PNG_PATH ${_PNG_H} PATH) + list(APPEND ${_INC_DIRS_} ${PNG_PATH}) else() - message(FATAL_ERROR "Could not find the PNG header png.h.") + message(FATAL_ERROR "Could not find the PNG header png.h.") endif() -endif (ENABLE_PNG) + + if (LINK_EXECUTABLE) + find_library(_PNG_LIB png + HINTS ENV LIBRARY_PATH + DOC "The PNG library") + if (_PNG_LIB) + list(APPEND ${_LIBS_} ${_PNG_LIB}) + else() + message(FATAL_ERROR "Could not find the PNG library") + endif() + endif (LINK_EXECUTABLE) + + list(APPEND ${_FLAGS_} "-DHAVE_PNG=1") +endmacro(enable_png) diff --git a/AMDiS/cmake/enable_seq_petsc.cmake b/AMDiS/cmake/enable_seq_petsc.cmake deleted file mode 100644 index eccb108b45595b5c102e07b8b4e406a9cdb7731d..0000000000000000000000000000000000000000 --- a/AMDiS/cmake/enable_seq_petsc.cmake +++ /dev/null @@ -1,19 +0,0 @@ - -if (ENABLE_SEQ_PETSC) - find_package(MPI REQUIRED) - if(MPI_FOUND) - list(APPEND COMPILEFLAGS "${MPI_COMPILE_FLAGS}") - include_directories(${MPI_INCLUDE_PATH}) - endif(MPI_FOUND) - - set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};/usr/share/cmake-2.8/Modules/;${CMAKE_SOURCE_DIR}/") - set(PETSC_EXECUTABLE_RUNS ON) - find_package(PETSc REQUIRED) - include_directories(${PETSC_DIR}/include ${PETSC_DIR}/${PETSC_ARCH}/include) - list(APPEND AMDIS_INCLUDE_DIRS ${PETSC_DIR}/include ${PETSC_DIR}/${PETSC_ARCH}/include) - list(APPEND COMPILEFLAGS "-DHAVE_SEQ_PETSC" "-DPETSC_VERSION=${PETSC_VERSION}") - - list(APPEND AMDIS_SRC - ${SOURCE_DIR}/solver/PetscSolver.cc - ${SOURCE_DIR}/solver/PetscTypes.cc) -endif (ENABLE_SEQ_PETSC) diff --git a/AMDiS/cmake/enable_umfpack.cmake b/AMDiS/cmake/enable_umfpack.cmake index 10e5b15988f50e9621b8974b98f548ae31d6be60..156eb9e4c1d1a21ff7caed6b8620a8fd21488fda 100644 --- a/AMDiS/cmake/enable_umfpack.cmake +++ b/AMDiS/cmake/enable_umfpack.cmake @@ -1,25 +1,111 @@ +macro(enable_umfpack _FLAGS_ _INC_DIRS_ _LIBS_) + if (${ARGC} GREATER 3) + set(LINK_EXECUTABLE ON) + else () + set(LINK_EXECUTABLE OFF) + endif () -if (ENABLE_UMFPACK) if (WIN32) - set(SuiteSparse_USE_LAPACK_BLAS ON) + set(SuiteSparse_USE_LAPACK_BLAS ON) endif (WIN32) - # try to use a cmake-package of suitesparse - find_package(SuiteSparse QUIET) + if (SuiteSparse_DIR) + file(TO_CMAKE_PATH ${SuiteSparse_DIR} SuiteSparse_DIR) + endif (SuiteSparse_DIR) + + # try to use a cmake-package of suitesparse + find_package(SuiteSparse QUIET HINTS ${AMDIS_SuiteSparse_DIR}) if (SuiteSparse_FOUND) + message(STATUS "Found SuiteSparse CMake-library") include(${USE_SuiteSparse}) - list(APPEND COMPILEFLAGS "-DHAVE_UMFPACK=1" "-DMTL_HAS_UMFPACK") + if (LINK_EXECUTABLE) + list(APPEND ${_LIBS_} ${SuiteSparse_LIBRARIES}) + endif (LINK_EXECUTABLE) + list(APPEND ${_INC_DIRS_} ${SuiteSparse_INCLUDE_DIR} ${SuiteSparse_METIS_INCLUDE_DIR}) + set(FOUND_SUITESPARSE_LIBS ${SuiteSparse_LIBRARIES}) else (SuiteSparse_FOUND) + # find umfpack manually by searching for umfpack.h header file + find_library(UMFPACK_LIBRARY umfpack + HINTS ${AMDIS_UMFPACK_LIB_DIR} ${SUITESPARSE_LIB} $ENV{SUITESPARSE_LIB} + DOC "Library file for UMFPACK") find_file(UMFPACK_H umfpack.h - HINTS ENV CPATH /usr/include /usr/include/suitesparse /usr/include/ufsparse - DOC "headerfile umfpack.h for UMFPACK") - if(UMFPACK_H) + HINTS ${AMDIS_UMFPACK_INCLUDE_DIR} ${SUITESPARSE_INC} $ENV{SUITESPARSE_INC} ENV CPATH /usr/include /usr/include/suitesparse /usr/include/ufsparse + DOC "Headerfile umfpack.h for UMFPACK") + + if (UMFPACK_H AND UMFPACK_LIBRARY) get_filename_component(UMFPACK_PATH ${UMFPACK_H} PATH) - include_directories(${UMFPACK_PATH} ${UFCONFIG_PATH} ${AMD_PATH}) - list(APPEND COMPILEFLAGS "-DHAVE_UMFPACK=1" "-DMTL_HAS_UMFPACK") + list(APPEND ${_INC_DIRS_} ${UMFPACK_PATH}) + + get_filename_component(UMFPACK_LIB_PATH ${UMFPACK_LIBRARY} PATH) + set(FOUND_SUITESPARSE_LIBS ${UMFPACK_LIBRARY}) + + if (LINK_EXECUTABLE) + + # find all connected libraries + find_library(AMD_LIBRARY amd HINTS ${UMFPACK_LIB_PATH}) + + find_library(BLAS_LIB + NAMES blas fblas openblas + HINTS ${BLAS_DIR}/lib ${UMFPACK_LIB_PATH} /usr/lib/openblas-base /usr/lib/atlas-base) + if (BLAS_LIB) + set(BLAS_LIBRARIES ${BLAS_LIB}) + else (BLAS_LIB) + find_package(BLAS REQUIRED) + endif (BLAS_LIB) + + find_library(CHOLMOD_LIBRARY cholmod HINTS ${UMFPACK_LIB_PATH}) + find_library(COLAMD_LIBRARY colamd HINTS ${UMFPACK_LIB_PATH}) + find_library(SUITESPARSECONFIG_LIBRARY suitesparseconfig HINTS ${UMFPACK_LIB_PATH}) + if (AMD_LIBRARY AND BLAS_LIBRARIES) + list(APPEND FOUND_SUITESPARSE_LIBS ${AMD_LIBRARY} ${BLAS_LIBRARIES}) + endif (AMD_LIBRARY AND BLAS_LIBRARIES) + if (CHOLMOD_LIBRARY) + list(APPEND FOUND_SUITESPARSE_LIBS ${CHOLMOD_LIBRARY}) + endif (CHOLMOD_LIBRARY) + if (COLAMD_LIBRARY) + list(APPEND FOUND_SUITESPARSE_LIBS ${COLAMD_LIBRARY}) + endif (COLAMD_LIBRARY) + if (SUITESPARSECONFIG_LIBRARY) + list(APPEND FOUND_SUITESPARSE_LIBS ${SUITESPARSECONFIG_LIBRARY}) + endif (SUITESPARSECONFIG_LIBRARY) + + list(APPEND ${_LIBS_} ${FOUND_SUITESPARSE_LIBS}) + endif (LINK_EXECUTABLE) else() message(FATAL_ERROR "Could not find the UMFPACK header umfpack.h.") - endif() + endif (UMFPACK_H AND UMFPACK_LIBRARY) endif (SuiteSparse_FOUND) - SET(RPM_DEPEND_STR "blas") -endif (ENABLE_UMFPACK) + + + # Check for clock_gettime in librt + if (NOT WIN32 AND LINK_EXECUTABLE) + include(CheckLibraryExists) + check_library_exists(rt clock_gettime "time.h" HAVE_CLOCK_GETTIME) + if (HAVE_CLOCK_GETTIME) + list(APPEND ${_LIBS_} rt) + else () + check_library_exists(c clock_gettime "" HAVE_CLOCK_GETTIME) + endif (HAVE_CLOCK_GETTIME) + endif (NOT WIN32 AND LINK_EXECUTABLE) + + + # collect informations about umfpack version and found libraries + if (FOUND_SUITESPARSE_LIBS) + find_file(_UMFPACK_H umfpack.h PATHS ${SuiteSparse_INCLUDE_DIR} ${UMFPACK_PATH} NO_DEFAULT_PATH) + file(STRINGS ${_UMFPACK_H} UMFPACK_VERSION_LINE REGEX "#define UMFPACK_VERSION") + string(REGEX MATCH "\"UMFPACK V?([^\"]+)\"" UMFPACK_VERSION_REGEX ${UMFPACK_VERSION_LINE}) + set(UMFPACK_VERSION ${CMAKE_MATCH_1}) + unset(_UMFPACK_H CACHE) + + message(STATUS "UMFPACK version: ${UMFPACK_VERSION}") + if (LINK_EXECUTABLE) + message(STATUS "Found the following SuiteSparse libraries:") + foreach (lib ${FOUND_SUITESPARSE_LIBS}) + message(STATUS " ${lib}") + endforeach () + endif (LINK_EXECUTABLE) + endif (FOUND_SUITESPARSE_LIBS) + + list(APPEND ${_FLAGS_} "-DHAVE_UMFPACK=1" "-DMTL_HAS_UMFPACK=1") + +endmacro(enable_umfpack) diff --git a/AMDiS/cmake/enable_zoltan.cmake b/AMDiS/cmake/enable_zoltan.cmake new file mode 100644 index 0000000000000000000000000000000000000000..a7a22218eacc55bbe9eb85bc59c548c81f8e23ce --- /dev/null +++ b/AMDiS/cmake/enable_zoltan.cmake @@ -0,0 +1,26 @@ +macro(enable_zoltan _FLAGS_ _INC_DIRS_ _LIBS_) + if (${ARGC} GREATER 3) + set(LINK_EXECUTABLE ON) + else () + set(LINK_EXECUTABLE OFF) + endif () + + find_file(ZOLTAN_HEADER_FILE "zoltan_cpp.h" HINTS ${ZOLTAN_DIR}/include ${PETSC_INCLUDE_DIRS}) + if (ZOLTAN_HEADER_FILE) + get_filename_component(ZOLTAN_HEADER_DIR "${ZOLTAN_HEADER_FILE}" PATH CACHE) + list(APPEND ${_INC_DIRS_} ${ZOLTAN_HEADER_DIR}) + else() + message(FATAL_ERROR "Could not find Zoltan include file 'zoltan_cpp.h'!") + endif(ZOLTAN_HEADER_FILE) + + if (LINK_EXECUTABLE) + find_library(ZOLTAN_LIB zoltan + HINTS ENV LIBRARY_PATH DOC "Full path to the zoltan library") + if (NOT ZOLTAN_LIB) + message(FATAL_ERROR "Could not find zoltan library!") + endif (NOT ZOLTAN_LIB) + list(APPEND ${_LIBS_} ${ZOLTAN_LIB}) + endif (LINK_EXECUTABLE) + + list(APPEND ${_FLAGS_} "-DHAVE_ZOLTAN=1") +endmacro(enable_zoltan) diff --git a/AMDiS/cmake/muparser.cmake b/AMDiS/cmake/muparser.cmake new file mode 100644 index 0000000000000000000000000000000000000000..92e2c24f4289093347365c64492e19f09c1a0854 --- /dev/null +++ b/AMDiS/cmake/muparser.cmake @@ -0,0 +1,26 @@ +# specify the target and requirements for the muparser library + +set(MUPARSER_SOURCE_DIR ${BASE_DIR}/lib/muparser_v134/src) +set(MUPARSER_INCLUDE_DIR ${BASE_DIR}/lib/muparser_v134/include) +add_library(muparser + ${MUPARSER_SOURCE_DIR}/muParser.cpp + ${MUPARSER_SOURCE_DIR}/muParserBase.cpp + ${MUPARSER_SOURCE_DIR}/muParserBytecode.cpp + ${MUPARSER_SOURCE_DIR}/muParserCallback.cpp + ${MUPARSER_SOURCE_DIR}/muParserComplex.cpp + ${MUPARSER_SOURCE_DIR}/muParserDLL.cpp + ${MUPARSER_SOURCE_DIR}/muParserError.cpp + ${MUPARSER_SOURCE_DIR}/muParserInt.cpp + ${MUPARSER_SOURCE_DIR}/muParserTest.cpp + ${MUPARSER_SOURCE_DIR}/muParserTokenReader.cpp) + +include_directories(${MUPARSER_INCLUDE_DIR}) + +# specify how to install this target: +# ----------------------------------- + +file(GLOB MUPARSER_HEADERS "${MUPARSER_SOURCE_DIR}/include/*.h") +install(FILES ${MUPARSER_HEADERS} + DESTINATION include/amdis/muparser) +install(TARGETS muparser + DESTINATION lib/amdis/ ) diff --git a/AMDiS/cmake/myMake.sh.in b/AMDiS/cmake/myMake.sh.in deleted file mode 100755 index 11e51e842ed63156e5e06e04c64110e4662e9106..0000000000000000000000000000000000000000 --- a/AMDiS/cmake/myMake.sh.in +++ /dev/null @@ -1 +0,0 @@ -make -j@N_TEST_PROC@ $* diff --git a/AMDiS/cmake/postrm.in b/AMDiS/cmake/postrm.in deleted file mode 100755 index cdc5558a901e059c005306ed7654ff494f074d48..0000000000000000000000000000000000000000 --- a/AMDiS/cmake/postrm.in +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -if test "$1" = "upgrade" ; then - exit 0 -fi -NEWDIRS_SEMI="@deb_add_dirs@" -NEWDIRS=`echo ${NEWDIRS_SEMI} | sed 's/;/ /g'` -BASEDIR=@CPACK_INSTALL_PREFIX@ -#echo "will create the remove directories:" -for d in ${NEWDIRS}; do -# echo "${BASEDIR}${d}" - rm -r ${BASEDIR}${d} > /dev/null 2> /dev/null -done -exit 0 - diff --git a/AMDiS/cmake/preinst.in b/AMDiS/cmake/preinst.in deleted file mode 100755 index 9d38fefe96d41ed9530dd89bdd735cd294cb5fab..0000000000000000000000000000000000000000 --- a/AMDiS/cmake/preinst.in +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -NEWDIRS_SEMI="@deb_add_dirs@" -NEWDIRS=`echo ${NEWDIRS_SEMI} | sed 's/;/ /g'` -BASEDIR=@CPACK_INSTALL_PREFIX@ -#echo "will create the following directories:" -for d in ${NEWDIRS}; do -# echo "${BASEDIR}${d}" - mkdir --parents ${BASEDIR}${d} -done - diff --git a/demo/CMakeLists.txt b/demo/CMakeLists.txt index b78d91f5c1e3fce397e2d7b178313302955aece2..6127ab9d0f662611ecfba73b4828dedb37fe0d7d 100644 --- a/demo/CMakeLists.txt +++ b/demo/CMakeLists.txt @@ -1,14 +1,10 @@ project("amdis_demo") cmake_minimum_required(VERSION 2.8) -#find_package(AMDIS REQUIRED COMPONENTS umfpack ) -find_package(AMDIS REQUIRED) +find_package(AMDIS REQUIRED ${COMPONENT}) -if(AMDIS_FOUND) - message(STATUS "AMDiS was found.") - include(${AMDIS_USE_FILE}) - SET(BASIS_LIBS ${AMDIS_LIBRARIES}) -endif(AMDIS_FOUND) +include(${AMDIS_USE_FILE}) +SET(BASIS_LIBS ${AMDIS_LIBRARIES}) set(ball src/ball.cc) set(bunny src/bunny.cc)