diff options
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/modules/GUDHI_modules.cmake | 41 | ||||
-rw-r--r-- | cmake/modules/GUDHI_third_party_libraries.cmake | 28 | ||||
-rw-r--r-- | cmake/modules/GUDHI_user_version_target.cmake (renamed from cmake/modules/GUDHI_user_version_target.txt) | 7 |
3 files changed, 54 insertions, 22 deletions
diff --git a/cmake/modules/GUDHI_modules.cmake b/cmake/modules/GUDHI_modules.cmake new file mode 100644 index 00000000..f95d0c34 --- /dev/null +++ b/cmake/modules/GUDHI_modules.cmake @@ -0,0 +1,41 @@ +# A function to add a new module in GUDHI + +set(GUDHI_MODULES "") +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} PARENT_SCOPE) + 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/cmake/modules/GUDHI_third_party_libraries.cmake b/cmake/modules/GUDHI_third_party_libraries.cmake index 5f84c602..f2bbafdc 100644 --- a/cmake/modules/GUDHI_third_party_libraries.cmake +++ b/cmake/modules/GUDHI_third_party_libraries.cmake @@ -1,6 +1,6 @@ # This files manage third party libraries required by GUDHI -find_package(Boost REQUIRED COMPONENTS system filesystem unit_test_framework chrono timer date_time program_options thread) +find_package(Boost 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.") @@ -99,6 +99,8 @@ add_definitions(-DBOOST_RESULT_OF_USE_DECLTYPE) 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}) @@ -106,19 +108,6 @@ LINK_DIRECTORIES(${Boost_LIBRARY_DIRS}) message(STATUS "boost include dirs:" ${Boost_INCLUDE_DIRS}) message(STATUS "boost library dirs:" ${Boost_LIBRARY_DIRS}) -macro( find_the_lib placeholder THE_LIBS ) - set (THE_LIB_WE_FOUND "NO") - foreach(THE_LIB ${THE_LIBS}) - if(EXISTS ${THE_LIB}) - get_filename_component(THE_LIB_WE ${THE_LIB} NAME_WE) - if (NOT THE_LIB_WE_FOUND) - set (THE_LIB_WE_FOUND "YES") - set(returnValue "${THE_LIB_WE}") - endif(NOT THE_LIB_WE_FOUND) - endif(EXISTS ${THE_LIB}) - endforeach(THE_LIB ${THE_LIBS}) -endmacro( find_the_lib ) - # Find the correct Python interpreter. # Can be set with -DPYTHON_EXECUTABLE=/usr/bin/python3 or -DPython_ADDITIONAL_VERSIONS=3 for instance. find_package(Cython) @@ -128,17 +117,20 @@ if(NOT GUDHI_CYTHON_PATH) endif(NOT GUDHI_CYTHON_PATH) if(PYTHONINTERP_FOUND AND CYTHON_FOUND) - # Unitary tests are available through py.test - find_program( PYTEST_PATH py.test ) # Default found version 2 if(PYTHON_VERSION_MAJOR EQUAL 2) # Documentation generation is available through sphinx find_program( SPHINX_PATH sphinx-build ) elseif(PYTHON_VERSION_MAJOR EQUAL 3) - # Documentation generation is available through sphinx - set(SPHINX_PATH "${CMAKE_SOURCE_DIR}/${GUDHI_CYTHON_PATH}/doc/python3-sphinx-build") + # No sphinx-build in Pyton3, just hack it + set(SPHINX_PATH "${PYTHON_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/${GUDHI_CYTHON_PATH}/doc/python3-sphinx-build.py") else() message(FATAL_ERROR "ERROR: Try to compile the Cython interface. Python version ${PYTHON_VERSION_STRING} is not valid.") endif(PYTHON_VERSION_MAJOR EQUAL 2) + # get PYTHON_SITE_PACKAGES relative path from a python command line + execute_process( + COMMAND "${PYTHON_EXECUTABLE}" -c "from distutils.sysconfig import get_python_lib; print (get_python_lib(prefix='', plat_specific=True))" + OUTPUT_VARIABLE PYTHON_SITE_PACKAGES + OUTPUT_STRIP_TRAILING_WHITESPACE) endif(PYTHONINTERP_FOUND AND CYTHON_FOUND) diff --git a/cmake/modules/GUDHI_user_version_target.txt b/cmake/modules/GUDHI_user_version_target.cmake index ca6bcd34..cff64ad2 100644 --- a/cmake/modules/GUDHI_user_version_target.txt +++ b/cmake/modules/GUDHI_user_version_target.cmake @@ -47,11 +47,10 @@ if (NOT CMAKE_VERSION VERSION_LESS 2.8.11) 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_MODULES "common;Alpha_complex;Bitmap_cubical_complex;Bottleneck_distance;Contraction;Hasse_complex;Persistent_cohomology;Rips_complex;Simplex_tree;Skeleton_blocker;Spatial_searching;Subsampling;Tangential_complex;Witness_complex") - set(GUDHI_DIRECTORIES "doc;example;concept") + set(GUDHI_DIRECTORIES "doc;example;concept;utilities") set(GUDHI_INCLUDE_DIRECTORIES "include/gudhi;include/gudhi_patches") - foreach(GUDHI_MODULE ${GUDHI_MODULES}) + 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}/*) @@ -86,6 +85,6 @@ if (NOT CMAKE_VERSION VERSION_LESS 2.8.11) endforeach() endforeach(GUDHI_INCLUDE_DIRECTORY ${GUDHI_INCLUDE_DIRECTORIES}) - endforeach(GUDHI_MODULE ${GUDHI_MODULES}) + endforeach(GUDHI_MODULE ${GUDHI_MODULES_FULL_LIST}) endif() |