Commit 1d0f5b90 authored by Reuther, Sebastian's avatar Reuther, Sebastian

Merge branch 'release/v1.2' into 'master'

Release/v1.2

See merge request !28
parents 31322270 9d352199
Pipeline #1658 passed with stages
in 48 minutes and 56 seconds
......@@ -17,8 +17,6 @@ build:9-debug-gcc:
- install/
name: "$CI_BUILD_NAME"
expire_in: 6 hrs
only:
- master
build:9-release-gcc:
stage: build
......@@ -29,8 +27,6 @@ build:9-release-gcc:
- install/
name: "$CI_BUILD_NAME"
expire_in: 6 hrs
only:
- master
build:9-parallel-debug-gcc:
stage: build
......@@ -41,8 +37,6 @@ build:9-parallel-debug-gcc:
- install/
name: "$CI_BUILD_NAME"
expire_in: 6 hrs
only:
- master
build:9-parallel-release-gcc:
stage: build
......@@ -53,8 +47,6 @@ build:9-parallel-release-gcc:
- install/
name: "$CI_BUILD_NAME"
expire_in: 6 hrs
only:
- master
# compile the demos
......@@ -64,8 +56,6 @@ demo:9-debug-gcc:
- tools/build_amdis.sh --stage demo --config Debug
dependencies:
- build:9-debug-gcc
only:
- master
demo:9-release-gcc:
stage: demo
......@@ -73,8 +63,6 @@ demo:9-release-gcc:
- tools/build_amdis.sh --stage demo --config Release
dependencies:
- build:9-release-gcc
only:
- master
demo:9-parallel-debug-gcc:
stage: demo
......@@ -82,8 +70,6 @@ demo:9-parallel-debug-gcc:
- tools/build_amdis.sh --stage demo --config Debug --parallel
dependencies:
- build:9-parallel-debug-gcc
only:
- master
demo:9-parallel-release-gcc:
stage: demo
......@@ -91,8 +77,6 @@ demo:9-parallel-release-gcc:
- tools/build_amdis.sh --stage demo --config Release --parallel
dependencies:
- build:9-parallel-release-gcc
only:
- master
# compiel and run the tests
......@@ -102,8 +86,6 @@ test:9-debug-gcc:
- tools/build_amdis.sh --stage test --config Debug
dependencies:
- build:9-debug-gcc
only:
- master
test:9-release-gcc:
stage: test
......@@ -111,8 +93,6 @@ test:9-release-gcc:
- tools/build_amdis.sh --stage test --config Release
dependencies:
- build:9-release-gcc
only:
- master
test:9-parallel-debug-gcc:
stage: test
......@@ -120,8 +100,6 @@ test:9-parallel-debug-gcc:
- tools/build_amdis.sh --stage test --config Debug --parallel
dependencies:
- build:9-parallel-debug-gcc
only:
- master
test:9-parallel-release-gcc:
stage: test
......@@ -129,5 +107,3 @@ test:9-parallel-release-gcc:
- tools/build_amdis.sh --stage test --config Release --parallel
dependencies:
- build:9-parallel-release-gcc
only:
- master
set(CMAKE_LEGACY_CYGWIN_WIN32 0)
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
project(AMDiS)
set(AMDiS_VERSION "1.1.0")
set(AMDiS_VERSION "1.2.0")
set(BASE_DIR ${AMDiS_SOURCE_DIR})
set(SOURCE_DIR ${BASE_DIR}/src)
......@@ -17,11 +17,28 @@ endif ()
# some options to control the build process
option(ENABLE_PARALLEL_DOMAIN "Use parallel domain decomposition" false)
option(ENABLE_MPI "Compile with MPI compiler and library" 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_SEQ_PETSC "Use sequential PETSc solvers" false)
include(CMakeDependentOption)
# additional options for parallel_domain
# {
cmake_dependent_option(ENABLE_ZOLTAN
"Add support for the Parallel Partitioning suite Zoltan" false
"ENABLE_PARALLEL_DOMAIN" false)
cmake_dependent_option(ENABLE_PARALLEL_SOLVERS
"Add some problem dependent solver, e.g. Feti, Navier-Stokes and Cahn-Hilliard" true
"ENABLE_PARALLEL_DOMAIN" false)
cmake_dependent_option(ENABLE_BDDCML
"Add support for the BDDCML library" false
"ENABLE_PARALLEL_DOMAIN" false)
# }
# enable/disable some more features
option(ENABLE_COMPRESSION "Use output compression for vtu and arh files" true)
......@@ -33,6 +50,12 @@ mark_as_advanced(ENABLE_REINIT)
option(ENABLE_COMPOSITE_FEM "Compile compositeFEM library" true)
mark_as_advanced(ENABLE_COMPOSITE_FEM)
option(ENABLE_OPENMP "Compile with OpenMP flags. (Experimental)" false)
mark_as_advanced(ENABLE_OPENMP)
option(ENABLE_SEQ_PETSC "Use sequential PETSc solvers" false)
mark_as_advanced(ENABLE_SEQ_PETSC)
option(BUILD_SHARED_LIBS "Build all libraries as shared or static, default: shared" true)
mark_as_advanced(BUILD_SHARED_LIBS)
......@@ -46,6 +69,7 @@ endif (MSVC)
# parallel of sequential version
if (ENABLE_PARALLEL_DOMAIN)
set(ENABLE_MPI CACHE BOOL "Compile with MPI compiler and library" FORCE)
set(POSTFIX "-p")
else ()
set(POSTFIX "-s")
......
......@@ -182,6 +182,11 @@ list(APPEND AMDIS_SRC
${SOURCE_DIR}/ProblemStatDbg.cc
)
if (ENABLE_MPI)
enable_mpi(COMPILEFLAGS AMDIS_INCLUDE_DIRS _)
list(APPEND COMPILEFLAGS "-DHAVE_MPI=1")
endif (ENABLE_MPI)
include(amdis_parallel)
include(muparser)
......
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
......@@ -26,7 +20,6 @@ if (ENABLE_PARALLEL_DOMAIN)
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
......
......@@ -12,22 +12,14 @@ macro(enable_mtl4 _FLAGS_ _INC_DIRS_ _LIBS_)
endif (LINK_EXECUTABLE)
list(APPEND ${_FLAGS_} "-DMTL_ASSERT_FOR_THROW=1")
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 ()
set (CXX_ELEVEN_FEATURE_LIST "MOVE" "AUTO" "RANGEDFOR" "INITLIST" "STATICASSERT" "DEFAULTIMPL")
foreach (feature ${CXX_ELEVEN_FEATURE_LIST})
list(APPEND ${_FLAGS_} "-DMTL_WITH_${feature}")
endforeach ()
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)
list(APPEND ${_FLAGS_} "-DMTL_WITH_OPENMP" "-DHAVE_OPENMP" ${OpenMP_CXX_FLAGS})
endif (ENABLE_OPENMP)
endmacro(enable_mtl4)
set(AMDIS_NEED_CXX11 @ENABLE_CXX11@)
set(AMDIS_NEED_UMFPACK @ENABLE_UMFPACK@)
set(AMDIS_NEED_COMPRESSION @ENABLE_COMPRESSION@)
set(AMDIS_NEED_EXTENSIONS @ENABLE_EXTENSIONS@)
......@@ -12,22 +11,23 @@ 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@)
add_library(amdis_base INTERFACE)
add_library(AMDiS ALIAS amdis_base)
target_compile_definitions(amdis_base INTERFACE)
if (AMDIS_NEED_CXX11)
target_enable_cxx11(AMDIS_NEED_CXX11 amdis_base INTERFACE)
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)
target_compile_definitions(amdis_base INTERFACE AMDIS_HAS_CXX11=1)
else ()
target_compile_definitions(amdis_base INTERFACE AMDIS_HAS_CXX11=0)
endif (AMDIS_NEED_CXX11)
target_enable_cxx14(SUPPORTS_CXX14 amdis_base INTERFACE)
if (NOT SUPPORTS_CXX14)
target_enable_cxx11(SUPPORTS_CXX11 amdis_base INTERFACE)
endif ()
if (NOT SUPPORTS_CXX11 AND NOT SUPPORTS_CXX14)
message(FATAL_ERROR "AMDiS was compiled with c++11 support, but the current compiler does not support this feature!")
endif ()
target_compile_definitions(amdis_base INTERFACE AMDIS_HAS_CXX11=1)
# try to detect the AMDiS include directory
......@@ -78,8 +78,7 @@ target_enable_boost(amdis_base INTERFACE ON)
# --------------------
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)
set(AMDIS_UMFPACK_ROOT_DIR @UMFPACK_ROOT_DIR@)
target_enable_umfpack(amdis_base INTERFACE ON)
endif (AMDIS_NEED_UMFPACK)
......
......@@ -23,12 +23,19 @@ add_library(AMDiS::base ALIAS amdis_base)
target_include_directories(amdis_base INTERFACE ${SOURCE_DIR})
target_compile_definitions(amdis_base INTERFACE)
target_enable_cxx11(ENABLE_CXX11 amdis_base INTERFACE)
if (ENABLE_CXX11)
target_compile_definitions(amdis_base INTERFACE AMDIS_HAS_CXX11=1)
target_enable_cxx14(SUPPORTS_CXX14 amdis_base INTERFACE)
if (SUPPORTS_CXX14)
target_compile_definitions(amdis_base INTERFACE AMDIS_HAS_CXX14=1)
else ()
target_compile_definitions(amdis_base INTERFACE AMDIS_HAS_CXX11=0)
endif (ENABLE_CXX11)
target_enable_cxx11(SUPPORTS_CXX11 amdis_base INTERFACE)
endif ()
if (NOT SUPPORTS_CXX11 AND NOT SUPPORTS_CXX14)
message(FATAL_ERROR "AMDiS needs c++11 support, but the current compiler does not support this feature!")
endif ()
target_compile_definitions(amdis_base INTERFACE AMDIS_HAS_CXX11=1)
target_enable_mtl4(amdis_base INTERFACE)
target_enable_boost(amdis_base INTERFACE)
......@@ -65,6 +72,7 @@ add_library(amdis
${SOURCE_DIR}/DOFAdmin.cc
${SOURCE_DIR}/DOFIndexed.cc
${SOURCE_DIR}/DOFMatrix.cc
${SOURCE_DIR}/DOFSerializer.cc
${SOURCE_DIR}/DOFVector.cc
${SOURCE_DIR}/DirichletBC.cc
${SOURCE_DIR}/DualTraverse.cc
......@@ -171,6 +179,11 @@ add_library(amdis
${SOURCE_DIR}/ProblemStatDbg.cc
)
if (ENABLE_MPI)
target_enable_mpi(amdis_base INTERFACE)
target_compile_definitions(amdis_base INTERFACE HAVE_MPI=1)
endif (ENABLE_MPI)
include(amdis_parallel) # adds sources to amdis
include(amdis_extensions) # -> target AMDiS::extensions
include(muparser) # -> target muparser
......
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)
mark_as_advanced(ENABLE_PARALLEL_SOLVERS)
add_library(amdis_parallel INTERFACE)
target_sources(amdis PRIVATE
${SOURCE_DIR}/parallel/DofComm.cc
......@@ -26,7 +22,6 @@ if (ENABLE_PARALLEL_DOMAIN)
target_compile_definitions(amdis_parallel INTERFACE
HAVE_PARALLEL_DOMAIN_AMDIS=1)
target_enable_mpi(amdis_parallel INTERFACE)
target_enable_petsc(amdis_parallel INTERFACE)
# add support for the zoltan library
......
......@@ -17,10 +17,8 @@ add_library(muparser STATIC
target_include_directories(muparser PUBLIC ${MUPARSER_INCLUDE_DIR})
set_property(TARGET muparser PROPERTY POSITION_INDEPENDENT_CODE ON)
if (ENABLE_CXX11)
target_enable_cxx11(MUPARSER_ENABLE_CXX11 muparser PRIVATE)
target_compile_definitions(muparser PRIVATE AMDIS_HAS_CXX11=1)
endif (ENABLE_CXX11)
target_enable_cxx11(MUPARSER_ENABLE_CXX11 muparser PRIVATE)
target_compile_definitions(muparser PRIVATE AMDIS_HAS_CXX11=1)
# specify how to install this target:
# -----------------------------------
......
......@@ -19,7 +19,7 @@ macro(target_enable_bddcml _TARGET_ _SCOPE_)
message(FATAL_ERROR "Could not find BDDCML headers.")
endif()
if (LINK_EXECUTABLE)
if (LINK_EXECUTABLE OR APPLE)
find_library(BDDCML_LIB bddcml
HINTS ENV LIBRARY_PATH
DOC "BDDCML library")
......@@ -29,7 +29,7 @@ macro(target_enable_bddcml _TARGET_ _SCOPE_)
else()
message(FATAL_ERROR "Could not find the BDDCML library")
endif()
endif (LINK_EXECUTABLE)
endif (LINK_EXECUTABLE OR APPLE)
target_compile_definitions(${_TARGET_} ${_SCOPE_} HAVE_BDDCML=1)
endmacro(target_enable_bddcml)
......@@ -28,9 +28,9 @@ macro(target_enable_boost _TARGET_ _SCOPE_)
find_package(Boost ${BOOST_VERSION} REQUIRED ${BOOST_LIBS_REQUIRED})
target_include_directories(${_TARGET_} ${_SCOPE_} ${Boost_INCLUDE_DIR})
if (LINK_EXECUTABLE)
if (LINK_EXECUTABLE OR APPLE)
target_link_libraries(${_TARGET_} ${_SCOPE_} ${Boost_LIBRARIES})
endif (LINK_EXECUTABLE)
endif (LINK_EXECUTABLE OR APPLE)
if (MSVC_SHARED_LIBS AND LINK_EXECUTABLE)
link_directories(${Boost_LIBRARY_DIRS})
......
include(CheckCXXCompilerFlag)
include(CheckCXXSourceCompiles)
macro(target_enable_cxx14 RESULT_VAR _TARGET_ _SCOPE_)
check_cxx_compiler_flag("-std=c++14" COMPILER_SUPPORTS_CXX14_FLAG)
set(CXX14_CODE "
auto f() { return 1; }
int main(){
auto f1 = [](auto const& y) { return y; };
auto y0 = f();
auto y1 = f1(1);
}")
if (COMPILER_SUPPORTS_CXX14_FLAG)
set(CMAKE_REQUIRED_FLAGS "-std=c++14")
check_cxx_source_compiles("${CXX14_CODE}" CXX14_COMPILES_WITH_CXX14_FLAG)
set(CMAKE_REQUIRED_FLAGS "")
endif ()
if (COMPILER_SUPPORTS_CXX14_FLAG AND CXX14_COMPILES_WITH_CXX14_FLAG)
target_compile_options(${_TARGET_} ${_SCOPE_} "-std=c++14")
set(${RESULT_VAR} true CACHE BOOL "Enable C++14 compiler features" FORCE)
else ()
check_cxx_source_compiles("${CXX14_CODE}" CXX14_COMPILES)
if (CXX14_COMPILES)
set(${RESULT_VAR} true CACHE BOOL "Enable C++14 compiler features" FORCE)
else ()
set(${RESULT_VAR} false CACHE BOOL "Enable C++14 compiler features" FORCE)
endif ()
endif ()
endmacro(target_enable_cxx14)
macro(target_enable_cxx11 RESULT_VAR _TARGET_ _SCOPE_)
check_cxx_compiler_flag("-std=c++11" COMPILER_SUPPORTS_CXX11_FLAG)
......
......@@ -21,7 +21,7 @@ macro(target_enable_hypre _TARGET_ _SCOPE_)
target_include_directories(${_TARGET_} ${_SCOPE_} ${HYPRE_INCLUDE_DIRECTORIES})
endif (_HYPRE_H)
if (LINK_EXECUTABLE)
if (LINK_EXECUTABLE OR APPLE)
find_library(_HYPRE_LIB HYPRE
HINTS ${PETSC_LIBRARY_DIRS})
......@@ -41,10 +41,10 @@ macro(target_enable_hypre _TARGET_ _SCOPE_)
find_package(LAPACK REQUIRED)
endif (LAPACK_LIB)
target_link_libraries(${_TARGET_} ${_SCOPE_} ${LAPACK_LIBRARIES})
endif (LINK_EXECUTABLE)
endif (LINK_EXECUTABLE OR APPLE)
if (_HYPRE_H AND (NOT LINK_EXECUTABLE OR _HYPRE_LIB))
if (_HYPRE_H AND (NOT LINK_EXECUTABLE OR _HYPRE_LIB OR APPLE))
set(HAVE_HYPRE ON)
target_compile_definitions(${_TARGET_} ${_SCOPE_} MTL_HAS_HYPRE)
else ()
......
macro(target_enable_mtl4 _TARGET_ _SCOPE_)
if (${ARGC} GREATER 2)
set(LINK_EXECUTABLE ON)
else ()
set(LINK_EXECUTABLE OFF)
endif ()
if (${ARGC} GREATER 2)
set(LINK_EXECUTABLE ON)
else ()
set(LINK_EXECUTABLE OFF)
endif ()
if (LINK_EXECUTABLE)
target_include_directories(${_TARGET_} ${_SCOPE_} ${AMDIS_INCLUDE_DIR}/mtl4)
else ()
target_include_directories(${_TARGET_} ${_SCOPE_} ${BASE_DIR}/lib/mtl4)
endif (LINK_EXECUTABLE)
target_compile_definitions(${_TARGET_} ${_SCOPE_} MTL_ASSERT_FOR_THROW=1)
if (LINK_EXECUTABLE)
target_include_directories(${_TARGET_} ${_SCOPE_} ${AMDIS_INCLUDE_DIR}/mtl4)
else ()
target_include_directories(${_TARGET_} ${_SCOPE_} ${BASE_DIR}/lib/mtl4)
endif (LINK_EXECUTABLE)
target_compile_definitions(${_TARGET_} ${_SCOPE_} MTL_ASSERT_FOR_THROW=1)
if (ENABLE_CXX11)
set (CXX_ELEVEN_FEATURE_LIST "MOVE" "AUTO" "RANGEDFOR" "INITLIST" "STATICASSERT" "DEFAULTIMPL")
foreach (feature ${CXX_ELEVEN_FEATURE_LIST})
target_compile_definitions(${_TARGET_} ${_SCOPE_} MTL_WITH_${feature})
endforeach ()
endif (ENABLE_CXX11)
if (ENABLE_OPENMP)
find_package(OpenMP REQUIRED)
if (OPENMP_FOUND)
target_compile_definitions(${_TARGET_} ${_SCOPE_} MTL_WITH_OPENMP)
target_compile_options(${_TARGET_} ${_SCOPE_} ${OpenMP_CXX_FLAGS})
else ()
message(FATAL_ERROR "OpenMP not found")
endif (OPENMP_FOUND)
endif (ENABLE_OPENMP)
set (CXX_ELEVEN_FEATURE_LIST "MOVE" "AUTO" "RANGEDFOR" "INITLIST" "STATICASSERT" "DEFAULTIMPL")
foreach (feature ${CXX_ELEVEN_FEATURE_LIST})
target_compile_definitions(${_TARGET_} ${_SCOPE_} MTL_WITH_${feature})
endforeach ()
if (ENABLE_OPENMP)
find_package(OpenMP REQUIRED)
target_compile_definitions(${_TARGET_} ${_SCOPE_} MTL_WITH_OPENMP HAVE_OPENMP)
target_compile_options(${_TARGET_} ${_SCOPE_} ${OpenMP_CXX_FLAGS})
endif (ENABLE_OPENMP)
endmacro(target_enable_mtl4)
......@@ -13,7 +13,7 @@ macro(target_enable_mpi _TARGET_ _SCOPE_)
target_compile_options(${_TARGET_} ${_SCOPE_}
${MPI_CXX_COMPILE_FLAGS})
if (LINK_EXECUTABLE)
if (LINK_EXECUTABLE OR APPLE)
# the parameter --enable-new-dtags causes a linker problem, i.e. some libraries are
# linked without an rpath (or any other path information) and can not be found while
# running the executable. The hack below removes this flag manually from the linker flags.
......@@ -21,7 +21,7 @@ macro(target_enable_mpi _TARGET_ _SCOPE_)
string(STRIP "${MY_MPI_CXX_LINK_FLAGS}" MY_MPI_CXX_LINK_FLAGS)
target_link_libraries(${_TARGET_} ${_SCOPE_} ${MPI_CXX_LIBRARIES} ${MY_MPI_CXX_LINK_FLAGS})
endif (LINK_EXECUTABLE)
endif (LINK_EXECUTABLE OR APPLE)
endmacro(target_enable_mpi)
macro(target_enable_petsc _TARGET_ _SCOPE_)
......@@ -39,7 +39,8 @@ macro(target_enable_petsc _TARGET_ _SCOPE_)
$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)
/usr/lib/petsc/linux-gnu-c-opt/lib/pkgconfig
PATHS $ENV{PKG_CONFIG_PATH})
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})
......@@ -74,7 +75,7 @@ macro(target_enable_petsc _TARGET_ _SCOPE_)
PETSC_VERSION=${PETSC_VERSION})
target_compile_options(${_TARGET_} ${_SCOPE_} ${PETSC_DEFINITIONS})
if (LINK_EXECUTABLE)
if (LINK_EXECUTABLE OR APPLE)
set(PETSC_LINK_LIBRARIES "")
foreach (_PETSC_LIB ${PETSC_LIBRARIES})
find_library(_PETSC_LINK_LIB ${_PETSC_LIB} PATHS ${PETSC_LIBRARY_DIRS} NO_DEFAULT_PATH)
......@@ -82,7 +83,7 @@ macro(target_enable_petsc _TARGET_ _SCOPE_)
endforeach()
message(STATUS " Found PETSc library ${PETSC_LINK_LIBRARIES}")
target_link_libraries(${_TARGET_} ${_SCOPE_} ${PETSC_LINK_LIBRARIES})
endif (LINK_EXECUTABLE)
endif (LINK_EXECUTABLE OR APPLE)
# parmetis is required
......@@ -104,7 +105,7 @@ macro(target_enable_petsc _TARGET_ _SCOPE_)
message(FATAL_ERROR "Could not find ParMetis header file 'parmetis.h'!")
endif (PARMETIS_HEADER_FILE)
if (LINK_EXECUTABLE)
if (LINK_EXECUTABLE OR APPLE)
find_library(PARMETIS_LIB parmetis
HINTS ${PARMETIS_DIR}/lib ${PETSC_LIBRARY_DIRS})
if (NOT PARMETIS_LIB)
......@@ -112,7 +113,7 @@ macro(target_enable_petsc _TARGET_ _SCOPE_)
endif (NOT PARMETIS_LIB)
message(STATUS " Found ParMetis library ${PARMETIS_LIB}")
target_link_libraries(${_TARGET_} ${_SCOPE_} ${PARMETIS_LIB})
endif (LINK_EXECUTABLE)
endif (LINK_EXECUTABLE OR APPLE)
# metis is required
......@@ -125,7 +126,7 @@ macro(target_enable_petsc _TARGET_ _SCOPE_)
message(FATAL_ERROR "Could not find Metis header file 'metis.h'!")
endif (METIS_HEADER_FILE)
if (LINK_EXECUTABLE)
if (LINK_EXECUTABLE OR APPLE)
find_library(METIS_LIB metis
HINTS ${METIS_DIR}/lib ${PETSC_LIBRARY_DIRS})
if (NOT METIS_LIB)
......@@ -133,11 +134,11 @@ macro(target_enable_petsc _TARGET_ _SCOPE_)
endif (NOT METIS_LIB)
message(STATUS " Found Metis library ${METIS_LIB}")
target_link_libraries(${_TARGET_} ${_SCOPE_} ${METIS_LIB})
endif (LINK_EXECUTABLE)
endif (LINK_EXECUTABLE OR APPLE)
# blas library is required
if (LINK_EXECUTABLE)
if (LINK_EXECUTABLE OR APPLE)
find_library(BLAS_LIB
NAMES blas fblas openblas
HINTS ${BLAS_DIR}/lib ${PETSC_LIBRARY_DIRS} /usr/lib/openblas-base /usr/lib/atlas-base)
......@@ -147,11 +148,11 @@ macro(target_enable_petsc _TARGET_ _SCOPE_)
find_package(BLAS REQUIRED)
endif (BLAS_LIB)
target_link_libraries(${_TARGET_} ${_SCOPE_} ${BLAS_LIBRARIES})
endif (LINK_EXECUTABLE)
endif (LINK_EXECUTABLE OR APPLE)
# lapack library is required
if (LINK_EXECUTABLE)
if (LINK_EXECUTABLE OR APPLE)
find_library(LAPACK_LIB
NAMES lapack flapack
HINTS ${LAPACK_DIR}/lib ${PETSC_LIBRARY_DIRS} ${PETSC_DIR}/lib)
......@@ -161,5 +162,5 @@ macro(target_enable_petsc _TARGET_ _SCOPE_)
find_package(LAPACK REQUIRED)
endif (LAPACK_LIB)
target_link_libraries(${_TARGET_} ${_SCOPE_} ${LAPACK_LIBRARIES})
endif (LINK_EXECUTABLE)
endif (LINK_EXECUTABLE OR APPLE)
endmacro(target_enable_petsc)
......@@ -25,7 +25,7 @@ macro(target_enable_png _TARGET_ _SCOPE_)
get_filename_component(PNG_PATH ${_PNG_H} PATH)
target_include_directories(${_TARGET_} ${_SCOPE_} ${PNG_PATH})
if (LINK_EXECUTABLE)
if (LINK_EXECUTABLE OR APPLE)
find_library(_PNG_LIB png
HINTS ENV LIBRARY_PATH
DOC "The PNG library")
......@@ -34,7 +34,7 @@ macro(target_enable_png _TARGET_ _SCOPE_)
else()
message(FATAL_ERROR "Could not find the PNG library")
endif()
endif (LINK_EXECUTABLE)
endif (LINK_EXECUTABLE OR APPLE)
target_compile_definitions(${_TARGET_} ${_SCOPE_} HAVE_PNG=1)
endmacro(target_enable_png)
......@@ -18,19 +18,22 @@ macro(target_enable_umfpack _TARGET_ _SCOPE_)
if (SuiteSparse_FOUND)
message(STATUS "Found SuiteSparse CMake-library")
include(${USE_SuiteSparse})
if (LINK_EXECUTABLE)
if (LINK_EXECUTABLE OR APPLE)
target_link_libraries(${_TARGET_} ${_SCOPE_} ${SuiteSparse_LIBRARIES})
endif (LINK_EXECUTABLE)
endif (LINK_EXECUTABLE OR APPLE)
target_include_directories(${_TARGET_} ${_SCOPE_} ${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")
HINTS ${AMDIS_UMFPACK_ROOT_DIR}
PATHS $ENV{EBROOTSUITESPARSE}
PATH_SUFFIXES lib/ lib64/
DOC "Library file for UMFPACK")
find_file(UMFPACK_H 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")
HINTS ${AMDIS_UMFPACK_ROOT_DIR}/include
PATHS /usr/include/suitesparse /usr/include/ufsparse $ENV{EBROOTSUITESPARSE}/include
DOC "Headerfile umfpack.h for UMFPACK")
if (UMFPACK_H AND UMFPACK_LIBRARY)
get_filename_component(UMFPACK_PATH ${UMFPACK_H} PATH)
......@@ -39,7 +42,13 @@ macro(target_enable_umfpack _TARGET_ _SCOPE_)
get_filename_component(UMFPACK_LIB_PATH ${UMFPACK_LIBRARY} PATH)
set(FOUND_SUITESPARSE_LIBS ${UMFPACK_LIBRARY})
if (LINK_EXECUTABLE)
# extract root directory from umfpack lib dir
set (UMFPACK_ROOT_DIR ${UMFPACK_LIB_PATH}/..)
if (NOT EXISTS ${UMFPACK_ROOT_DIR}/include)
message(WARNING "directory ${UMFPACK_ROOT_DIR} is not a valid root dir of an umfpack installation.")
endif ()
if (LINK_EXECUTABLE OR APPLE)
# find all connected libraries
find_library(AMD_LIBRARY amd HINTS ${UMFPACK_LIB_PATH})
......@@ -70,15 +79,20 @@ macro(target_enable_umfpack _TARGET_ _SCOPE_)
endif (SUITESPARSECONFIG_LIBRARY)
target_link_libraries(${_TARGET_} ${_SCOPE_} ${FOUND_SUITESPARSE_LIBS})
endif (LINK_EXECUTABLE)
endif (LINK_EXECUTABLE OR APPLE)
else()
message(FATAL_ERROR "Could not find the UMFPACK header umfpack.h.")
if (NOT UMFPACK_H)
message(FATAL_ERROR "Could not find the UMFPACK header umfpack.h.")
endif ()
if (NOT UMFPACK_LIBRARY)
message(FATAL_ERROR "Could not find the UMFPACK library libumfpack.so")
endif ()
endif (UMFPACK_H AND UMFPACK_LIBRARY)
endif (SuiteSparse_FOUND)
# Check for clock_gettime in librt
if (NOT WIN32 AND LINK_EXECUTABLE)
if (NOT WIN32 AND (LINK_EXECUTABLE OR APPLE))
include(CheckLibraryExists)
check_library_exists(rt clock_gettime "time.h" HAVE_CLOCK_GETTIME)
if (HAVE_CLOCK_GETTIME)
......@@ -86,7 +100,7 @@ macro(target_enable_umfpack _TARGET_ _SCOPE_)
else ()
check_library_exists(c clock_gettime "" HAVE_CLOCK_GETTIME)
endif (HAVE_CLOCK_GETTIME)
endif (NOT WIN32 AND LINK_EXECUTABLE)
endif (NOT WIN32 AND (LINK_EXECUTABLE OR APPLE))
# collect informations about umfpack version and found libraries
......@@ -98,12 +112,12 @@ macro(target_enable_umfpack _TARGET_ _SCOPE_)
unset(_UMFPACK_H CACHE)
message(STATUS "UMFPACK version: ${UMFPACK_VERSION}")
if (LINK_EXECUTABLE)
if (LINK_EXECUTABLE OR APPLE)
message(STATUS "Found the following SuiteSparse libraries:")
foreach (lib ${FOUND_SUITESPARSE_LIBS})
message(STATUS " ${lib}")
endforeach ()
endif (LINK_EXECUTABLE)
endif (LINK_EXECUTABLE OR APPLE)
endif (FOUND_SUITESPARSE_LIBS)
target_compile_definitions(${_TARGET_} ${_SCOPE_}
......
......@@ -11,7 +11,7 @@ macro(target_enable_zoltan _TARGET_ _SCOPE_)
find_file(ZOLTAN_HEADER_FILE "zoltan.h" PATHS ${Zoltan_INCLUDE_DIRS})
target_include_directories(${_TARGET_} ${_SCOPE_} ${Zoltan_INCLUDE_DIRS})
if (LINK_EXECUTABLE)
if (LINK_EXECUTABLE OR APPLE)
foreach (LIB_NAME ${Zoltan_LIBRARIES})
find_library(_ZOLTAN_LIB ${LIB_NAME} HINTS ${Zoltan_LIBRARY_DIRS})
if (NOT _ZOLTAN_LIB)
......@@ -21,7 +21,7 @@ macro(target_enable_zoltan _TARGET_ _SCOPE_)
endif ()
unset(_ZOLTAN_LIB CACHE)