Commit 4b1fa518 authored by Praetorius, Simon's avatar Praetorius, Simon

initial dune-dec commit

parents
2016 Ingo Nitschke <ingo.nitschke@tu-dresden.de>
2016 Simon Praetorius <simon.praetorius@tu-dresden.de>
\ No newline at end of file
cmake_minimum_required(VERSION 3.1)
project(dune-dec CXX)
set(ALBERTA_ROOT /opt/software/alberta)
set(ALBERTA_INCLUDE_DIR /opt/software/alberta/include)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
add_subdirectory("cmake")
find_package(dune-common REQUIRED)
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/modules"
${dune-common_MODULE_PATH})
#include the dune macros
include(DuneMacros)
dune_project()
dune_enable_all_packages()
add_library(dec-pde-base INTERFACE)
enable_cxx14(dec-pde-base INTERFACE)
test_compile_features(dec-pde-base INTERFACE)
if (NOT CXX17_FILESYSTEM_INCLUDE)
target_enable_boost(dec-pde-base INTERFACE 1.48 filesystem)
endif ()
target_enable_petsc(dec-pde-base INTERFACE 3.4)
target_enable_eigen(dec-pde-base INTERFACE 3.2)
target_enable_zlib(dec-pde-base INTERFACE)
target_compile_definitions(dec-pde-base INTERFACE "DEC_USE_CIRCUMCENTER=1")
target_include_directories(dec-pde-base INTERFACE ${CMAKE_SOURCE_DIR}/src)
# add_subdirectory("doc")
add_subdirectory("src")
add_subdirectory("examples" EXCLUDE_FROM_ALL)
# enable_testing()
# add_subdirectory("test" EXCLUDE_FROM_ALL)
configure_file(${CMAKE_SOURCE_DIR}/cmake/decpdeConfig.cmake.in
${CMAKE_BINARY_DIR}/decpdeConfig.cmake @ONLY)
install(FILES ${CMAKE_BINARY_DIR}/decpdeConfig.cmake DESTINATION share/decpde/)
# finalize the dune project, e.g. generating config.h etc.
finalize_dune_project(GENERATE_CONFIG_H_CMAKE)
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
# DEC-PDE
A discrete exterior calculus (DEC) framework for the solution of partial
differential equations. The toolbox provides essential tools to handle the
corresponding meshes and geometric entities, as well as the assembling of
various discrete operators, like the *discrete exterior derivative*,
*codifferential*, *Hodge star*, *discrete wedge product*, discrete *flat* and
*sharp* operators and thus also higher order operators, like the
*Laplace-Beltrami* operator or the *Laplace-deRham* operator.
The implementation allows well-centered triangulations and also the barycentric
form for more general meshes.
A references, see, e.g., Anil N. Hirani: "Discrete Exterior Calculus", PhD
Thesis (2003) [Link](http://thesis.library.caltech.edu/1885/3/thesis_hirani.pdf).
## Installation
We provide a *cmake*-based configuration. See also the `INSTALL.md` file in the
source directory.
## Documentation
Currently only a *doxygen*-based documentation of the source files is available.
Generate a html version by
```
doxygen doc/Doxyfile
```
# provide some macros
include (${CMAKE_CURRENT_SOURCE_DIR}/target_add_sources.cmake)
include (${CMAKE_CURRENT_SOURCE_DIR}/target_enable_petsc.cmake)
include (${CMAKE_CURRENT_SOURCE_DIR}/target_enable_eigen.cmake)
include (${CMAKE_CURRENT_SOURCE_DIR}/target_enable_boost.cmake)
include (${CMAKE_CURRENT_SOURCE_DIR}/target_enable_zlib.cmake)
include (${CMAKE_CURRENT_SOURCE_DIR}/test_compile_features.cmake)
install(FILES
target_add_sources.cmake
target_enable_petsc.cmake
target_enable_eigen.cmake
target_enable_boost.cmake
target_enable_zlib.cmake
test_compile_features.cmake
DESTINATION share/decpde/cmake/
)
set(CPACK_PACKAGE_NAME "dec-pde")
set(CPACK_PACKAGE_VERSION "0.1")
SET(CPACK_PACKAGE_VERSION_MAJOR "0")
SET(CPACK_PACKAGE_VERSION_MINOR "1")
SET(CPACK_PACKAGE_VERSION_PATCH "0")
set(CPACK_PACKAGE_CONTACT "Simon Praetorius <simon.praetorius@tu-dresden.de>")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "DEC framework for the solution of PDEs.")
set(CPACK_PACKAGE_DESCRIPTION_FILE "@CMAKE_SOURCE_DIR@/README.md")
set(CPACK_PACKAGE_DESCRIPTION "A discrete exterior calculus (DEC) framework for the solution of partial
differential equations. The toolbox provides essential tools to handle the
corresponding meshes and geometric entities, as well as the assembling of
various discrete operators, like the discrete exterior derivative,
codifferential, Hodge star, discrete wedge product, discrete flat and
sharp operators and thus also higher order operators, like the
Laplace-Beltrami operator or the Laplace-deRham operator.")
set(CPACK_RESOURCE_FILE_LICENSE "@CMAKE_SOURCE_DIR@/LICENSE")
set(CPACK_RESOURCE_FILE_README "@CMAKE_SOURCE_DIR@/README.md")
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
\ No newline at end of file
@PACKAGE_NAME@ (@PACKAGE_VERSION@-1) UNRELEASED; urgency=medium
* Initial release.
-- @PACKAGE_CONTACT@ Tue, 28 Jun 2016 15:49:26 +0200
Source: @PACKAGE_NAME@
Maintainer: @PACKAGE_CONTACT@
Section: misc
Priority: optional
Standards-Version: 3.9.2
Build-Depends: debhelper (>= 9), libboost-dev (>= 1.49), libeigen3-dev (>= 3.2), libsuitesparse-dev (>= 4.2.1)
Package: @PACKAGE_NAME@
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: @PACKAGE_DESCRIPTION_SUMMARY@
@PACKAGE_DESCRIPTION@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: @PACKAGE_NAME@
Source: @PACKAGE_SOURCE@
Files: *
Copyright: @PACKAGE_AUTHORS@
License: LGPL-3.0+
Files: debian/*
Copyright: @YEAR@ @PACKAGE_CONTACT@
License: LGPL-3.0+
License: LGPL-3.0+
This package is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version.
.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
.
On Debian systems, the complete text of the GNU Lesser General
Public License can be found in "/usr/share/common-licenses/LGPL-3".
\ No newline at end of file
#!/usr/bin/make -f
BUILD_DIR=build_@PACKAGE_NAME@_@PACKAGE_VERSION@
%:
dh $@ --builddirectory=${BUILD_DIR}
override_dh_auto_configure:
dh_auto_configure -- -DCMAKE_BUILD_TYPE="Release"
override_dh_auto_test:
cd ${BUILD_DIR} && $(MAKE) -j1 check ARGS\+=-j1
\ No newline at end of file
set(OUT_DIR ${CMAKE_SOURCE_DIR}/debian_package)
if (DEFINED INITIAL)
set(INITIAL 1)
else ()
set(INITIAL 0)
endif ()
if (NOT EXISTS ${OUT_DIR})
file(MAKE_DIRECTORY ${OUT_DIR})
if (NOT INITIAL)
message(WARNING "No debian_package subdirectory found. A new debian package-configuration is created!")
set(INITIAL 1)
endif ()
elseif (INITIAL)
file(REMOVE_RECURSE ${OUT_DIR})
file(MAKE_DIRECTORY ${OUT_DIR})
endif ()
if (INITIAL)
message("Create initial debian configuration...")
endif ()
configure_file(${CMAKE_SOURCE_DIR}/cmake/CPackOptions.cmake.in ${OUT_DIR}/CPackOptions.cmake @ONLY)
include(${OUT_DIR}/CPackOptions.cmake)
set(PACKAGE_FILENAME ${CPACK_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION})
set(PACKAGE_PREFIX ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION})
set(TGZ_FILENAME ${OUT_DIR}/${PACKAGE_FILENAME}.orig.tar.gz)
execute_process(COMMAND git archive --format=tar.gz --prefix ${PACKAGE_PREFIX}/ -o ${TGZ_FILENAME} master)
execute_process(COMMAND date +%F OUTPUT_VARIABLE CURRENT_DATE)
execute_process(COMMAND date +%Y OUTPUT_VARIABLE YEAR)
set(PACKAGE_NAME ${CPACK_PACKAGE_NAME})
set(PACKAGE_VERSION ${CPACK_PACKAGE_VERSION})
SET(PACKAGE_VERSION_MAJOR ${CPACK_PACKAGE_VERSION_MAJOR})
SET(PACKAGE_VERSION_MINOR ${CPACK_PACKAGE_VERSION_MINOR})
SET(PACKAGE_VERSION_PATCH ${CPACK_PACKAGE_VERSION_PATCH})
set(PACKAGE_SOURCE "<https://NNMW07.math.tu-dresden.de/spraetor/dec-pde.git>")
set(PACKAGE_CONTACT ${CPACK_PACKAGE_CONTACT})
file(READ ${CMAKE_SOURCE_DIR}/AUTHORS PACKAGE_AUTHORS)
set(PACKAGE_DESCRIPTION_SUMMARY ${CPACK_PACKAGE_DESCRIPTION_SUMMARY})
set(PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION})
set(PACKAGE_LICENSE_FILE ${CMAKE_SOURCE_DIR}/LICENSE)
set(PACKAGE_README_FILE ${CMAKE_SOURCE_DIR}/README.md)
set(PACKAGE_DESCRIPTION_FILE ${PACKAGE_README_FILE})
# extract package generated by CPack
execute_process(COMMAND tar -xzf ${TGZ_FILENAME} -C ${OUT_DIR})
set(DEBIAN_DIR ${OUT_DIR}/${PACKAGE_PREFIX}/debian)
# generate necessary files for debian packages
if (INITIAL)
file(MAKE_DIRECTORY ${DEBIAN_DIR})
file(MAKE_DIRECTORY ${DEBIAN_DIR}/soure)
configure_file(${CMAKE_SOURCE_DIR}/cmake/debian.changelog.in ${DEBIAN_DIR}/changelog @ONLY)
configure_file(${CMAKE_SOURCE_DIR}/cmake/debian.copyright.in ${DEBIAN_DIR}/copyright @ONLY)
configure_file(${CMAKE_SOURCE_DIR}/cmake/debian.control.in ${DEBIAN_DIR}/control @ONLY)
configure_file(${CMAKE_SOURCE_DIR}/cmake/debian.rules.in ${DEBIAN_DIR}/rules @ONLY)
execute_process(COMMAND chmod +x ${DEBIAN_DIR}/rules)
file(WRITE ${DEBIAN_DIR}/compat "9\n")
file(WRITE ${DEBIAN_DIR}/soure/format "3.0 (quilt)\n")
else ()
if (DEFINED UPDATE_CHANGELOG)
execute_process(COMMAND dch -i -M "New release version published at ${CURRENT_DATE}" -c ${DEBIAN_DIR}/changelog
WORKING_DIRECTORY ${OUT_DIR}/${PACKAGE_PREFIX})
endif()
endif ()
# generate the debian package
execute_process(COMMAND debuild -us -uc
WORKING_DIRECTORY ${OUT_DIR}/${PACKAGE_PREFIX})
\ No newline at end of file
include(@CMAKE_BINARY_DIR@/CPackOptions.cmake)
execute_process(COMMAND data +%Y OUTPUT_VARIABLE YEAR)
set(PACKAGE_NAME ${CPACK_PACKAGE_NAME})
set(PACKAGE_VERSION ${CPACK_PACKAGE_VERSION})
SET(PACKAGE_VERSION_MAJOR ${CPACK_PACKAGE_VERSION_MAJOR})
SET(PACKAGE_VERSION_MINOR ${CPACK_PACKAGE_VERSION_MINOR})
SET(PACKAGE_VERSION_PATCH ${CPACK_PACKAGE_VERSION_PATCH})
set(PACKAGE_SOURCE "<https://NNMW07.math.tu-dresden.de/spraetor/dec-pde.git>")
set(PACKAGE_CONTACT ${CPACK_PACKAGE_CONTACT})
file(READ @CMAKE_SOURCE_DIR@/AUTHORS PACKAGE_AUTHORS)
set(PACKAGE_DESCRIPTION_SUMMARY ${CPACK_PACKAGE_DESCRIPTION_SUMMARY})
set(PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION})
set(PACKAGE_LICENSE_FILE @CMAKE_SOURCE_DIR@/LICENSE)
set(PACKAGE_README_FILE @CMAKE_SOURCE_DIR@/README.md)
set(PACKAGE_DESCRIPTION_FILE ${PACKAGE_README_FILE})
set(BUILD_DIR @CMAKE_BINARY_DIR@/package)
file(MAKE_DIRECTORY ${BUILD_DIR})
# extract package generated by CPack
set(TGZ_FILENAME ${CPACK_PACKAGE_FILE_NAME}.tar.gz)
execute_process(COMMAND tar -xzf @CMAKE_BINARY_DIR@/${TGZ_FILENAME} -C ${BUILD_DIR})
set(DEBIAN_DIR ${BUILD_DIR}/${CPACK_PACKAGE_FILE_NAME}/debian)
file(MAKE_DIRECTORY ${DEBIAN_DIR})
file(MAKE_DIRECTORY ${DEBIAN_DIR}/soure)
# generate necessary files for debian packages
configure_file(@CMAKE_SOURCE_DIR@/cmake/debian.changelog.in ${DEBIAN_DIR}/changelog @ONLY)
configure_file(@CMAKE_SOURCE_DIR@/cmake/debian.copyright.in ${DEBIAN_DIR}/copyright @ONLY)
configure_file(@CMAKE_SOURCE_DIR@/cmake/debian.control.in ${DEBIAN_DIR}/control @ONLY)
configure_file(@CMAKE_SOURCE_DIR@/cmake/debian.rules.in ${DEBIAN_DIR}/rules @ONLY)
execute_process(COMMAND chmod +x ${DEBIAN_DIR}/rules)
file(WRITE ${DEBIAN_DIR}/compat "9\n")
file(WRITE ${DEBIAN_DIR}/soure/format "3.0 (quilt)\n")
# generate the debian package
file(COPY ${TGZ_FILENAME} DESTINATION ${BUILD_DIR})
file(RENAME ${BUILD_DIR}/${TGZ_FILENAME}
${BUILD_DIR}/${CPACK_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}.orig.tar.gz)
execute_process(COMMAND debuild -us -uc
WORKING_DIRECTORY ${BUILD_DIR}/${CPACK_PACKAGE_FILE_NAME})
\ No newline at end of file
# In order to compile a project and link against the dec-pde
# (and subsequent) libraries simply add 'dec-pde' to the target_link_libraries
# of your executable target. All include-paths and additional libraries are
# automatically added.
#
# For a fast start, you use this package in the following way
# simply look for it, possibly set the dec-pde directory
#
# find_package(dec-pde REQUIRED)
# add_executable(yourTarget <yourSources>)
# target_link_libraries(yourTarget dec-pde)
#
if (${CMAKE_VERSION} VERSION_LESS "3.1")
message(FATAL_ERROR "The Configuration file was created for CMake version >= 3.1")
endif ()
list(APPEND CMAKE_MODULE_PATH ${dec-pde_DIR}/cmake)
set(IS_CONFIG true)
add_library(decpde_base INTERFACE)
add_library(dec-pde ALIAS decpde_base)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
target_compile_definitions(decpde_base INTERFACE HAS_CXX11=1)
# try to detect the include directory
# -------------------------------------------
find_file(DEC_H dec.h PATHS ${CMAKE_CURRENT_SOURCE_DIR}/include/decpde)
if (DEC_H)
get_filename_component(DECPDE_INCLUDE_DIR ${DEC_H} PATH CACHE)
target_include_directories(decpde_base INTERFACE ${DECPDE_INCLUDE_DIR})
include(mind_mtl4)
FIND_MTL4(decpde_base)
else ()
message(ERROR "Could not detect the dec-pde include directory. Please set the variable DECPDE_INCLUDE_DIR to the directory containing the dec-pde headers.")
endif ()
unset(DEC_H CACHE)
# try to detect the library directory
# -------------------------------------------
find_library(DEC_LIB dec-pde PATHS ${CMAKE_CURRENT_SOURCE_DIR}/lib/decpde/)
if (DEC_LIB)
target_link_libraries(decpde_base INTERFACE ${DEC_LIB})
else ()
message(ERROR "Could not detect the dec-pde library. Please set the variable DEC_LIB to the dec-pde library.")
endif ()
unset(DEC_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)
include (find_boost)
FIND_BOOST(decpde_base)
# umfpack library
# --------------------
# set(AMDIS_SuiteSparse_DIR @SuiteSparse_DIR@)
# set(AMDIS_UMFPACK_INCLUDE_DIR @UMFPACK_INCLUDE_DIRS@)
# set(AMDIS_UMFPACK_LIB_DIR ${AMDIS_UMFPACK_INCLUDE_DIR}/../include)
include(find_umfpack)
FIND_UMFPACK(decpde_base)
set(DECPDE_LIBRARIES dec-pde)
# - Try to find Eigen3 lib
#
# This module supports requiring a minimum version, e.g. you can do
# find_package(Eigen3 3.1.2)
# to require version 3.1.2 or newer of Eigen3.
#
# Once done this will define
#
# EIGEN3_FOUND - system has eigen lib with correct version
# EIGEN3_INCLUDE_DIR - the eigen include directory
# EIGEN3_VERSION - eigen version
# Copyright (c) 2006, 2007 Montel Laurent, <montel@kde.org>
# Copyright (c) 2008, 2009 Gael Guennebaud, <g.gael@free.fr>
# Copyright (c) 2009 Benoit Jacob <jacob.benoit.1@gmail.com>
# Redistribution and use is allowed according to the terms of the
# 2-clause BSD license.
# Modified by Garth N. Wells <gnw20@cam.ac.uk> to add EIGEN_DIR to
# search path
if(NOT Eigen3_FIND_VERSION)
if(NOT Eigen3_FIND_VERSION_MAJOR)
set(Eigen3_FIND_VERSION_MAJOR 2)
endif(NOT Eigen3_FIND_VERSION_MAJOR)
if(NOT Eigen3_FIND_VERSION_MINOR)
set(Eigen3_FIND_VERSION_MINOR 91)
endif(NOT Eigen3_FIND_VERSION_MINOR)
if(NOT Eigen3_FIND_VERSION_PATCH)
set(Eigen3_FIND_VERSION_PATCH 0)
endif(NOT Eigen3_FIND_VERSION_PATCH)
set(Eigen3_FIND_VERSION "${Eigen3_FIND_VERSION_MAJOR}.${Eigen3_FIND_VERSION_MINOR}.${Eigen3_FIND_VERSION_PATCH}")
endif(NOT Eigen3_FIND_VERSION)
macro(_eigen3_check_version)
file(READ "${EIGEN3_INCLUDE_DIR}/Eigen/src/Core/util/Macros.h"
_eigen3_version_header)
string(REGEX MATCH "define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+)"
_eigen3_world_version_match "${_eigen3_version_header}")
set(EIGEN3_WORLD_VERSION "${CMAKE_MATCH_1}")
string(REGEX MATCH "define[ \t]+EIGEN_MAJOR_VERSION[ \t]+([0-9]+)"
_eigen3_major_version_match "${_eigen3_version_header}")
set(EIGEN3_MAJOR_VERSION "${CMAKE_MATCH_1}")
string(REGEX MATCH "define[ \t]+EIGEN_MINOR_VERSION[ \t]+([0-9]+)"
_eigen3_minor_version_match "${_eigen3_version_header}")
set(EIGEN3_MINOR_VERSION "${CMAKE_MATCH_1}")
set(EIGEN3_VERSION ${EIGEN3_WORLD_VERSION}.${EIGEN3_MAJOR_VERSION}.${EIGEN3_MINOR_VERSION})
if(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
set(EIGEN3_VERSION_OK FALSE)
else(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
set(EIGEN3_VERSION_OK TRUE)
endif(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
if(NOT EIGEN3_VERSION_OK)
message(STATUS "Eigen3 version ${EIGEN3_VERSION} found in ${EIGEN3_INCLUDE_DIR}, "
"but at least version ${Eigen3_FIND_VERSION} is required")
endif(NOT EIGEN3_VERSION_OK)
endmacro(_eigen3_check_version)
if (EIGEN3_INCLUDE_DIR)
# in cache already
_eigen3_check_version()
set(EIGEN3_FOUND ${EIGEN3_VERSION_OK})
else (EIGEN3_INCLUDE_DIR)
find_path(EIGEN3_INCLUDE_DIR NAMES signature_of_eigen3_matrix_library
PATHS
${EIGEN_DIR}
$ENV{EIGEN_DIR}
${CMAKE_INSTALL_PREFIX}/include
${KDE4_INCLUDE_DIR}
PATH_SUFFIXES eigen3 eigen)
if(EIGEN3_INCLUDE_DIR)
_eigen3_check_version()
# Check for 'unsupported' header files, which provide some Krylov
# solvers
find_path(EIGEN3_UNSUPPORTED_HEADERS NAMES SparseExtra PATHS
${EIGEN3_INCLUDE_DIR}
PATH_SUFFIXES unsupported/Eigen)
if(NOT EIGEN3_UNSUPPORTED_HEADERS)
message(STATUS "Cannot find Eigen3 'unsupported' header files. "
"Make sure you install Eigen3 and not just copy header files.")
endif(NOT EIGEN3_UNSUPPORTED_HEADERS)
endif(EIGEN3_INCLUDE_DIR)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Eigen3 DEFAULT_MSG EIGEN3_INCLUDE_DIR
EIGEN3_VERSION_OK EIGEN3_UNSUPPORTED_HEADERS)
mark_as_advanced(EIGEN3_INCLUDE_DIR)
endif(EIGEN3_INCLUDE_DIR)
This diff is collapsed.
# .. cmake_module::
#
# Find the SuiteSparse libraries like UMFPACK or SPQR.
#
# Example which tries to find Suite Sparse's UMFPack component:
#
# :code:`find_package(SuiteSparse OPTIONAL_COMPONENTS UMFPACK)`
#
# `OPTIONAL_COMPONENTS`
# A list of components. Components are:
# AMD, BTF, CAMD, CCOLAMD, CHOLMOD, COLAMD, CXSPARSE,
# KLU, LDL, RBIO, SPQR, UMFPACK
#
# :ref:`SuiteSparse_ROOT`
# Path list to search for SuiteSparse
#
# Sets the following variables:
#
# :code:`SuiteSparse_FOUND`
# True if SuiteSparse was found.
#
# :code:`SuiteSparse_INCLUDE_DIRS`
# Path to the SuiteSparse include dirs.
#
# :code:`SuiteSparse_LIBRARIES`
# Name of the SuiteSparse libraries.
#
# :code:`SuiteSparse_<COMPONENT>_FOUND`
# Whether <COMPONENT> was found as part of SuiteSparse.
#
# .. cmake_variable:: SuiteSparse_ROOT
#
# You may set this variable to have :ref:`FindSuiteSparse` look
# for SuiteSparse in the given path before inspecting
# system paths.
#
find_package(BLAS QUIET)
# look for desired componenents
set(SUITESPARSE_COMPONENTS ${SuiteSparse_FIND_COMPONENTS})
# resolve inter-component dependencies
list(FIND SUITESPARSE_COMPONENTS "UMFPACK" WILL_USE_UMFPACK)
if(NOT WILL_USE_UMFPACK EQUAL -1)
list(APPEND SUITESPARSE_COMPONENTS AMD CHOLMOD)
endif()
list(FIND SUITESPARSE_COMPONENTS "CHOLMOD" WILL_USE_CHOLMOD)
if(NOT WILL_USE_CHOLMOD EQUAL -1)
list(APPEND SUITESPARSE_COMPONENTS AMD CAMD COLAMD CCOLAMD)
endif()
if(SUITESPARSE_COMPONENTS)
list(REMOVE_DUPLICATES SUITESPARSE_COMPONENTS)
endif()
# find SuiteSparse config:
# look for library at positions given by the user
find_library(SUITESPARSE_CONFIG_LIB
NAMES "suitesparseconfig"
PATHS ${SuiteSparse_ROOT}
PATH_SUFFIXES "lib" "lib32" "lib64" "Lib"
NO_DEFAULT_PATH
)
# now also include the deafult paths
find_library(SUITESPARSE_CONFIG_LIB
NAMES "suitesparseconfig"