diff options
Diffstat (limited to 'src/cmake')
-rw-r--r-- | src/cmake/modules/FindTBB.cmake | 6 | ||||
-rw-r--r-- | src/cmake/modules/GUDHI_compilation_flags.cmake | 3 | ||||
-rw-r--r-- | src/cmake/modules/GUDHI_doxygen_target.cmake | 59 | ||||
-rw-r--r-- | src/cmake/modules/GUDHI_modules.cmake | 10 | ||||
-rw-r--r-- | src/cmake/modules/GUDHI_options.cmake | 15 | ||||
-rw-r--r-- | src/cmake/modules/GUDHI_submodules.cmake | 5 | ||||
-rw-r--r-- | src/cmake/modules/GUDHI_third_party_libraries.cmake | 196 | ||||
-rw-r--r-- | src/cmake/modules/GUDHI_user_version_target.cmake | 23 |
8 files changed, 190 insertions, 127 deletions
diff --git a/src/cmake/modules/FindTBB.cmake b/src/cmake/modules/FindTBB.cmake index 13f4d929..e6c42dc7 100644 --- a/src/cmake/modules/FindTBB.cmake +++ b/src/cmake/modules/FindTBB.cmake @@ -34,7 +34,7 @@ # # 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. +# For backwards compatibility, you may explicitly 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 @@ -54,8 +54,8 @@ # 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) +# TBB_MALLOCPROXY_DEBUG_LIBRARY, the TBB debug malloc_proxy library (not included in TBB_LIBRARIES since it's optional) +# TBB_MALLOCPROXY_RELEASE_LIBRARY, the TBB release malloc_proxy library (not included in TBB_LIBRARIES since it's optional) include(CheckCXXSourceCompiles) diff --git a/src/cmake/modules/GUDHI_compilation_flags.cmake b/src/cmake/modules/GUDHI_compilation_flags.cmake index 567fbc40..b43ccf73 100644 --- a/src/cmake/modules/GUDHI_compilation_flags.cmake +++ b/src/cmake/modules/GUDHI_compilation_flags.cmake @@ -11,7 +11,8 @@ macro(add_cxx_compiler_flag _flag) endif() endmacro() -set (CMAKE_CXX_STANDARD 14) +set (CMAKE_CXX_STANDARD 17) +# This number needs to be changed in python/CMakeLists.txt at the same time enable_testing() diff --git a/src/cmake/modules/GUDHI_doxygen_target.cmake b/src/cmake/modules/GUDHI_doxygen_target.cmake index 7a84c4e0..327513da 100644 --- a/src/cmake/modules/GUDHI_doxygen_target.cmake +++ b/src/cmake/modules/GUDHI_doxygen_target.cmake @@ -8,14 +8,61 @@ if(DOXYGEN_FOUND) 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) + message("++ Project = ${CMAKE_PROJECT_NAME}") + if (CMAKE_PROJECT_NAME STREQUAL "GUDHIdev") + # Set Doxyfile.in variables for the developer version + set(GUDHI_DOXYGEN_SOURCE_PREFIX "${CMAKE_SOURCE_DIR}/src") + foreach(GUDHI_MODULE ${GUDHI_MODULES_FULL_LIST}) + if(EXISTS "${GUDHI_DOXYGEN_SOURCE_PREFIX}/${GUDHI_MODULE}/doc/") + set(GUDHI_DOXYGEN_IMAGE_PATH "${GUDHI_DOXYGEN_IMAGE_PATH} ${GUDHI_DOXYGEN_SOURCE_PREFIX}/${GUDHI_MODULE}/doc/ \\ \n") + endif() + if(EXISTS "${GUDHI_DOXYGEN_SOURCE_PREFIX}/${GUDHI_MODULE}/example/") + set(GUDHI_DOXYGEN_EXAMPLE_PATH "${GUDHI_DOXYGEN_EXAMPLE_PATH} ${GUDHI_DOXYGEN_SOURCE_PREFIX}/${GUDHI_MODULE}/example/ \\ \n") + endif() + if(EXISTS "${GUDHI_DOXYGEN_SOURCE_PREFIX}/${GUDHI_MODULE}/utilities/") + set(GUDHI_DOXYGEN_EXAMPLE_PATH "${GUDHI_DOXYGEN_EXAMPLE_PATH} ${GUDHI_DOXYGEN_SOURCE_PREFIX}/${GUDHI_MODULE}/utilities/ \\ \n") + endif() + endforeach(GUDHI_MODULE ${GUDHI_MODULES_FULL_LIST}) + set(GUDHI_DOXYGEN_COMMON_DOC_PATH "${GUDHI_DOXYGEN_SOURCE_PREFIX}/common/doc") + set(GUDHI_DOXYGEN_UTILS_PATH "*/utilities") + endif() + if (CMAKE_PROJECT_NAME STREQUAL "GUDHI") + # Set Doxyfile.in variables for the user version + set(GUDHI_DOXYGEN_SOURCE_PREFIX "${CMAKE_SOURCE_DIR}") + foreach(GUDHI_MODULE ${GUDHI_MODULES_FULL_LIST}) + if(EXISTS "${GUDHI_DOXYGEN_SOURCE_PREFIX}/doc/${GUDHI_MODULE}") + set(GUDHI_DOXYGEN_IMAGE_PATH "${GUDHI_DOXYGEN_IMAGE_PATH} ${GUDHI_DOXYGEN_SOURCE_PREFIX}/doc/${GUDHI_MODULE}/ \\ \n") + endif() + if(EXISTS "${GUDHI_DOXYGEN_SOURCE_PREFIX}/example/${GUDHI_MODULE}") + set(GUDHI_DOXYGEN_EXAMPLE_PATH "${GUDHI_DOXYGEN_EXAMPLE_PATH} ${GUDHI_DOXYGEN_SOURCE_PREFIX}/example/${GUDHI_MODULE}/ \\ \n") + endif() + if(EXISTS "${GUDHI_DOXYGEN_SOURCE_PREFIX}/utilities/${GUDHI_MODULE}") + set(GUDHI_DOXYGEN_EXAMPLE_PATH "${GUDHI_DOXYGEN_EXAMPLE_PATH} ${GUDHI_DOXYGEN_SOURCE_PREFIX}/utilities/${GUDHI_MODULE}/ \\ \n") + endif() + endforeach(GUDHI_MODULE ${GUDHI_MODULES_FULL_LIST}) + set(GUDHI_DOXYGEN_COMMON_DOC_PATH "${GUDHI_DOXYGEN_SOURCE_PREFIX}/doc/common") + set(GUDHI_DOXYGEN_UTILS_PATH "utilities/*") + endif() - if(TARGET user_version) - # In dev version, doxygen target depends on user_version target. Not existing in user version - add_dependencies(doxygen user_version) + message("++ Doxygen version ${DOXYGEN_VERSION}") + if (DOXYGEN_VERSION VERSION_LESS 1.9.3) + set(GUDHI_DOXYGEN_CLASS_DIAGRAMS "CLASS_DIAGRAMS = NO") + else() + set(GUDHI_DOXYGEN_CLASS_DIAGRAMS "") + endif() + if (DOXYGEN_VERSION VERSION_LESS 1.9.2) + set(GUDHI_DOXYGEN_MATHJAX_VERSION "MATHJAX_VERSION = MathJax_2") + set(GUDHI_DOXYGEN_MATHJAX_EXTENSIONS "TeX/AMSmath TeX/AMSsymbols") + else() + set(GUDHI_DOXYGEN_MATHJAX_VERSION "MATHJAX_VERSION = MathJax_3") + set(GUDHI_DOXYGEN_MATHJAX_EXTENSIONS "ams") endif() + + configure_file(${GUDHI_DOXYGEN_SOURCE_PREFIX}/Doxyfile.in "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile" @ONLY) + + add_custom_target(doxygen ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMENT "Generating API documentation with Doxygen in 'html' directory" VERBATIM) 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 index ccaf1ac5..ec1f756b 100644 --- a/src/cmake/modules/GUDHI_modules.cmake +++ b/src/cmake/modules/GUDHI_modules.cmake @@ -2,7 +2,7 @@ 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) + option("WITH_MODULE_GUDHI_${file_path}" "Activate/deactivate ${file_path} compilation and installation" ON) if (WITH_MODULE_GUDHI_${file_path}) set(GUDHI_MODULES ${GUDHI_MODULES} ${file_path} CACHE INTERNAL "GUDHI_MODULES") else() @@ -10,19 +10,13 @@ function(add_gudhi_module file_path) 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. + # Include module headers is independent - 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() diff --git a/src/cmake/modules/GUDHI_options.cmake b/src/cmake/modules/GUDHI_options.cmake new file mode 100644 index 00000000..8379e3c6 --- /dev/null +++ b/src/cmake/modules/GUDHI_options.cmake @@ -0,0 +1,15 @@ +option(WITH_GUDHI_BENCHMARK "Activate/deactivate benchmark compilation" OFF) +option(WITH_GUDHI_EXAMPLE "Activate/deactivate examples compilation and installation" OFF) +option(WITH_GUDHI_REMOTE_TEST "Activate/deactivate datasets fetching test which uses the Internet" OFF) +option(WITH_GUDHI_PYTHON "Activate/deactivate python module compilation and installation" ON) +option(WITH_GUDHI_TEST "Activate/deactivate examples compilation and installation" ON) +option(WITH_GUDHI_UTILITIES "Activate/deactivate utilities compilation and installation" ON) +option(WITH_GUDHI_THIRD_PARTY "Activate/deactivate third party libraries cmake detection. When set to OFF, it is useful for doxygen or user_version i.e." ON) + +if (NOT WITH_GUDHI_THIRD_PARTY) + set (WITH_GUDHI_BENCHMARK OFF) + set (WITH_GUDHI_EXAMPLE OFF) + set (WITH_GUDHI_PYTHON OFF) + set (WITH_GUDHI_TEST OFF) + set (WITH_GUDHI_UTILITIES OFF) +endif() diff --git a/src/cmake/modules/GUDHI_submodules.cmake b/src/cmake/modules/GUDHI_submodules.cmake new file mode 100644 index 00000000..9ede852d --- /dev/null +++ b/src/cmake/modules/GUDHI_submodules.cmake @@ -0,0 +1,5 @@ +# For those who dislike bundled dependencies, this indicates where to find a preinstalled Hera. +set(HERA_INTERNAL_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/ext/hera/include) +set(HERA_INCLUDE_DIR ${HERA_INTERNAL_INCLUDE_DIR} CACHE PATH "Directory where one can find hera/{wasserstein.h,bottleneck.h}") +# since everything is cleanly under include/hera/, there is no harm always including it +include_directories(${HERA_INCLUDE_DIR}) diff --git a/src/cmake/modules/GUDHI_third_party_libraries.cmake b/src/cmake/modules/GUDHI_third_party_libraries.cmake index e1566877..2cf6787e 100644 --- a/src/cmake/modules/GUDHI_third_party_libraries.cmake +++ b/src/cmake/modules/GUDHI_third_party_libraries.cmake @@ -1,11 +1,14 @@ # This files manage third party libraries required by GUDHI -find_package(Boost 1.56.0 QUIET OPTIONAL_COMPONENTS filesystem unit_test_framework program_options) +find_package(Boost 1.66.0 QUIET OPTIONAL_COMPONENTS filesystem unit_test_framework program_options) # Boost_FOUND is not reliable if(NOT Boost_VERSION) message(FATAL_ERROR "NOTICE: This program requires Boost and will not be compiled.") endif(NOT Boost_VERSION) +include_directories(${Boost_INCLUDE_DIRS}) +message(STATUS "boost include dirs:" ${Boost_INCLUDE_DIRS}) +message(STATUS "boost library dirs:" ${Boost_LIBRARY_DIRS}) find_package(GMP) if(GMP_FOUND) @@ -16,6 +19,15 @@ if(GMP_FOUND) endif() endif() +# from windows vcpkg eigen 3.4.0#2 : build fails with +# error C2440: '<function-style-cast>': cannot convert from 'Eigen::EigenBase<Derived>::Index' to '__gmp_expr<mpq_t,mpq_t>' +# cf. https://gitlab.com/libeigen/eigen/-/issues/2476 +# Workaround is to compile with '-DEIGEN_DEFAULT_DENSE_INDEX_TYPE=int' +if (FORCE_EIGEN_DEFAULT_DENSE_INDEX_TYPE_TO_INT) + message("++ User explicit demand to force EIGEN_DEFAULT_DENSE_INDEX_TYPE to int") + add_definitions(-DEIGEN_DEFAULT_DENSE_INDEX_TYPE=int) +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". @@ -36,12 +48,6 @@ if(CGAL_FOUND) include( ${CGAL_USE_FILE} ) endif() -# For those who dislike bundled dependencies, this indicates where to find a preinstalled Hera. -set(HERA_WASSERSTEIN_INTERNAL_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/ext/hera/wasserstein/include) -set(HERA_WASSERSTEIN_INCLUDE_DIR ${HERA_WASSERSTEIN_INTERNAL_INCLUDE_DIR} CACHE PATH "Directory where one can find Hera's wasserstein.h") -set(HERA_BOTTLENECK_INTERNAL_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/ext/hera/bottleneck/include) -set(HERA_BOTTLENECK_INCLUDE_DIR ${HERA_BOTTLENECK_INTERNAL_INCLUDE_DIR} CACHE PATH "Directory where one can find Hera's bottleneck.h") - option(WITH_GUDHI_USE_TBB "Build with Intel TBB parallelization" ON) # Find TBB package for parallel sort - not mandatory, just optional. @@ -89,92 +95,92 @@ add_definitions( -DBOOST_ALL_DYN_LINK ) # problem on Mac with boost_system and boost_thread add_definitions( -DBOOST_SYSTEM_NO_DEPRECATED ) -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 all carriage returns as it can be multiline - string(REGEX REPLACE "\n" " " 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) +if (WITH_GUDHI_PYTHON) + # 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 all carriage returns as it can be multiline + string(REGEX REPLACE "\n" " " 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 ) + + # For modules that do not define module.__version__ + function( find_python_module_no_version PYTHON_MODULE_NAME ) + string(TOUPPER ${PYTHON_MODULE_NAME} PYTHON_MODULE_NAME_UP) + execute_process( + COMMAND ${PYTHON_EXECUTABLE} -c "import ${PYTHON_MODULE_NAME}" + RESULT_VARIABLE PYTHON_MODULE_RESULT + ERROR_VARIABLE PYTHON_MODULE_ERROR) + if(PYTHON_MODULE_RESULT EQUAL 0) + # Remove carriage return + message ("++ Python module ${PYTHON_MODULE_NAME} found") + 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_ERROR = ${PYTHON_MODULE_ERROR}") + set(${PYTHON_MODULE_NAME_UP}_FOUND FALSE PARENT_SCOPE) + endif() + endfunction( find_python_module_no_version ) + + 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") + find_python_module("sklearn") + find_python_module("ot") + find_python_module("pybind11") + find_python_module("torch") + find_python_module("pykeops") + find_python_module("eagerpy") + find_python_module_no_version("hnswlib") + find_python_module("tensorflow") + find_python_module("sphinx_paramlinks") + find_python_module_no_version("python_docs_theme") endif() -endfunction( find_python_module ) - -# For modules that do not define module.__version__ -function( find_python_module_no_version PYTHON_MODULE_NAME ) - string(TOUPPER ${PYTHON_MODULE_NAME} PYTHON_MODULE_NAME_UP) - execute_process( - COMMAND ${PYTHON_EXECUTABLE} -c "import ${PYTHON_MODULE_NAME}" - RESULT_VARIABLE PYTHON_MODULE_RESULT - ERROR_VARIABLE PYTHON_MODULE_ERROR) - if(PYTHON_MODULE_RESULT EQUAL 0) - # Remove carriage return - message ("++ Python module ${PYTHON_MODULE_NAME} found") - 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_ERROR = ${PYTHON_MODULE_ERROR}") - set(${PYTHON_MODULE_NAME_UP}_FOUND FALSE PARENT_SCOPE) - endif() -endfunction( find_python_module_no_version ) - -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") - find_python_module("sklearn") - find_python_module("ot") - find_python_module("pybind11") - find_python_module("torch") - find_python_module("pykeops") - find_python_module("eagerpy") - find_python_module_no_version("hnswlib") - find_python_module("tensorflow") -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}" "-m" "sphinx.cmd.build") - endif(PYTHON_VERSION_MAJOR EQUAL 3) - endif(NOT SPHINX_PATH) - endif(SPHINX_FOUND) -endif(PYTHONINTERP_FOUND AND CYTHON_FOUND) - + + 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. Useful 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}" "-m" "sphinx.cmd.build") + endif(PYTHON_VERSION_MAJOR EQUAL 3) + endif(NOT SPHINX_PATH) + endif(SPHINX_FOUND) + endif(PYTHONINTERP_FOUND AND CYTHON_FOUND) +endif (WITH_GUDHI_PYTHON) diff --git a/src/cmake/modules/GUDHI_user_version_target.cmake b/src/cmake/modules/GUDHI_user_version_target.cmake index e4f39aae..b9bf1414 100644 --- a/src/cmake/modules/GUDHI_user_version_target.cmake +++ b/src/cmake/modules/GUDHI_user_version_target.cmake @@ -14,27 +14,21 @@ 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 Doxyfile for Doxygen - cf. root CMakeLists.txt for explanation -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) - # Generate bib files for Doxygen - cf. root CMakeLists.txt for explanation string(TIMESTAMP GUDHI_VERSION_YEAR "%Y") configure_file(${CMAKE_SOURCE_DIR}/biblio/how_to_cite_gudhi.bib.in "${CMAKE_CURRENT_BINARY_DIR}/biblio/how_to_cite_gudhi.bib" @ONLY) file(COPY "${CMAKE_SOURCE_DIR}/biblio/bibliography.bib" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/biblio/") +file(COPY "${CMAKE_SOURCE_DIR}/biblio/test" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/biblio") # append cgal citation inside bibliography - sphinx cannot deal with more than one bib file file(READ "${CMAKE_SOURCE_DIR}/biblio/how_to_cite_cgal.bib" CGAL_CITATION_CONTENT) file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/biblio/bibliography.bib" "${CGAL_CITATION_CONTENT}") -# Copy biblio directory for user version +# Copy biblio files for user version +add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E + copy ${CMAKE_CURRENT_BINARY_DIR}/biblio/bibliography.bib ${GUDHI_USER_VERSION_DIR}/biblio/bibliography.bib) add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E - copy_directory ${CMAKE_CURRENT_BINARY_DIR}/biblio ${GUDHI_USER_VERSION_DIR}/biblio) + copy ${CMAKE_CURRENT_BINARY_DIR}/biblio/how_to_cite_gudhi.bib ${GUDHI_USER_VERSION_DIR}/biblio/how_to_cite_gudhi.bib) add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/README.md ${GUDHI_USER_VERSION_DIR}/README.md) @@ -48,6 +42,8 @@ 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 ${CMAKE_SOURCE_DIR}/src/Doxyfile.in ${GUDHI_USER_VERSION_DIR}/Doxyfile.in) # As cython generates .cpp files in source, we have to copy all except cpp files from python directory file(GLOB_RECURSE PYTHON_FILES ${CMAKE_SOURCE_DIR}/${GUDHI_PYTHON_PATH}/*) @@ -67,10 +63,9 @@ add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/src/GudhUI ${GUDHI_USER_VERSION_DIR}/GudhUI) -if(HERA_WASSERSTEIN_INCLUDE_DIR STREQUAL HERA_WASSERSTEIN_INTERNAL_INCLUDE_DIR OR - HERA_BOTTLENECK_INCLUDE_DIR STREQUAL HERA_BOTTLENECK_INTERNAL_INCLUDE_DIR) +if(HERA_INCLUDE_DIR STREQUAL HERA_INTERNAL_INCLUDE_DIR) add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E - copy_directory ${CMAKE_SOURCE_DIR}/ext/hera ${GUDHI_USER_VERSION_DIR}/ext/hera) + copy_directory ${CMAKE_SOURCE_DIR}/ext/hera/include ${GUDHI_USER_VERSION_DIR}/ext/hera/include) endif() set(GUDHI_DIRECTORIES "doc;example;concept;utilities") |