summaryrefslogtreecommitdiff
path: root/src/cmake/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmake/modules')
-rw-r--r--src/cmake/modules/FindEigen3.cmake86
-rw-r--r--src/cmake/modules/FindGMP.cmake56
-rw-r--r--src/cmake/modules/FindGMPXX.cmake48
-rw-r--r--src/cmake/modules/FindQGLViewer.cmake61
-rw-r--r--src/cmake/modules/FindTBB.cmake425
-rw-r--r--src/cmake/modules/GUDHI_compilation_flags.cmake75
-rw-r--r--src/cmake/modules/GUDHI_doxygen_target.cmake21
-rw-r--r--src/cmake/modules/GUDHI_modules.cmake42
-rw-r--r--src/cmake/modules/GUDHI_test_coverage.cmake26
-rw-r--r--src/cmake/modules/GUDHI_third_party_libraries.cmake149
-rw-r--r--src/cmake/modules/GUDHI_user_version_target.cmake92
-rw-r--r--src/cmake/modules/UseEigen3.cmake9
-rw-r--r--src/cmake/modules/UseTBB.cmake6
13 files changed, 1096 insertions, 0 deletions
diff --git a/src/cmake/modules/FindEigen3.cmake b/src/cmake/modules/FindEigen3.cmake
new file mode 100644
index 00000000..70c07dfb
--- /dev/null
+++ b/src/cmake/modules/FindEigen3.cmake
@@ -0,0 +1,86 @@
+# - 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.
+
+include(FindPackageHandleStandardArgs)
+
+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_get_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})
+endmacro(_eigen3_get_version)
+
+set(EIGEN3_USE_FILE "UseEigen3")
+
+if (EIGEN3_INCLUDE_DIR)
+
+ if (EXISTS ${EIGEN3_INCLUDE_DIR}/signature_of_eigen3_matrix_library)
+ # in cache already and valid
+ _eigen3_get_version()
+ set(EIGEN3_FOUND ${EIGEN3_VERSION_OK})
+
+ find_package_handle_standard_args(Eigen3
+ REQUIRED_VARS EIGEN3_INCLUDE_DIR
+ VERSION_VAR EIGEN3_VERSION)
+
+ else()
+ message(STATUS "Eigen3 path specified in cmake variable EIGEN3_INCLUDE_DIR is "
+ "set to ${EIGEN3_INCLUDE_DIR}, but that path does not contains the file "
+ "signature_of_eigen3_matrix_library and is considered as invalid.")
+ endif()
+
+
+
+else (EIGEN3_INCLUDE_DIR)
+
+ find_path(EIGEN3_INCLUDE_DIR NAMES signature_of_eigen3_matrix_library
+ HINTS ENV EIGEN3_INC_DIR
+ ENV EIGEN3_DIR
+ PATHS ${KDE4_INCLUDE_DIR}
+ PATH_SUFFIXES include eigen3 eigen
+ DOC "Directory containing the Eigen3 header files"
+ )
+
+ if(EIGEN3_INCLUDE_DIR)
+ _eigen3_get_version()
+ endif(EIGEN3_INCLUDE_DIR)
+
+ find_package_handle_standard_args(Eigen3
+ REQUIRED_VARS EIGEN3_INCLUDE_DIR
+ VERSION_VAR EIGEN3_VERSION)
+
+endif(EIGEN3_INCLUDE_DIR)
diff --git a/src/cmake/modules/FindGMP.cmake b/src/cmake/modules/FindGMP.cmake
new file mode 100644
index 00000000..de57646f
--- /dev/null
+++ b/src/cmake/modules/FindGMP.cmake
@@ -0,0 +1,56 @@
+# - Try to find the GMP libraries
+# This module defines:
+# GMP_FOUND - system has GMP lib
+# GMP_INCLUDE_DIR - the GMP include directory
+# GMP_LIBRARIES_DIR - directory where the GMP libraries are located
+# GMP_LIBRARIES - Link these to use GMP
+# GMP_IN_CGAL_AUXILIARY - TRUE if the GMP found is the one distributed with CGAL in the auxiliary folder
+
+# TODO: support MacOSX
+
+include(FindPackageHandleStandardArgs)
+#include(CGAL_GeneratorSpecificSettings)
+
+if(GMP_INCLUDE_DIR)
+ set(GMP_in_cache TRUE)
+else()
+ set(GMP_in_cache FALSE)
+endif()
+if(NOT GMP_LIBRARIES)
+ set(GMP_in_cache FALSE)
+endif()
+
+# Is it already configured?
+if (GMP_in_cache)
+
+ set(GMP_FOUND TRUE)
+
+else()
+
+ find_path(GMP_INCLUDE_DIR
+ NAMES gmp.h
+ HINTS ENV GMP_INC_DIR
+ ENV GMP_DIR
+ PATH_SUFFIXES include
+ DOC "The directory containing the GMP header files"
+ )
+
+ find_library(GMP_LIBRARIES NAMES gmp libgmp-10
+ HINTS ENV GMP_LIB_DIR
+ ENV GMP_DIR
+ PATH_SUFFIXES lib
+ DOC "Path to the GMP library"
+ )
+
+ if ( GMP_LIBRARIES )
+ get_filename_component(GMP_LIBRARIES_DIR ${GMP_LIBRARIES} PATH CACHE )
+ endif()
+
+ # Attempt to load a user-defined configuration for GMP if couldn't be found
+ if ( NOT GMP_INCLUDE_DIR OR NOT GMP_LIBRARIES_DIR )
+ include( GMPConfig OPTIONAL )
+ endif()
+
+ find_package_handle_standard_args(GMP "DEFAULT_MSG" GMP_LIBRARIES GMP_INCLUDE_DIR)
+
+endif()
diff --git a/src/cmake/modules/FindGMPXX.cmake b/src/cmake/modules/FindGMPXX.cmake
new file mode 100644
index 00000000..dda302c0
--- /dev/null
+++ b/src/cmake/modules/FindGMPXX.cmake
@@ -0,0 +1,48 @@
+# - Try to find the GMPXX libraries
+# This module defines:
+# GMPXX_FOUND - system has GMPXX lib
+# GMPXX_INCLUDE_DIR - the GMPXX include directory
+# GMPXX_LIBRARIES - Libraries needed to use GMPXX
+
+# TODO: support Windows and MacOSX
+
+# GMPXX needs GMP
+
+find_package( GMP QUIET )
+
+if(GMP_FOUND)
+
+ if (GMPXX_INCLUDE_DIR AND GMPXX_LIBRARIES)
+ # Already in cache, be silent
+ set(GMPXX_FIND_QUIETLY TRUE)
+ endif()
+
+ find_path(GMPXX_INCLUDE_DIR NAMES gmpxx.h
+ HINTS ENV GMPXX_INC_DIR
+ ENV GMPXX_DIR
+ ${GMP_INCLUDE_DIR_SEARCH}
+ PATH_SUFFIXES include
+ DOC "The directory containing the GMPXX include files"
+ )
+
+ find_library(GMPXX_LIBRARIES NAMES gmpxx
+ HINTS ENV GMPXX_LIB_DIR
+ ENV GMPXX_DIR
+ ${GMP_LIBRARIES_DIR_SEARCH}
+ PATH_SUFFIXES lib
+ DOC "Path to the GMPXX library"
+ )
+
+ if ( GMPXX_LIBRARIES )
+ get_filename_component(GMPXX_LIBRARIES_DIR ${GMPXX_LIBRARIES} PATH CACHE )
+ endif()
+
+ include(FindPackageHandleStandardArgs)
+
+ find_package_handle_standard_args(GMPXX "DEFAULT_MSG" GMPXX_LIBRARIES GMPXX_INCLUDE_DIR )
+
+else()
+
+ message( FATAL_ERROR "GMPXX needs GMP")
+
+endif()
diff --git a/src/cmake/modules/FindQGLViewer.cmake b/src/cmake/modules/FindQGLViewer.cmake
new file mode 100644
index 00000000..56c1b3cf
--- /dev/null
+++ b/src/cmake/modules/FindQGLViewer.cmake
@@ -0,0 +1,61 @@
+# - Try to find QGLViewer
+# Once done this will define
+#
+# QGLVIEWER_FOUND - system has QGLViewer
+# QGLVIEWER_INCLUDE_DIR - the QGLViewer include directory
+# QGLVIEWER_LIBRARIES - Link these to use QGLViewer
+# QGLVIEWER_DEFINITIONS - Compiler switches required for using QGLViewer
+#
+
+find_path(QGLVIEWER_INCLUDE_DIR
+ NAMES QGLViewer/qglviewer.h
+ PATHS /usr/include
+ /usr/local/include
+ ENV QGLVIEWERROOT
+ )
+
+find_library(QGLVIEWER_LIBRARY_RELEASE
+ NAMES qglviewer-qt5 QGLViewer-qt5 qglviewer QGLViewer QGLViewer2
+ PATHS /usr/lib
+ /usr/local/lib
+ ENV QGLVIEWERROOT
+ ENV LD_LIBRARY_PATH
+ ENV LIBRARY_PATH
+ PATH_SUFFIXES QGLViewer QGLViewer/release
+ )
+
+find_library(QGLVIEWER_LIBRARY_DEBUG
+ NAMES dqglviewer dQGLViewer dQGLViewer2 QGLViewerd2
+ PATHS /usr/lib
+ /usr/local/lib
+ ENV QGLVIEWERROOT
+ ENV LD_LIBRARY_PATH
+ ENV LIBRARY_PATH
+ PATH_SUFFIXES QGLViewer QGLViewer/debug
+ )
+
+if(QGLVIEWER_LIBRARY_RELEASE)
+ if(QGLVIEWER_LIBRARY_DEBUG)
+ set(QGLVIEWER_LIBRARIES_ optimized ${QGLVIEWER_LIBRARY_RELEASE} debug ${QGLVIEWER_LIBRARY_DEBUG})
+ else()
+ set(QGLVIEWER_LIBRARIES_ ${QGLVIEWER_LIBRARY_RELEASE})
+ endif()
+
+ set(QGLVIEWER_LIBRARIES ${QGLVIEWER_LIBRARIES_} CACHE FILEPATH "The QGLViewer library")
+
+endif()
+
+IF(QGLVIEWER_INCLUDE_DIR AND QGLVIEWER_LIBRARIES)
+ SET(QGLVIEWER_FOUND TRUE)
+ENDIF(QGLVIEWER_INCLUDE_DIR AND QGLVIEWER_LIBRARIES)
+
+IF(QGLVIEWER_FOUND)
+ IF(NOT QGLViewer_FIND_QUIETLY)
+ MESSAGE(STATUS "Found QGLViewer: ${QGLVIEWER_LIBRARIES}")
+ ENDIF(NOT QGLViewer_FIND_QUIETLY)
+ELSE(QGLVIEWER_FOUND)
+ IF(QGLViewer_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "Could not find QGLViewer")
+ ENDIF(QGLViewer_FIND_REQUIRED)
+ENDIF(QGLVIEWER_FOUND)
+
diff --git a/src/cmake/modules/FindTBB.cmake b/src/cmake/modules/FindTBB.cmake
new file mode 100644
index 00000000..13f4d929
--- /dev/null
+++ b/src/cmake/modules/FindTBB.cmake
@@ -0,0 +1,425 @@
+# Locate Intel Threading Building Blocks include paths and libraries
+# FindTBB.cmake can be found at https://code.google.com/p/findtbb/
+# Written by Hannes Hofmann <hannes.hofmann _at_ informatik.uni-erlangen.de>
+# Improvements by Gino van den Bergen <gino _at_ dtecta.com>,
+# Florian Uhlig <F.Uhlig _at_ gsi.de>,
+# Jiri Marsik <jiri.marsik89 _at_ gmail.com>
+
+# The MIT License
+#
+# Copyright (c) 2011 Hannes Hofmann
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+# GvdB: This module uses the environment variable TBB_ARCH_PLATFORM which defines architecture and compiler.
+# e.g. "ia32/vc8" or "em64t/cc4.1.0_libc2.4_kernel2.6.16.21"
+# TBB_ARCH_PLATFORM is set by the build script tbbvars[.bat|.sh|.csh], which can be found
+# in the TBB installation directory (TBB_INSTALL_DIR).
+#
+# GvdB: Mac OS X distribution places libraries directly in lib directory.
+#
+# For backwards compatibility, you may explicitely set the CMake variables TBB_ARCHITECTURE and TBB_COMPILER.
+# TBB_ARCHITECTURE [ ia32 | em64t | itanium ]
+# which architecture to use
+# TBB_COMPILER e.g. vc9 or cc3.2.3_libc2.3.2_kernel2.4.21 or cc4.0.1_os10.4.9
+# which compiler to use (detected automatically on Windows)
+
+# This module respects
+# TBB_INSTALL_DIR or $ENV{TBB21_INSTALL_DIR} or $ENV{TBB_INSTALL_DIR}
+
+# This module defines
+# TBB_INCLUDE_DIRS, where to find task_scheduler_init.h, etc.
+# TBB_LIBRARY_DIRS, where to find TBB libraries
+# TBB_INSTALL_DIR, the base TBB install directory.
+# TBB_LIBRARIES, all the following TBB libraries (both release and debug versions, using "optimized" and "debug" CMake keywords). Note that if the debug versions are not found, the release versions will be used instead for the debug mode.
+# TBB_RELEASE_LIBRARY, the TBB release library
+# TBB_MALLOC_RELEASE_LIBRARY, the TBB release malloc library
+# TBB_DEBUG_LIBRARY, the TBB debug library
+# TBB_MALLOC_DEBUG_LIBRARY, the TBB debug malloc library
+# TBB_FOUND, If false, don't try to use TBB.
+# TBB_INTERFACE_VERSION, as defined in tbb/tbb_stddef.h
+# TBB_MALLOCPROXY_DEBUG_LIBRARY, the TBB debug malloc_proxy library (not included in TBB_LIBRARIES since it's optionnal)
+# TBB_MALLOCPROXY_RELEASE_LIBRARY, the TBB release malloc_proxy library (not included in TBB_LIBRARIES since it's optionnal)
+
+include(CheckCXXSourceCompiles)
+
+# Usage:
+# try_TBB_with_pthread(<result_var_name> [additional linker args...])
+function(try_TBB_with_pthread result_var)
+ set(TBB_try_ts_source "
+ #include <tbb/enumerable_thread_specific.h>
+ int main() {
+ tbb::enumerable_thread_specific<
+ bool*,
+ tbb::cache_aligned_allocator<bool*>,
+ tbb::ets_key_per_instance> grid;
+ }
+ ")
+ set(CMAKE_REQUIRED_LIBRARIES ${ALL_TBB_LIBRARIES} ${ARGN})
+ set(CMAKE_REQUIRED_INCLUDES ${TBB_INCLUDE_DIR})
+ check_cxx_source_compiles("${TBB_try_ts_source}" ${result_var})
+ set(${result_var} ${${result_var}} PARENT_SCOPE)
+endfunction(try_TBB_with_pthread)
+
+if (WIN32)
+ # has em64t/vc8 em64t/vc9
+ # has ia32/vc7.1 ia32/vc8 ia32/vc9
+ set(_TBB_DEFAULT_INSTALL_DIR "C:/Program Files/Intel/TBB" "C:/Program Files (x86)/Intel/TBB")
+ set(_TBB_LIB_RELEASE_NAME "tbb")
+ set(_TBB_LIB_MALLOC_RELEASE_NAME "${_TBB_LIB_RELEASE_NAME}malloc")
+ set(_TBB_LIB_MALLOCPROXY_RELEASE_NAME "${_TBB_LIB_RELEASE_NAME}malloc_proxy")
+ set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_RELEASE_NAME}_debug")
+ set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_RELEASE_NAME}_debug")
+ set(_TBB_LIB_MALLOCPROXY_DEBUG_NAME "${_TBB_LIB_MALLOCPROXY_RELEASE_NAME}_debug")
+ if (MSVC71)
+ set (_TBB_COMPILER "vc7.1")
+ endif(MSVC71)
+ if (MSVC80)
+ set(_TBB_COMPILER "vc8")
+ endif(MSVC80)
+ if (MSVC90)
+ set(_TBB_COMPILER "vc9")
+ endif(MSVC90)
+ if(MSVC10)
+ set(_TBB_COMPILER "vc10")
+ endif(MSVC10)
+ if(MSVC11)
+ set(_TBB_COMPILER "vc11")
+ endif(MSVC11)
+ if(MSVC12)
+ set(_TBB_COMPILER "vc12")
+ endif(MSVC12)
+ #note there was no MSVC13
+ if(MSVC14)
+ set(_TBB_COMPILER "vc14")
+ endif(MSVC14)
+ # Todo: add other Windows compilers such as ICL.
+ set(_TBB_ARCHITECTURE ${TBB_ARCHITECTURE})
+endif (WIN32)
+
+if (UNIX)
+ if (APPLE)
+ # MAC
+ set(_TBB_DEFAULT_INSTALL_DIR "/Library/Frameworks/Intel_TBB.framework/Versions")
+ # libs: libtbb.dylib, libtbbmalloc.dylib, *_debug
+ set(_TBB_LIB_RELEASE_NAME "tbb")
+ set(_TBB_LIB_MALLOC_RELEASE_NAME "${_TBB_LIB_RELEASE_NAME}malloc")
+ #set(_TBB_LIB_MALLOCPROXY_RELEASE_NAME "${_TBB_LIB_RELEASE_NAME}malloc_proxy")
+ set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_RELEASE_NAME}_debug")
+ set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_RELEASE_NAME}_debug")
+ #set(_TBB_LIB_MALLOCPROXY_DEBUG_NAME "${_TBB_LIB_MALLOCPROXY_RELEASE_NAME}_debug")
+ # default flavor on apple: ia32/cc4.0.1_os10.4.9
+ # Jiri: There is no reason to presume there is only one flavor and
+ # that user's setting of variables should be ignored.
+ if(NOT TBB_COMPILER)
+ set(_TBB_COMPILER "cc4.0.1_os10.4.9")
+ elseif (NOT TBB_COMPILER)
+ set(_TBB_COMPILER ${TBB_COMPILER})
+ endif(NOT TBB_COMPILER)
+ if(NOT TBB_ARCHITECTURE)
+ set(_TBB_ARCHITECTURE "ia32")
+ elseif(NOT TBB_ARCHITECTURE)
+ set(_TBB_ARCHITECTURE ${TBB_ARCHITECTURE})
+ endif(NOT TBB_ARCHITECTURE)
+ else (APPLE)
+ # LINUX
+ set(_TBB_DEFAULT_INSTALL_DIR "/opt/intel/tbb" "/usr/local/include" "/usr/include")
+ set(_TBB_LIB_RELEASE_NAME "tbb")
+ set(_TBB_LIB_MALLOC_RELEASE_NAME "${_TBB_LIB_RELEASE_NAME}malloc")
+ set(_TBB_LIB_MALLOCPROXY_RELEASE_NAME "${_TBB_LIB_RELEASE_NAME}malloc_proxy")
+ set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_RELEASE_NAME}_debug")
+ set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_RELEASE_NAME}_debug")
+ set(_TBB_LIB_MALLOCPROXY_DEBUG_NAME "${_TBB_LIB_MALLOCPROXY_RELEASE_NAME}_debug")
+ # has em64t/cc3.2.3_libc2.3.2_kernel2.4.21 em64t/cc3.3.3_libc2.3.3_kernel2.6.5 em64t/cc3.4.3_libc2.3.4_kernel2.6.9 em64t/cc4.1.0_libc2.4_kernel2.6.16.21
+ # has ia32/*
+ # has itanium/*
+ set(_TBB_COMPILER ${TBB_COMPILER})
+ set(_TBB_ARCHITECTURE ${TBB_ARCHITECTURE})
+ endif (APPLE)
+endif (UNIX)
+
+if (CMAKE_SYSTEM MATCHES "SunOS.*")
+# SUN
+# not yet supported
+# has em64t/cc3.4.3_kernel5.10
+# has ia32/*
+endif (CMAKE_SYSTEM MATCHES "SunOS.*")
+
+
+#-- Clear the public variables
+set (TBB_FOUND "NO")
+
+
+#-- Find TBB install dir and set ${_TBB_INSTALL_DIR} and cached ${TBB_INSTALL_DIR}
+# first: use CMake variable TBB_INSTALL_DIR
+if (TBB_INSTALL_DIR)
+ set (_TBB_INSTALL_DIR ${TBB_INSTALL_DIR})
+endif (TBB_INSTALL_DIR)
+# second: use environment variable
+if (NOT _TBB_INSTALL_DIR)
+ if (NOT "$ENV{TBBROOT}" STREQUAL "")
+ set (_TBB_INSTALL_DIR $ENV{TBBROOT})
+ endif (NOT "$ENV{TBBROOT}" STREQUAL "")
+ if (NOT "$ENV{TBB_INSTALL_DIR}" STREQUAL "")
+ set (_TBB_INSTALL_DIR $ENV{TBB_INSTALL_DIR})
+ endif (NOT "$ENV{TBB_INSTALL_DIR}" STREQUAL "")
+ # Intel recommends setting TBB21_INSTALL_DIR
+ if (NOT "$ENV{TBB21_INSTALL_DIR}" STREQUAL "")
+ set (_TBB_INSTALL_DIR $ENV{TBB21_INSTALL_DIR})
+ endif (NOT "$ENV{TBB21_INSTALL_DIR}" STREQUAL "")
+ if (NOT "$ENV{TBB22_INSTALL_DIR}" STREQUAL "")
+ set (_TBB_INSTALL_DIR $ENV{TBB22_INSTALL_DIR})
+ endif (NOT "$ENV{TBB22_INSTALL_DIR}" STREQUAL "")
+ if (NOT "$ENV{TBB30_INSTALL_DIR}" STREQUAL "")
+ set (_TBB_INSTALL_DIR $ENV{TBB30_INSTALL_DIR})
+ endif (NOT "$ENV{TBB30_INSTALL_DIR}" STREQUAL "")
+endif (NOT _TBB_INSTALL_DIR)
+# third: try to find path automatically
+if (NOT _TBB_INSTALL_DIR)
+ if (_TBB_DEFAULT_INSTALL_DIR)
+ set (_TBB_INSTALL_DIR ${_TBB_DEFAULT_INSTALL_DIR})
+ endif (_TBB_DEFAULT_INSTALL_DIR)
+endif (NOT _TBB_INSTALL_DIR)
+# sanity check
+if (NOT _TBB_INSTALL_DIR)
+ message ("ERROR: Unable to find Intel TBB install directory. ${_TBB_INSTALL_DIR}")
+else (NOT _TBB_INSTALL_DIR)
+# finally: set the cached CMake variable TBB_INSTALL_DIR
+if (NOT TBB_INSTALL_DIR)
+ set (TBB_INSTALL_DIR ${_TBB_INSTALL_DIR} CACHE PATH "Intel TBB install directory")
+ mark_as_advanced(TBB_INSTALL_DIR)
+endif (NOT TBB_INSTALL_DIR)
+
+
+#-- A macro to rewrite the paths of the library. This is necessary, because
+# find_library() always found the em64t/vc9 version of the TBB libs
+macro(TBB_CORRECT_LIB_DIR var_name)
+# if (NOT "${_TBB_ARCHITECTURE}" STREQUAL "em64t")
+ string(REPLACE em64t "${_TBB_ARCHITECTURE}" ${var_name} ${${var_name}})
+# endif (NOT "${_TBB_ARCHITECTURE}" STREQUAL "em64t")
+ string(REPLACE ia32 "${_TBB_ARCHITECTURE}" ${var_name} ${${var_name}})
+ string(REGEX REPLACE "vc[0-9]+(\.[0-9]+)?" "${_TBB_COMPILER}" ${var_name} ${${var_name}})
+endmacro(TBB_CORRECT_LIB_DIR var_content)
+
+
+#-- Look for include directory and set ${TBB_INCLUDE_DIR}
+set (TBB_INC_SEARCH_DIR ${_TBB_INSTALL_DIR}/include)
+# Jiri: tbbvars now sets the CPATH environment variable to the directory
+# containing the headers.
+# LR: search first with NO_DEFAULT_PATH...
+find_path(TBB_INCLUDE_DIR
+ tbb/task_scheduler_init.h
+ PATHS ${TBB_INC_SEARCH_DIR} ENV CPATH
+ NO_DEFAULT_PATH
+)
+if(NOT TBB_INCLUDE_DIR)
+# LR: ... and then search again with NO_DEFAULT_PATH if nothing was found in
+# hinted paths
+ find_path(TBB_INCLUDE_DIR
+ tbb/task_scheduler_init.h
+ PATHS ${TBB_INC_SEARCH_DIR} ENV CPATH
+ )
+endif()
+mark_as_advanced(TBB_INCLUDE_DIR)
+
+
+#-- Look for libraries
+# GvdB: $ENV{TBB_ARCH_PLATFORM} is set by the build script tbbvars[.bat|.sh|.csh]
+if (NOT $ENV{TBB_ARCH_PLATFORM} STREQUAL "")
+ set (_TBB_LIBRARY_DIR
+ ${_TBB_INSTALL_DIR}/lib/$ENV{TBB_ARCH_PLATFORM}
+ ${_TBB_INSTALL_DIR}/$ENV{TBB_ARCH_PLATFORM}/lib
+ )
+endif (NOT $ENV{TBB_ARCH_PLATFORM} STREQUAL "")
+# Jiri: This block isn't mutually exclusive with the previous one
+# (hence no else), instead I test if the user really specified
+# the variables in question.
+if ((NOT ${TBB_ARCHITECTURE} STREQUAL "") AND (NOT ${TBB_COMPILER} STREQUAL ""))
+ # HH: deprecated
+ message(STATUS "[Warning] FindTBB.cmake: The use of TBB_ARCHITECTURE and TBB_COMPILER is deprecated and may not be supported in future versions. Please set \$ENV{TBB_ARCH_PLATFORM} (using tbbvars.[bat|csh|sh]).")
+ # Jiri: It doesn't hurt to look in more places, so I store the hints from
+ # ENV{TBB_ARCH_PLATFORM} and the TBB_ARCHITECTURE and TBB_COMPILER
+ # variables and search them both.
+ set (_TBB_LIBRARY_DIR "${_TBB_INSTALL_DIR}/${_TBB_ARCHITECTURE}/${_TBB_COMPILER}/lib" ${_TBB_LIBRARY_DIR})
+endif ((NOT ${TBB_ARCHITECTURE} STREQUAL "") AND (NOT ${TBB_COMPILER} STREQUAL ""))
+
+# GvdB: Mac OS X distribution places libraries directly in lib directory.
+list(APPEND _TBB_LIBRARY_DIR ${_TBB_INSTALL_DIR}/lib)
+
+# Jiri: No reason not to check the default paths. From recent versions,
+# tbbvars has started exporting the LIBRARY_PATH and LD_LIBRARY_PATH
+# variables, which now point to the directories of the lib files.
+# It all makes more sense to use the ${_TBB_LIBRARY_DIR} as a HINTS
+# argument instead of the implicit PATHS as it isn't hard-coded
+# but computed by system introspection. Searching the LIBRARY_PATH
+# and LD_LIBRARY_PATH environment variables is now even more important
+# that tbbvars doesn't export TBB_ARCH_PLATFORM and it facilitates
+# the use of TBB built from sources.
+# LR: search first with NO_DEFAULT_PATH...
+find_library(TBB_RELEASE_LIBRARY ${_TBB_LIB_RELEASE_NAME} HINTS ${_TBB_LIBRARY_DIR}
+ PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH NO_DEFAULT_PATH)
+find_library(TBB_MALLOC_RELEASE_LIBRARY ${_TBB_LIB_MALLOC_RELEASE_NAME} HINTS ${_TBB_LIBRARY_DIR}
+ PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH NO_DEFAULT_PATH)
+find_library(TBB_MALLOCPROXY_RELEASE_LIBRARY ${_TBB_LIB_MALLOCPROXY_RELEASE_NAME} HINTS ${_TBB_LIBRARY_DIR}
+ PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH NO_DEFAULT_PATH)
+if(NOT TBB_RELEASE_LIBRARY OR NOT TBB_MALLOC_RELEASE_LIBRARY OR NOT TBB_MALLOCPROXY_RELEASE_LIBRARY)
+# LR: ... and then search again with NO_DEFAULT_PATH if nothing was found
+# in hinted paths
+ find_library(TBB_RELEASE_LIBRARY ${_TBB_LIB_RELEASE_NAME} HINTS ${_TBB_LIBRARY_DIR}
+ PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
+ find_library(TBB_MALLOC_RELEASE_LIBRARY ${_TBB_LIB_MALLOC_RELEASE_NAME} HINTS ${_TBB_LIBRARY_DIR}
+ PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
+ find_library(TBB_MALLOCPROXY_RELEASE_LIBRARY ${_TBB_LIB_MALLOCPROXY_RELEASE_NAME} HINTS ${_TBB_LIBRARY_DIR}
+ PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
+endif()
+
+#Extract path from TBB_RELEASE_LIBRARY name
+get_filename_component(TBB_RELEASE_LIBRARY_DIR ${TBB_RELEASE_LIBRARY} PATH)
+
+#TBB_CORRECT_LIB_DIR(TBB_RELEASE_LIBRARY)
+#TBB_CORRECT_LIB_DIR(TBB_MALLOC_RELEASE_LIBRARY)
+#TBB_CORRECT_LIB_DIR(TBB_MALLOCPROXY_RELEASE_LIBRARY)
+mark_as_advanced(TBB_RELEASE_LIBRARY TBB_MALLOC_RELEASE_LIBRARY TBB_MALLOCPROXY_RELEASE_LIBRARY)
+
+#-- Look for debug libraries
+# Jiri: Changed the same way as for the release libraries.
+find_library(TBB_DEBUG_LIBRARY ${_TBB_LIB_DEBUG_NAME} HINTS ${_TBB_LIBRARY_DIR}
+ PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH NO_DEFAULT_PATH)
+find_library(TBB_MALLOC_DEBUG_LIBRARY ${_TBB_LIB_MALLOC_DEBUG_NAME} HINTS ${_TBB_LIBRARY_DIR}
+ PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH NO_DEFAULT_PATH)
+find_library(TBB_MALLOCPROXY_DEBUG_LIBRARY ${_TBB_LIB_MALLOCPROXY_DEBUG_NAME} HINTS ${_TBB_LIBRARY_DIR}
+ PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH NO_DEFAULT_PATH)
+if(NOT TBB_DEBUG_LIBRARY OR NOT TBB_MALLOC_DEBUG_LIBRARY OR NOT TBB_MALLOCPROXY_DEBUG_LIBRARY)
+ find_library(TBB_DEBUG_LIBRARY ${_TBB_LIB_DEBUG_NAME} HINTS ${_TBB_LIBRARY_DIR}
+ PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
+ find_library(TBB_MALLOC_DEBUG_LIBRARY ${_TBB_LIB_MALLOC_DEBUG_NAME} HINTS ${_TBB_LIBRARY_DIR}
+ PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
+ find_library(TBB_MALLOCPROXY_DEBUG_LIBRARY ${_TBB_LIB_MALLOCPROXY_DEBUG_NAME} HINTS ${_TBB_LIBRARY_DIR}
+ PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
+endif()
+
+# Jiri: Self-built TBB stores the debug libraries in a separate directory.
+# Extract path from TBB_DEBUG_LIBRARY name
+get_filename_component(TBB_DEBUG_LIBRARY_DIR ${TBB_DEBUG_LIBRARY} PATH)
+
+#TBB_CORRECT_LIB_DIR(TBB_DEBUG_LIBRARY)
+#TBB_CORRECT_LIB_DIR(TBB_MALLOC_DEBUG_LIBRARY)
+#TBB_CORRECT_LIB_DIR(TBB_MALLOCPROXY_DEBUG_LIBRARY)
+mark_as_advanced(TBB_DEBUG_LIBRARY TBB_MALLOC_DEBUG_LIBRARY TBB_MALLOCPROXY_DEBUG_LIBRARY)
+
+if (TBB_INCLUDE_DIR)
+ if (TBB_RELEASE_LIBRARY)
+ set (TBB_FOUND "YES")
+
+ # NOTE: Removed because we don't want to link with the malloc_proxy by default
+ #if (NOT "${TBB_MALLOCPROXY_RELEASE_LIBRARY}" STREQUAL "TBB_MALLOCPROXY_RELEASE_LIBRARY-NOTFOUND")
+ # mark_as_advanced(TBB_MALLOCPROXY_RELEASE_LIBRARY)
+ # set (_TBB_MALLOCPROXY optimized ${TBB_MALLOCPROXY_RELEASE_LIBRARY})
+ #endif (NOT "${TBB_MALLOCPROXY_RELEASE_LIBRARY}" STREQUAL "TBB_MALLOCPROXY_RELEASE_LIBRARY-NOTFOUND")
+ #if (NOT "${TBB_MALLOCPROXY_DEBUG_LIBRARY}" STREQUAL "TBB_MALLOCPROXY_DEBUG_LIBRARY-NOTFOUND")
+ # mark_as_advanced(TBB_MALLOCPROXY_DEBUG_LIBRARY)
+ # set (_TBB_MALLOCPROXY ${_TBB_MALLOCPROXY} debug ${TBB_MALLOCPROXY_DEBUG_LIBRARY})
+ #endif (NOT "${TBB_MALLOCPROXY_DEBUG_LIBRARY}" STREQUAL "TBB_MALLOCPROXY_DEBUG_LIBRARY-NOTFOUND")
+
+ # TBB release library
+ set (ALL_TBB_LIBRARIES optimized ${TBB_RELEASE_LIBRARY})
+
+ # TBB debug library found?
+ if (TBB_DEBUG_LIBRARY)
+ list(APPEND ALL_TBB_LIBRARIES debug ${TBB_DEBUG_LIBRARY})
+ else (TBB_DEBUG_LIBRARY)
+ # Otherwise, link with the release library even in debug mode
+ list(APPEND ALL_TBB_LIBRARIES debug ${TBB_RELEASE_LIBRARY})
+ endif (TBB_DEBUG_LIBRARY)
+
+ # TBB malloc - release
+ if (TBB_MALLOC_RELEASE_LIBRARY)
+ list(APPEND ALL_TBB_LIBRARIES optimized ${TBB_MALLOC_RELEASE_LIBRARY})
+
+ # TBB malloc - debug
+ if (TBB_MALLOC_DEBUG_LIBRARY)
+ list(APPEND ALL_TBB_LIBRARIES debug ${TBB_MALLOC_DEBUG_LIBRARY})
+ else (TBB_MALLOC_DEBUG_LIBRARY)
+ list(APPEND ALL_TBB_LIBRARIES debug ${TBB_MALLOC_RELEASE_LIBRARY})
+ endif (TBB_MALLOC_DEBUG_LIBRARY)
+ endif (TBB_MALLOC_RELEASE_LIBRARY)
+
+ if(UNIX AND NOT APPLE)
+ # On Fedora, code using TBB might need -pthread
+
+ # First check without pthread
+ try_TBB_with_pthread(TBB_without_pthread)
+
+ if(NOT TBB_without_pthread)
+ # Then check with -pthread
+ try_TBB_with_pthread(TBB_with_pthread -pthread)
+ if(TBB_with_pthread)
+ list(APPEND ALL_TBB_LIBRARIES general -pthread)
+ endif(TBB_with_pthread)
+ endif(NOT TBB_without_pthread)
+ endif(UNIX AND NOT APPLE)
+
+ set (TBB_LIBRARIES ${ALL_TBB_LIBRARIES}
+ CACHE PATH "TBB libraries" FORCE)
+
+ # Include dirs
+ set (TBB_INCLUDE_DIRS ${TBB_INCLUDE_DIR} CACHE PATH "TBB include directory" FORCE)
+
+ # Library dirs
+ if( "${TBB_DEBUG_LIBRARY_DIR}" STREQUAL "" OR "${TBB_RELEASE_LIBRARY_DIR}" STREQUAL "${TBB_DEBUG_LIBRARY_DIR}" )
+ set (TBB_LIBRARY_DIRS
+ ${TBB_RELEASE_LIBRARY_DIR}
+ CACHE PATH "TBB library directories" FORCE)
+ else( "${TBB_DEBUG_LIBRARY_DIR}" STREQUAL "" OR "${TBB_RELEASE_LIBRARY_DIR}" STREQUAL "${TBB_DEBUG_LIBRARY_DIR}" )
+ set (TBB_LIBRARY_DIRS
+ ${TBB_RELEASE_LIBRARY_DIR} ${TBB_DEBUG_LIBRARY_DIR}
+ CACHE PATH "TBB library directories" FORCE)
+ endif( "${TBB_DEBUG_LIBRARY_DIR}" STREQUAL "" OR "${TBB_RELEASE_LIBRARY_DIR}" STREQUAL "${TBB_DEBUG_LIBRARY_DIR}" )
+
+ message(STATUS "Found Intel TBB")
+ endif (TBB_RELEASE_LIBRARY)
+endif (TBB_INCLUDE_DIR)
+
+if (NOT TBB_FOUND)
+ if(NOT TBB_FIND_QUIETLY)
+ message("ERROR: Intel TBB NOT found! Please define the TBBROOT (or TBB_INSTALL_DIR) and/or TBB_ARCH_PLATFORM environment variables.")
+ message(STATUS "Looked for Threading Building Blocks in ${_TBB_INSTALL_DIR}")
+ endif(NOT TBB_FIND_QUIETLY)
+ SET(TBB_INSTALL_DIR "TBB_INSTALL_DIR_NOT_FOUND" CACHE STRING "Intel TBB install directory")
+ # do only throw fatal, if this pkg is REQUIRED
+ if (TBB_FIND_REQUIRED)
+ message(FATAL_ERROR "Could NOT find TBB library.")
+ endif (TBB_FIND_REQUIRED)
+endif (NOT TBB_FOUND)
+
+endif (NOT _TBB_INSTALL_DIR)
+
+if (TBB_FOUND)
+ set(TBB_INTERFACE_VERSION 0)
+ FILE(READ "${TBB_INCLUDE_DIRS}/tbb/tbb_stddef.h" _TBB_VERSION_CONTENTS)
+ STRING(REGEX REPLACE ".*#define TBB_INTERFACE_VERSION ([0-9]+).*" "\\1" TBB_INTERFACE_VERSION "${_TBB_VERSION_CONTENTS}")
+ set(TBB_INTERFACE_VERSION "${TBB_INTERFACE_VERSION}")
+endif (TBB_FOUND)
+
+set(TBB_USE_FILE "UseTBB")
+
+### ** Emacs settings **
+### Local Variables:
+### cmake-tab-width: 4
+### End:
diff --git a/src/cmake/modules/GUDHI_compilation_flags.cmake b/src/cmake/modules/GUDHI_compilation_flags.cmake
new file mode 100644
index 00000000..6cd2614d
--- /dev/null
+++ b/src/cmake/modules/GUDHI_compilation_flags.cmake
@@ -0,0 +1,75 @@
+# This files manage compilation flags required by GUDHI
+
+include(TestCXXAcceptsFlag)
+include(CheckCXXSourceCompiles)
+
+# add a compiler flag only if it is accepted
+macro(add_cxx_compiler_flag _flag)
+ string(REPLACE "-" "_" "/" _flag_var ${_flag})
+ check_cxx_accepts_flag("${_flag}" CXX_COMPILER_${_flag_var}_OK)
+ if(CXX_COMPILER_${_flag_var}_OK)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_flag}")
+ endif()
+endmacro()
+
+function(can_cgal_use_cxx11_thread_local)
+ # This is because of https://github.com/CGAL/cgal/blob/master/Installation/include/CGAL/tss.h
+ # CGAL is using boost thread if thread_local is not ready (requires XCode 8 for Mac).
+ # The test in https://github.com/CGAL/cgal/blob/master/Installation/include/CGAL/config.h
+ # #if __has_feature(cxx_thread_local) || \
+ # ( (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L ) || \
+ # ( _MSC_VER >= 1900 )
+ # #define CGAL_CAN_USE_CXX11_THREAD_LOCAL
+ # #endif
+ set(CGAL_CAN_USE_CXX11_THREAD_LOCAL "
+ int main() {
+ #ifndef __has_feature
+ #define __has_feature(x) 0 // Compatibility with non-clang compilers.
+ #endif
+ #if __has_feature(cxx_thread_local) || \
+ ( (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L ) || \
+ ( _MSC_VER >= 1900 )
+ bool has_feature_thread_local = true;
+ #else
+ // Explicit error of compilation for CMake test purpose - has_feature_thread_local is not defined
+ #endif
+ bool result = has_feature_thread_local;
+ } ")
+ check_cxx_source_compiles("${CGAL_CAN_USE_CXX11_THREAD_LOCAL}" CGAL_CAN_USE_CXX11_THREAD_LOCAL_RESULT)
+endfunction()
+
+set (CMAKE_CXX_STANDARD 14)
+
+enable_testing()
+
+if(MSVC)
+ add_cxx_compiler_flag("/W3")
+else()
+ add_cxx_compiler_flag("-Wall")
+ # Only for dev version
+ if(PROJECT_NAME STREQUAL "GUDHIdev")
+ add_cxx_compiler_flag("-pedantic")
+ endif()
+endif()
+
+if (DEBUG_TRACES)
+ # For programs to be more verbose
+ message(STATUS "DEBUG_TRACES are activated")
+ add_definitions(-DDEBUG_TRACES)
+endif()
+
+set(GUDHI_CAN_USE_CXX11_THREAD_LOCAL "
+ int main() {
+ thread_local int result = 0;
+ return result;
+ } ")
+check_cxx_source_compiles("${GUDHI_CAN_USE_CXX11_THREAD_LOCAL}" GUDHI_CAN_USE_CXX11_THREAD_LOCAL_RESULT)
+if (GUDHI_CAN_USE_CXX11_THREAD_LOCAL_RESULT)
+ add_definitions(-DGUDHI_CAN_USE_CXX11_THREAD_LOCAL)
+endif()
+
+if(CMAKE_BUILD_TYPE MATCHES Debug)
+ message("++ Debug compilation flags are: ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG}")
+else()
+ message("++ Release compilation flags are: ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE}")
+endif()
diff --git a/src/cmake/modules/GUDHI_doxygen_target.cmake b/src/cmake/modules/GUDHI_doxygen_target.cmake
new file mode 100644
index 00000000..7a84c4e0
--- /dev/null
+++ b/src/cmake/modules/GUDHI_doxygen_target.cmake
@@ -0,0 +1,21 @@
+# add a target to generate API documentation with Doxygen
+find_package(Doxygen QUIET)
+if(DOXYGEN_FOUND)
+ set(GUDHI_MODULES ${GUDHI_MODULES} "cpp-documentation" CACHE INTERNAL "GUDHI_MODULES")
+
+ # starting from cmake 3.9 the usage of DOXYGEN_EXECUTABLE is deprecated
+ if(TARGET Doxygen::doxygen)
+ get_property(DOXYGEN_EXECUTABLE TARGET Doxygen::doxygen PROPERTY IMPORTED_LOCATION)
+ endif()
+
+ add_custom_target(doxygen ${DOXYGEN_EXECUTABLE} ${GUDHI_USER_VERSION_DIR}/Doxyfile
+ WORKING_DIRECTORY ${GUDHI_USER_VERSION_DIR}
+ COMMENT "Generating API documentation with Doxygen in ${GUDHI_USER_VERSION_DIR}/doc/html/" VERBATIM)
+
+ if(TARGET user_version)
+ # In dev version, doxygen target depends on user_version target. Not existing in user version
+ add_dependencies(doxygen user_version)
+ endif()
+else()
+ set(GUDHI_MISSING_MODULES ${GUDHI_MISSING_MODULES} "cpp-documentation" CACHE INTERNAL "GUDHI_MISSING_MODULES")
+endif()
diff --git a/src/cmake/modules/GUDHI_modules.cmake b/src/cmake/modules/GUDHI_modules.cmake
new file mode 100644
index 00000000..aab1dd08
--- /dev/null
+++ b/src/cmake/modules/GUDHI_modules.cmake
@@ -0,0 +1,42 @@
+# A function to add a new module in GUDHI
+
+set(GUDHI_MODULES_FULL_LIST "")
+function(add_gudhi_module file_path)
+ option("WITH_MODULE_GUDHI_${file_path}" "Activate/desactivate ${file_path} compilation and installation" ON)
+ if (WITH_MODULE_GUDHI_${file_path})
+ set(GUDHI_MODULES ${GUDHI_MODULES} ${file_path} CACHE INTERNAL "GUDHI_MODULES")
+ else()
+ set(GUDHI_MISSING_MODULES ${GUDHI_MISSING_MODULES} ${file_path} CACHE INTERNAL "GUDHI_MISSING_MODULES")
+ endif()
+ # Required by user_version
+ set(GUDHI_MODULES_FULL_LIST ${GUDHI_MODULES_FULL_LIST} ${file_path} PARENT_SCOPE)
+ # Include module headers is independant - You may ask for no Alpha complex module but Python interface i.e.
+ if(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/src/${file_path}/include/)
+ include_directories(src/${file_path}/include/)
+ endif()
+
+endfunction(add_gudhi_module)
+
+option(WITH_GUDHI_BENCHMARK "Activate/desactivate benchmark compilation" OFF)
+option(WITH_GUDHI_EXAMPLE "Activate/desactivate examples compilation and installation" OFF)
+option(WITH_GUDHI_PYTHON "Activate/desactivate python module compilation and installation" ON)
+option(WITH_GUDHI_TEST "Activate/desactivate examples compilation and installation" ON)
+option(WITH_GUDHI_UTILITIES "Activate/desactivate utilities compilation and installation" ON)
+
+if (WITH_GUDHI_BENCHMARK)
+ set(GUDHI_SUB_DIRECTORIES "${GUDHI_SUB_DIRECTORIES};benchmark")
+endif()
+if (WITH_GUDHI_EXAMPLE)
+ set(GUDHI_SUB_DIRECTORIES "${GUDHI_SUB_DIRECTORIES};example")
+endif()
+if (WITH_GUDHI_TEST)
+ set(GUDHI_SUB_DIRECTORIES "${GUDHI_SUB_DIRECTORIES};test")
+endif()
+if (WITH_GUDHI_UTILITIES)
+ set(GUDHI_SUB_DIRECTORIES "${GUDHI_SUB_DIRECTORIES};utilities")
+endif()
+
+message("++ GUDHI_SUB_DIRECTORIES list is:\"${GUDHI_SUB_DIRECTORIES}\"")
+
+
+
diff --git a/src/cmake/modules/GUDHI_test_coverage.cmake b/src/cmake/modules/GUDHI_test_coverage.cmake
new file mode 100644
index 00000000..bea5b2d6
--- /dev/null
+++ b/src/cmake/modules/GUDHI_test_coverage.cmake
@@ -0,0 +1,26 @@
+
+if (GCOVR_PATH)
+ # for gcovr to make coverage reports - Corbera Jenkins plugin
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
+endif()
+if (GPROF_PATH)
+ # for gprof to make coverage reports - Jenkins
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg")
+endif()
+
+if (DEBUG_TRACES)
+ # Make CTest more verbose with DEBUG_TRACES - no XML output
+ set(GUDHI_UT_LOG_LEVEL "--log_level=all")
+ set(GUDHI_UT_REPORT_LEVEL "--report_level=detailed")
+else()
+ set(GUDHI_UT_LOG_FORMAT "--log_format=XML")
+ set(GUDHI_UT_LOG_SINK "--log_sink=${CMAKE_BINARY_DIR}/${unitary_test}_UT.xml")
+ set(GUDHI_UT_LOG_LEVEL "--log_level=test_suite")
+ set(GUDHI_UT_REPORT_LEVEL "--report_level=no")
+endif()
+
+function(gudhi_add_coverage_test unitary_test)
+ add_test(NAME ${unitary_test} COMMAND $<TARGET_FILE:${unitary_test}>
+ ${GUDHI_UT_LOG_FORMAT} ${GUDHI_UT_LOG_SINK}
+ ${GUDHI_UT_LOG_LEVEL} ${GUDHI_UT_REPORT_LEVEL})
+endfunction()
diff --git a/src/cmake/modules/GUDHI_third_party_libraries.cmake b/src/cmake/modules/GUDHI_third_party_libraries.cmake
new file mode 100644
index 00000000..360a230b
--- /dev/null
+++ b/src/cmake/modules/GUDHI_third_party_libraries.cmake
@@ -0,0 +1,149 @@
+# This files manage third party libraries required by GUDHI
+
+find_package(Boost 1.56.0 REQUIRED COMPONENTS system filesystem unit_test_framework program_options thread)
+
+if(NOT Boost_FOUND)
+ message(FATAL_ERROR "NOTICE: This program requires Boost and will not be compiled.")
+endif(NOT Boost_FOUND)
+
+find_package(GMP)
+if(GMP_FOUND)
+ INCLUDE_DIRECTORIES(${GMP_INCLUDE_DIR})
+ find_package(GMPXX)
+ if(GMPXX_FOUND)
+ INCLUDE_DIRECTORIES(${GMPXX_INCLUDE_DIR})
+ endif()
+endif()
+
+# In CMakeLists.txt, when include(${CGAL_USE_FILE}), CMAKE_CXX_FLAGS are overwritten.
+# cf. http://doc.cgal.org/latest/Manual/installation.html#title40
+# A workaround is to include(${CGAL_USE_FILE}) before adding "-std=c++11".
+# A fix would be to use https://cmake.org/cmake/help/v3.1/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.html
+# or even better https://cmake.org/cmake/help/v3.1/variable/CMAKE_CXX_STANDARD.html
+# but it implies to use cmake version 3.1 at least.
+find_package(CGAL QUIET)
+
+# Only CGAL versions > 4.11 supports what Gudhi uses from CGAL
+if (CGAL_FOUND AND CGAL_VERSION VERSION_LESS 4.11.0)
+ message("++ CGAL version ${CGAL_VERSION} is considered too old to be used by Gudhi.")
+ unset(CGAL_FOUND)
+ unset(CGAL_VERSION)
+endif()
+
+if(CGAL_FOUND)
+ message(STATUS "CGAL version: ${CGAL_VERSION}.")
+ include( ${CGAL_USE_FILE} )
+endif()
+
+option(WITH_GUDHI_USE_TBB "Build with Intel TBB parallelization" ON)
+
+# Find TBB package for parallel sort - not mandatory, just optional.
+if(WITH_GUDHI_USE_TBB)
+ set(TBB_FIND_QUIETLY ON)
+ find_package(TBB)
+ if (TBB_FOUND)
+ include(${TBB_USE_FILE})
+ message("TBB found in ${TBB_LIBRARY_DIRS}")
+ add_definitions(-DGUDHI_USE_TBB)
+ endif()
+endif(WITH_GUDHI_USE_TBB)
+
+set(CGAL_WITH_EIGEN3_VERSION 0.0.0)
+find_package(Eigen3 3.1.0)
+if (EIGEN3_FOUND)
+ include( ${EIGEN3_USE_FILE} )
+ set(CGAL_WITH_EIGEN3_VERSION ${CGAL_VERSION})
+endif (EIGEN3_FOUND)
+
+# Required programs for unitary tests purpose
+FIND_PROGRAM( GCOVR_PATH gcovr )
+if (GCOVR_PATH)
+ message("gcovr found in ${GCOVR_PATH}")
+endif()
+FIND_PROGRAM( GPROF_PATH gprof )
+if (GPROF_PATH)
+ message("gprof found in ${GPROF_PATH}")
+endif()
+FIND_PROGRAM( DIFF_PATH diff )
+if (DIFF_PATH)
+ message("diff found in ${DIFF_PATH}")
+endif()
+FIND_PROGRAM( GNUPLOT_PATH gnuplot )
+if (GNUPLOT_PATH)
+ message("gnuplot found in ${GNUPLOT_PATH}")
+endif()
+
+# BOOST ISSUE result_of vs C++11
+add_definitions(-DBOOST_RESULT_OF_USE_DECLTYPE)
+# BOOST ISSUE with Libraries name resolution under Windows
+add_definitions(-DBOOST_ALL_NO_LIB)
+# problem with Visual Studio link on Boost program_options
+add_definitions( -DBOOST_ALL_DYN_LINK )
+# problem on Mac with boost_system and boost_thread
+add_definitions( -DBOOST_SYSTEM_NO_DEPRECATED )
+
+INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
+LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
+
+message(STATUS "boost include dirs:" ${Boost_INCLUDE_DIRS})
+message(STATUS "boost library dirs:" ${Boost_LIBRARY_DIRS})
+
+# Find the correct Python interpreter.
+# Can be set with -DPYTHON_EXECUTABLE=/usr/bin/python3 or -DPython_ADDITIONAL_VERSIONS=3 for instance.
+find_package( PythonInterp )
+
+# find_python_module tries to import module in Python interpreter and to retrieve its version number
+# returns ${PYTHON_MODULE_NAME_UP}_VERSION and ${PYTHON_MODULE_NAME_UP}_FOUND
+function( find_python_module PYTHON_MODULE_NAME )
+ string(TOUPPER ${PYTHON_MODULE_NAME} PYTHON_MODULE_NAME_UP)
+ execute_process(
+ COMMAND ${PYTHON_EXECUTABLE} -c "import ${PYTHON_MODULE_NAME}; print(${PYTHON_MODULE_NAME}.__version__)"
+ RESULT_VARIABLE PYTHON_MODULE_RESULT
+ OUTPUT_VARIABLE PYTHON_MODULE_VERSION
+ ERROR_VARIABLE PYTHON_MODULE_ERROR)
+ if(PYTHON_MODULE_RESULT EQUAL 0)
+ # Remove carriage return
+ string(STRIP ${PYTHON_MODULE_VERSION} PYTHON_MODULE_VERSION)
+ message ("++ Python module ${PYTHON_MODULE_NAME} - Version ${PYTHON_MODULE_VERSION} found")
+
+ set(${PYTHON_MODULE_NAME_UP}_VERSION ${PYTHON_MODULE_VERSION} PARENT_SCOPE)
+ set(${PYTHON_MODULE_NAME_UP}_FOUND TRUE PARENT_SCOPE)
+ else()
+ message ("PYTHON_MODULE_NAME = ${PYTHON_MODULE_NAME}
+ - PYTHON_MODULE_RESULT = ${PYTHON_MODULE_RESULT}
+ - PYTHON_MODULE_VERSION = ${PYTHON_MODULE_VERSION}
+ - PYTHON_MODULE_ERROR = ${PYTHON_MODULE_ERROR}")
+ unset(${PYTHON_MODULE_NAME_UP}_VERSION PARENT_SCOPE)
+ set(${PYTHON_MODULE_NAME_UP}_FOUND FALSE PARENT_SCOPE)
+ endif()
+endfunction( find_python_module )
+
+if( PYTHONINTERP_FOUND )
+ find_python_module("cython")
+ find_python_module("pytest")
+ find_python_module("matplotlib")
+ find_python_module("numpy")
+ find_python_module("scipy")
+ find_python_module("sphinx")
+endif()
+
+if(NOT GUDHI_PYTHON_PATH)
+ message(FATAL_ERROR "ERROR: GUDHI_PYTHON_PATH is not valid.")
+endif(NOT GUDHI_PYTHON_PATH)
+
+option(WITH_GUDHI_PYTHON_RUNTIME_LIBRARY_DIRS "Build with setting runtime_library_dirs. Usefull when setting rpath is not allowed" ON)
+
+if(PYTHONINTERP_FOUND AND CYTHON_FOUND)
+ if(SPHINX_FOUND)
+ # Documentation generation is available through sphinx
+ find_program( SPHINX_PATH sphinx-build )
+
+ if(NOT SPHINX_PATH)
+ if(PYTHON_VERSION_MAJOR EQUAL 3)
+ # In Python3, just hack sphinx-build if it does not exist
+ set(SPHINX_PATH "${PYTHON_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/${GUDHI_PYTHON_PATH}/doc/python3-sphinx-build.py")
+ endif(PYTHON_VERSION_MAJOR EQUAL 3)
+ endif(NOT SPHINX_PATH)
+ endif(SPHINX_FOUND)
+endif(PYTHONINTERP_FOUND AND CYTHON_FOUND)
+
diff --git a/src/cmake/modules/GUDHI_user_version_target.cmake b/src/cmake/modules/GUDHI_user_version_target.cmake
new file mode 100644
index 00000000..f75fb19e
--- /dev/null
+++ b/src/cmake/modules/GUDHI_user_version_target.cmake
@@ -0,0 +1,92 @@
+# Definition of the custom target user_version
+add_custom_target(user_version)
+
+if(DEFINED USER_VERSION_DIR)
+ # set the GUDHI_USER_VERSION_DIR with USER_VERSION_DIR defined by the user
+ set(GUDHI_USER_VERSION_DIR ${CMAKE_CURRENT_BINARY_DIR}/${USER_VERSION_DIR})
+else()
+ # set the GUDHI_USER_VERSION_DIR with timestamp and Gudhi version number
+ string(TIMESTAMP DATE_AND_TIME "%Y-%m-%d-%H-%M-%S")
+ set(GUDHI_USER_VERSION_DIR ${CMAKE_CURRENT_BINARY_DIR}/${DATE_AND_TIME}_GUDHI_${GUDHI_VERSION})
+endif()
+
+add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E
+ make_directory ${GUDHI_USER_VERSION_DIR}
+ COMMENT "user_version creation in ${GUDHI_USER_VERSION_DIR}")
+
+foreach(GUDHI_MODULE ${GUDHI_MODULES_FULL_LIST})
+ set(GUDHI_DOXYGEN_IMAGE_PATH "${GUDHI_DOXYGEN_IMAGE_PATH} doc/${GUDHI_MODULE}/ \\ \n")
+endforeach(GUDHI_MODULE ${GUDHI_MODULES_FULL_LIST})
+
+# Generate setup.py file to cythonize Gudhi - This file must be named setup.py by convention
+configure_file(${CMAKE_SOURCE_DIR}/src/Doxyfile.in "${CMAKE_CURRENT_BINARY_DIR}/src/Doxyfile" @ONLY)
+
+add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E
+ copy ${CMAKE_CURRENT_BINARY_DIR}/src/Doxyfile ${GUDHI_USER_VERSION_DIR}/Doxyfile)
+
+add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E
+ copy ${CMAKE_SOURCE_DIR}/Conventions.txt ${GUDHI_USER_VERSION_DIR}/Conventions.txt)
+add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E
+ copy ${CMAKE_SOURCE_DIR}/README.md ${GUDHI_USER_VERSION_DIR}/README.md)
+add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E
+ copy ${CMAKE_SOURCE_DIR}/LICENSE ${GUDHI_USER_VERSION_DIR}/LICENSE)
+add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E
+ copy ${CMAKE_SOURCE_DIR}/src/CMakeLists.txt ${GUDHI_USER_VERSION_DIR}/CMakeLists.txt)
+add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E
+ copy ${CMAKE_SOURCE_DIR}/src/GUDHIConfigVersion.cmake.in ${GUDHI_USER_VERSION_DIR}/GUDHIConfigVersion.cmake.in)
+add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E
+ copy ${CMAKE_SOURCE_DIR}/src/GUDHIConfig.cmake.in ${GUDHI_USER_VERSION_DIR}/GUDHIConfig.cmake.in)
+add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E
+ copy ${CMAKE_SOURCE_DIR}/CMakeGUDHIVersion.txt ${GUDHI_USER_VERSION_DIR}/CMakeGUDHIVersion.txt)
+
+add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E
+ copy_directory ${CMAKE_SOURCE_DIR}/biblio ${GUDHI_USER_VERSION_DIR}/biblio)
+add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E
+ copy_directory ${CMAKE_SOURCE_DIR}/${GUDHI_PYTHON_PATH} ${GUDHI_USER_VERSION_DIR}/python)
+add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E
+ copy_directory ${CMAKE_SOURCE_DIR}/data ${GUDHI_USER_VERSION_DIR}/data)
+add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E
+ copy_directory ${CMAKE_SOURCE_DIR}/src/cmake ${GUDHI_USER_VERSION_DIR}/cmake)
+add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E
+ copy_directory ${CMAKE_SOURCE_DIR}/src/GudhUI ${GUDHI_USER_VERSION_DIR}/GudhUI)
+
+set(GUDHI_DIRECTORIES "doc;example;concept;utilities")
+
+set(GUDHI_INCLUDE_DIRECTORIES "include/gudhi")
+
+foreach(GUDHI_MODULE ${GUDHI_MODULES_FULL_LIST})
+ foreach(GUDHI_DIRECTORY ${GUDHI_DIRECTORIES})
+ # Find files
+ file(GLOB GUDHI_FILES ${CMAKE_SOURCE_DIR}/src/${GUDHI_MODULE}/${GUDHI_DIRECTORY}/*)
+
+ foreach(GUDHI_FILE ${GUDHI_FILES})
+ get_filename_component(GUDHI_FILE_NAME ${GUDHI_FILE} NAME)
+ # GUDHI_FILE can be a file or a directory
+ if(IS_DIRECTORY ${GUDHI_FILE})
+ add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E
+ copy_directory ${GUDHI_FILE} ${GUDHI_USER_VERSION_DIR}/${GUDHI_DIRECTORY}/${GUDHI_MODULE}/${GUDHI_FILE_NAME})
+ else()
+ add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E
+ copy ${GUDHI_FILE} ${GUDHI_USER_VERSION_DIR}/${GUDHI_DIRECTORY}/${GUDHI_MODULE}/${GUDHI_FILE_NAME})
+ endif()
+ endforeach()
+ endforeach(GUDHI_DIRECTORY ${GUDHI_DIRECTORIES})
+
+ foreach(GUDHI_INCLUDE_DIRECTORY ${GUDHI_INCLUDE_DIRECTORIES})
+ # include files
+ file(GLOB GUDHI_INCLUDE_FILES ${CMAKE_SOURCE_DIR}/src/${GUDHI_MODULE}/${GUDHI_INCLUDE_DIRECTORY}/*)
+
+ foreach(GUDHI_INCLUDE_FILE ${GUDHI_INCLUDE_FILES})
+ get_filename_component(GUDHI_INCLUDE_FILE_NAME ${GUDHI_INCLUDE_FILE} NAME)
+ # GUDHI_INCLUDE_FILE can be a file or a directory
+ if(IS_DIRECTORY ${GUDHI_INCLUDE_FILE})
+ add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E
+ copy_directory ${GUDHI_INCLUDE_FILE} ${GUDHI_USER_VERSION_DIR}/${GUDHI_INCLUDE_DIRECTORY}/${GUDHI_INCLUDE_FILE_NAME})
+ else()
+ add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E
+ copy ${GUDHI_INCLUDE_FILE} ${GUDHI_USER_VERSION_DIR}/${GUDHI_INCLUDE_DIRECTORY}/${GUDHI_INCLUDE_FILE_NAME})
+ endif()
+ endforeach()
+ endforeach(GUDHI_INCLUDE_DIRECTORY ${GUDHI_INCLUDE_DIRECTORIES})
+
+endforeach(GUDHI_MODULE ${GUDHI_MODULES_FULL_LIST}) \ No newline at end of file
diff --git a/src/cmake/modules/UseEigen3.cmake b/src/cmake/modules/UseEigen3.cmake
new file mode 100644
index 00000000..e3ed18be
--- /dev/null
+++ b/src/cmake/modules/UseEigen3.cmake
@@ -0,0 +1,9 @@
+# This module setups the compiler for using Eigen v3 library.
+# It assumes that find_package(Eigen3) was already called.
+
+
+include_directories( SYSTEM ${EIGEN3_INCLUDE_DIR} )
+
+add_definitions(-DCGAL_EIGEN3_ENABLED)
+
+set (EIGEN3_SETUP TRUE)
diff --git a/src/cmake/modules/UseTBB.cmake b/src/cmake/modules/UseTBB.cmake
new file mode 100644
index 00000000..e1ef5dfe
--- /dev/null
+++ b/src/cmake/modules/UseTBB.cmake
@@ -0,0 +1,6 @@
+# This module setups the compiler for using TBB library.
+# It assumes that find_package(TBB) was already called.
+
+include_directories ( ${TBB_INCLUDE_DIRS} )
+link_directories( ${TBB_LIBRARY_DIRS} )
+add_definitions( -DNOMINMAX -DGUDHI_USE_TBB )