Commit 86f1bf76 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

make eigen and mtl a system package

parent 0940aa91
......@@ -5,39 +5,18 @@ set(BACKEND "ISTL" CACHE STRING "LinearAlgebra backend. One of MTL, EIGEN, ISTL"
set_property(CACHE BACKEND PROPERTY STRINGS "MTL" "EIGEN" "ISTL")
if (BACKEND STREQUAL "MTL")
find_package(MTL REQUIRED
PATHS /usr/local/lib/mtl4 /opt/sources/mtl4 /opt/development/mtl4)
if (MTL_FOUND)
set(CXX_ELEVEN_FEATURE_LIST "MOVE" "AUTO" "RANGEDFOR" "INITLIST" "STATICASSERT" "DEFAULTIMPL")
set(MTL_COMPILE_DEFINITIONS "")
foreach(feature ${CXX_ELEVEN_FEATURE_LIST})
list(APPEND MTL_COMPILE_DEFINITIONS "MTL_WITH_${feature}")
endforeach()
find_package(SuiteSparse QUIET)
if (SuiteSparse_FOUND)
list(APPEND MTL_COMPILE_DEFINITIONS "MTL_HAS_UMFPACK")
endif (SuiteSparse_FOUND)
endif (MTL_FOUND)
find_package(MTL REQUIRED)
set(HAVE_MTL MTL_FOUND)
if (MTL_FOUND)
list(APPEND MTL_COMPILE_DEFINITIONS "ENABLE_MTL=1")
dune_register_package_flags(
COMPILE_DEFINITIONS ${MTL_COMPILE_DEFINITIONS}
INCLUDE_DIRS ${MTL_INCLUDE_DIRS})
message(STATUS " Found MTL, version: ${MTL_VERSION}")
dune_register_package_flags(LIBRARIES MTL::MTL COMPILE_DEFINITIONS "ENABLE_MTL=1")
endif (MTL_FOUND)
elseif (BACKEND STREQUAL "EIGEN")
find_package(Eigen3 REQUIRED 3.3.5)
set(HAVE_EIGEN EIGEN_FOUND)
if (EIGEN3_FOUND)
message(STATUS " Found Eigen3, version: ${EIGEN3_VERSION}")
list(APPEND EIGEN3_DEFINITIONS "ENABLE_EIGEN=1")
dune_register_package_flags(
COMPILE_DEFINITIONS ${EIGEN3_DEFINITIONS}
INCLUDE_DIRS ${EIGEN3_INCLUDE_DIRS})
message(STATUS " Found Eigen3, version: ${Eigen3_VERSION}")
dune_register_package_flags(LIBRARIES Eigen3::Eigen COMPILE_DEFINITIONS "ENABLE_EIGEN=1")
endif (EIGEN3_FOUND)
elseif (NOT dune-istl_FOUND)
message(FATAL "Need dune-istl, MTL, or Eigen3 as linear algebra backend. Change flag BACKEND!")
......
# FindMTL.cmake
#
# Finds the MTL4 library
#
# This will define the following variables
#
# MTL_FOUND
# MTL_INCLUDE_DIR
# MTL_COMPILE_DEFINITIONS
#
# and the following imported targets
#
# MTL::MTL
#
# Author: Simon Praetorius <simon.praetorius@tu-dresden.de>
mark_as_advanced(MTL_FOUND MTL_COMPILE_DEFINITIONS MTL_INCLUDE_DIR)
find_path(MTL_INCLUDE_DIR boost/numeric/mtl/mtl.hpp
HINTS
${CMAKE_CURRENT_SOURCE_DIR}/../../libs/mtl4
${CMAKE_CURRENT_SOURCE_DIR}/../../include/mtl4
ENV EBROOTMTL
PATHS
/opt/software/mtl
/opt/sources/mtl
/opt/development/mtl
)
set(MTL_COMPILE_DEFINITIONS MTL_ASSERT_FOR_THROW=1)
foreach(feature "MOVE" "AUTO" "RANGEDFOR" "INITLIST" "STATICASSERT" "DEFAULTIMPL")
list(APPEND MTL_COMPILE_DEFINITIONS MTL_WITH_${feature})
endforeach(feature)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(MTL
REQUIRED_VARS MTL_INCLUDE_DIR
)
if(MTL_FOUND AND NOT TARGET MTL::MTL)
add_library(MTL::MTL INTERFACE IMPORTED)
find_package(SuiteSparse QUIET)
if (SuiteSparse_FOUND)
list(APPEND MTL_COMPILE_DEFINITIONS "MTL_HAS_UMFPACK")
endif (SuiteSparse_FOUND)
set_target_properties(MTL::MTL PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${MTL_INCLUDE_DIR}"
INTERFACE_COMPILE_DEFINITIONS "${MTL_COMPILE_DEFINITIONS}"
)
endif()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment