From c09268a046c43b4311f0f29ac4bfb14dcb2da30d Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Fri, 2 Jun 2017 14:10:20 +0000 Subject: Try to remove boost system git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/boost_system_no_deprecated_test@2504 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: fd12c45af5ebeb72c4b49142abab91b46ce1a9da --- src/cmake/modules/GUDHI_third_party_libraries.cmake | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/cmake') diff --git a/src/cmake/modules/GUDHI_third_party_libraries.cmake b/src/cmake/modules/GUDHI_third_party_libraries.cmake index 8cb01d3c..7b0cda3b 100644 --- a/src/cmake/modules/GUDHI_third_party_libraries.cmake +++ b/src/cmake/modules/GUDHI_third_party_libraries.cmake @@ -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}) -- cgit v1.2.3 From f5d28342ee398c739c7345d8db4fbd653e9a0413 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Thu, 8 Jun 2017 07:17:36 +0000 Subject: Add modules as CMake options in order to be able to activate/desactivate compilation git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/cmake_modules_for_gudhi@2515 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 53d5e669ad310c9d8d17c7f95f1e07c3bf658d77 --- CMakeLists.txt | 18 ++++-------------- src/CMakeLists.txt | 8 ++++---- src/cmake/modules/GUDHI_modules.cmake | 23 +++++++++++++++++++---- src/cmake/modules/GUDHI_user_version_target.cmake | 4 ++-- 4 files changed, 29 insertions(+), 24 deletions(-) (limited to 'src/cmake') diff --git a/CMakeLists.txt b/CMakeLists.txt index c9ceb92b..fbb359e1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,10 +3,7 @@ project(GUDHIdev) include(CMakeGUDHIVersion.txt) -set(CMAKE_PREFIX_PATH "${CMAKE_SOURCE_DIR}/src/cmake/modules/") -set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/src/cmake/modules/") -message("CMAKE_PREFIX_PATH = ${CMAKE_PREFIX_PATH}") -message("CMAKE_MODULE_PATH = ${CMAKE_MODULE_PATH}") +list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/src/cmake/modules/") enable_testing() @@ -34,10 +31,8 @@ if (DEBUG_TRACES) add_definitions(-DDEBUG_TRACES) endif() -# Modules list can be found in CMAKE_MODULE_PATH/GUDHI_modules.cmake -include(GUDHI_modules) - # Add your new module in the list, order is not important +include(GUDHI_modules) add_gudhi_module(common) add_gudhi_module(Alpha_complex) @@ -54,12 +49,7 @@ add_gudhi_module(Subsampling) add_gudhi_module(Tangential_complex) add_gudhi_module(Witness_complex) -# Include module headers -foreach(GUDHI_MODULE ${GUDHI_MODULES}) - if(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/src/${GUDHI_MODULE}/include/) - include_directories(src/${GUDHI_MODULE}/include/) - endif() -endforeach() +message("++ GUDHI_MODULES list is:\"${GUDHI_MODULES}\"") # Include module CMake subdirectories # GUDHI_SUB_DIRECTORIES is managed in CMAKE_MODULE_PATH/GUDHI_modules.cmake @@ -73,7 +63,7 @@ endforeach() add_subdirectory(src/GudhUI) -if (NOT WITHOUT_GUDHI_PYTHON) +if (WITH_GUDHI_PYTHON) # specific for cython module add_subdirectory(${GUDHI_CYTHON_PATH}) endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8abfcf44..795005b1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -7,10 +7,8 @@ enable_testing() list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules/") -# To be done first - Modules list can be found in CMAKE_MODULE_PATH/GUDHI_modules.cmake -include(GUDHI_modules) - # Add your new module in the list, order is not important +include(GUDHI_modules) add_gudhi_module(common) add_gudhi_module(Alpha_complex) @@ -27,6 +25,8 @@ add_gudhi_module(Subsampling) add_gudhi_module(Tangential_complex) add_gudhi_module(Witness_complex) +message("++ GUDHI_MODULES list is:\"${GUDHI_MODULES}\"") + # For "make doxygen" - Requires GUDHI_USER_VERSION_DIR to be set set(GUDHI_USER_VERSION_DIR ${CMAKE_SOURCE_DIR}) include(GUDHI_doxygen_target) @@ -71,7 +71,7 @@ endforeach() add_subdirectory(GudhUI) -if (NOT WITHOUT_GUDHI_PYTHON) +if (WITH_GUDHI_PYTHON) # specific for cython module add_subdirectory(${GUDHI_CYTHON_PATH}) endif() diff --git a/src/cmake/modules/GUDHI_modules.cmake b/src/cmake/modules/GUDHI_modules.cmake index 20fc8d17..f95d0c34 100644 --- a/src/cmake/modules/GUDHI_modules.cmake +++ b/src/cmake/modules/GUDHI_modules.cmake @@ -1,11 +1,26 @@ # 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) -# message("++ GUDHI_MODULES list is:\"${GUDHI_MODULES}\"") +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") @@ -13,10 +28,10 @@ endif() if (WITH_GUDHI_EXAMPLE) set(GUDHI_SUB_DIRECTORIES "${GUDHI_SUB_DIRECTORIES};example") endif() -if (NOT WITHOUT_GUDHI_TEST) - set(GUDHI_SUB_DIRECTORIES "${GUDHI_SUB_DIRECTORIES};test") +if (WITH_GUDHI_TEST) + set(GUDHI_SUB_DIRECTORIES "${GUDHI_SUB_DIRECTORIES};test") endif() -if (NOT WITHOUT_GUDHI_UTILITIES) +if (WITH_GUDHI_UTILITIES) set(GUDHI_SUB_DIRECTORIES "${GUDHI_SUB_DIRECTORIES};utilities") endif() diff --git a/src/cmake/modules/GUDHI_user_version_target.cmake b/src/cmake/modules/GUDHI_user_version_target.cmake index 8642d3bf..cff64ad2 100644 --- a/src/cmake/modules/GUDHI_user_version_target.cmake +++ b/src/cmake/modules/GUDHI_user_version_target.cmake @@ -50,7 +50,7 @@ if (NOT CMAKE_VERSION VERSION_LESS 2.8.11) 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}/*) @@ -85,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() -- cgit v1.2.3 From 41991433af57269f1328c7c67e26eb111b060fa2 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Fri, 9 Jun 2017 06:19:25 +0000 Subject: Add BOOST_SYSTEM_NO_DEPRECATED definition git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/boost_system_no_deprecated_test@2524 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 4718264666a9289a46f282cfcf3200481966c0db --- src/cmake/modules/GUDHI_third_party_libraries.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/cmake') diff --git a/src/cmake/modules/GUDHI_third_party_libraries.cmake b/src/cmake/modules/GUDHI_third_party_libraries.cmake index 7b0cda3b..5bee774a 100644 --- a/src/cmake/modules/GUDHI_third_party_libraries.cmake +++ b/src/cmake/modules/GUDHI_third_party_libraries.cmake @@ -100,7 +100,7 @@ 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 ) +add_definitions( -DBOOST_SYSTEM_NO_DEPRECATED ) INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) LINK_DIRECTORIES(${Boost_LIBRARY_DIRS}) -- cgit v1.2.3 From 4adbd857ff2ac187b5dfcfa25c37f32b887ae69b Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Fri, 9 Jun 2017 07:48:54 +0000 Subject: No more need of find_the_lib cmake macro to find Windows boost lib name Fix cmake warning on if with quotes git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/boost_system_no_deprecated_test@2527 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: a352820ab0a596961b9851d4a30c40196a70ff98 --- src/cmake/modules/GUDHI_third_party_libraries.cmake | 13 ------------- src/cython/CMakeLists.txt | 4 ++-- 2 files changed, 2 insertions(+), 15 deletions(-) (limited to 'src/cmake') diff --git a/src/cmake/modules/GUDHI_third_party_libraries.cmake b/src/cmake/modules/GUDHI_third_party_libraries.cmake index 5bee774a..b4f3eb52 100644 --- a/src/cmake/modules/GUDHI_third_party_libraries.cmake +++ b/src/cmake/modules/GUDHI_third_party_libraries.cmake @@ -108,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) diff --git a/src/cython/CMakeLists.txt b/src/cython/CMakeLists.txt index 4b56122d..adcc64e4 100644 --- a/src/cython/CMakeLists.txt +++ b/src/cython/CMakeLists.txt @@ -17,9 +17,9 @@ if(CYTHON_FOUND) if(CMAKE_COMPILER_IS_GNUCXX) set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-frounding-math', ") endif(CMAKE_COMPILER_IS_GNUCXX) - if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") + if (CMAKE_CXX_COMPILER_ID MATCHES Intel) set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-fp-model strict', ") - endif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") + endif(CMAKE_CXX_COMPILER_ID MATCHES Intel) if (DEBUG_TRACES) # For programs to be more verbose set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DDEBUG_TRACES', ") -- cgit v1.2.3 From 26ccabbd6892ddc5313a7f75c98a92c268f15747 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Fri, 9 Jun 2017 08:39:16 +0000 Subject: Remove boost timer and chrono dependencies git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/boost_system_no_deprecated_test@2528 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 5bfb8bd5a6e49dbea9fbfbdc1d748423fc930913 --- src/Contraction/example/CMakeLists.txt | 4 ---- src/Contraction/example/Garland_heckbert.cpp | 3 --- src/Contraction/example/Rips_contraction.cpp | 6 ------ src/Skeleton_blocker/example/CMakeLists.txt | 2 -- src/Skeleton_blocker/example/Skeleton_blocker_iteration.cpp | 4 ---- src/cmake/modules/GUDHI_third_party_libraries.cmake | 2 +- 6 files changed, 1 insertion(+), 20 deletions(-) (limited to 'src/cmake') diff --git a/src/Contraction/example/CMakeLists.txt b/src/Contraction/example/CMakeLists.txt index 6443323d..83594c0e 100644 --- a/src/Contraction/example/CMakeLists.txt +++ b/src/Contraction/example/CMakeLists.txt @@ -5,10 +5,6 @@ project(Contraction_examples) add_executable(RipsContraction Rips_contraction.cpp) add_executable(GarlandHeckbert Garland_heckbert.cpp) -target_link_libraries(RipsContraction ${Boost_TIMER_LIBRARY}) -target_link_libraries(GarlandHeckbert ${Boost_TIMER_LIBRARY}) - - add_test(NAME Contraction_example_tore3D_0.2 COMMAND $ "${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off" "0.2") # TODO(DS) : These tests are too long under Windows diff --git a/src/Contraction/example/Garland_heckbert.cpp b/src/Contraction/example/Garland_heckbert.cpp index 8b5a6a6c..2b0dc973 100644 --- a/src/Contraction/example/Garland_heckbert.cpp +++ b/src/Contraction/example/Garland_heckbert.cpp @@ -30,7 +30,6 @@ #include #include -#include #include #include "Garland_heckbert/Error_quadric.h" @@ -165,8 +164,6 @@ int main(int argc, char *argv[]) { int num_contractions = atoi(argv[3]); - boost::timer::auto_cpu_timer t; - // constructs the contractor object with Garland Heckbert policies. Complex_contractor contractor(complex, new GH_cost(complex), diff --git a/src/Contraction/example/Rips_contraction.cpp b/src/Contraction/example/Rips_contraction.cpp index 8289b1d3..1b97f877 100644 --- a/src/Contraction/example/Rips_contraction.cpp +++ b/src/Contraction/example/Rips_contraction.cpp @@ -24,7 +24,6 @@ #include #include -#include #include struct Geometry_trait { @@ -68,8 +67,6 @@ int main(int argc, char *argv[]) { build_rips(complex, atof(argv[2])); - boost::timer::auto_cpu_timer t; - std::cout << "Initial complex has " << complex.num_vertices() << " vertices and " << complex.num_edges() << " edges" << std::endl; @@ -90,9 +87,6 @@ int main(int argc, char *argv[]) { complex.num_blockers() << " blockers and " << num_simplices << " simplices" << std::endl; - - std::cout << "Time to simplify and enumerate simplices:\n"; - return EXIT_SUCCESS; } diff --git a/src/Skeleton_blocker/example/CMakeLists.txt b/src/Skeleton_blocker/example/CMakeLists.txt index 6d685717..de70f089 100644 --- a/src/Skeleton_blocker/example/CMakeLists.txt +++ b/src/Skeleton_blocker/example/CMakeLists.txt @@ -5,8 +5,6 @@ add_executable(Skeleton_blocker_example_from_simplices Skeleton_blocker_from_sim add_executable(Skeleton_blocker_example_iteration Skeleton_blocker_iteration.cpp) add_executable(Skeleton_blocker_example_link Skeleton_blocker_link.cpp) -target_link_libraries(Skeleton_blocker_example_iteration ${Boost_TIMER_LIBRARY}) - add_test(NAME Skeleton_blocker_example_from_simplices COMMAND $) add_test(NAME Skeleton_blocker_example_iteration COMMAND $) add_test(NAME Skeleton_blocker_example_link COMMAND $) diff --git a/src/Skeleton_blocker/example/Skeleton_blocker_iteration.cpp b/src/Skeleton_blocker/example/Skeleton_blocker_iteration.cpp index 6a1bc480..4a0044e1 100644 --- a/src/Skeleton_blocker/example/Skeleton_blocker_iteration.cpp +++ b/src/Skeleton_blocker/example/Skeleton_blocker_iteration.cpp @@ -22,8 +22,6 @@ #include -#include - #include #include #include @@ -47,8 +45,6 @@ Complex build_complete_complex(int n) { } int main(int argc, char *argv[]) { - boost::timer::auto_cpu_timer t; - const int n = 15; // build a full complex with n vertices and 2^n-1 simplices diff --git a/src/cmake/modules/GUDHI_third_party_libraries.cmake b/src/cmake/modules/GUDHI_third_party_libraries.cmake index b4f3eb52..2be79ee4 100644 --- a/src/cmake/modules/GUDHI_third_party_libraries.cmake +++ b/src/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 date_time program_options thread) if(NOT Boost_FOUND) message(FATAL_ERROR "NOTICE: This program requires Boost and will not be compiled.") -- cgit v1.2.3 From 05de4e9f4ed8f74e53a11455bc50470beba908eb Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Fri, 9 Jun 2017 09:40:52 +0000 Subject: Remove boost date_time dependencies git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/boost_system_no_deprecated_test@2529 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: daa13fc0046ffdd72577bb1b399fcbdc8ef5033c --- src/Tangential_complex/benchmark/CMakeLists.txt | 3 +-- src/Tangential_complex/example/CMakeLists.txt | 4 ++-- src/Tangential_complex/test/CMakeLists.txt | 2 +- src/cmake/modules/GUDHI_third_party_libraries.cmake | 2 +- src/common/include/gudhi/Clock.h | 18 +++++++++--------- 5 files changed, 14 insertions(+), 15 deletions(-) (limited to 'src/cmake') diff --git a/src/Tangential_complex/benchmark/CMakeLists.txt b/src/Tangential_complex/benchmark/CMakeLists.txt index 8cb16e8c..8729e394 100644 --- a/src/Tangential_complex/benchmark/CMakeLists.txt +++ b/src/Tangential_complex/benchmark/CMakeLists.txt @@ -3,8 +3,7 @@ project(Tangential_complex_benchmark) if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1) add_executable(Tangential_complex_benchmark benchmark_tc.cpp) - target_link_libraries(Tangential_complex_benchmark - ${Boost_DATE_TIME_LIBRARY} ${CGAL_LIBRARY}) + target_link_libraries(Tangential_complex_benchmark ${CGAL_LIBRARY}) if (TBB_FOUND) target_link_libraries(Tangential_complex_benchmark ${TBB_LIBRARIES}) endif(TBB_FOUND) diff --git a/src/Tangential_complex/example/CMakeLists.txt b/src/Tangential_complex/example/CMakeLists.txt index 45c7642b..16d1339d 100644 --- a/src/Tangential_complex/example/CMakeLists.txt +++ b/src/Tangential_complex/example/CMakeLists.txt @@ -3,9 +3,9 @@ project(Tangential_complex_examples) if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1) add_executable( Tangential_complex_example_basic example_basic.cpp ) - target_link_libraries(Tangential_complex_example_basic ${CGAL_LIBRARY} ${Boost_DATE_TIME_LIBRARY}) + target_link_libraries(Tangential_complex_example_basic ${CGAL_LIBRARY}) add_executable( Tangential_complex_example_with_perturb example_with_perturb.cpp ) - target_link_libraries(Tangential_complex_example_with_perturb ${CGAL_LIBRARY} ${Boost_DATE_TIME_LIBRARY}) + target_link_libraries(Tangential_complex_example_with_perturb ${CGAL_LIBRARY}) if (TBB_FOUND) target_link_libraries(Tangential_complex_example_basic ${TBB_LIBRARIES}) target_link_libraries(Tangential_complex_example_with_perturb ${TBB_LIBRARIES}) diff --git a/src/Tangential_complex/test/CMakeLists.txt b/src/Tangential_complex/test/CMakeLists.txt index 63e51c3e..1948c8f6 100644 --- a/src/Tangential_complex/test/CMakeLists.txt +++ b/src/Tangential_complex/test/CMakeLists.txt @@ -5,7 +5,7 @@ if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1) include(GUDHI_test_coverage) add_executable( Tangential_complex_test_TC test_tangential_complex.cpp ) - target_link_libraries(Tangential_complex_test_TC ${CGAL_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} ${Boost_DATE_TIME_LIBRARY}) + target_link_libraries(Tangential_complex_test_TC ${CGAL_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) if (TBB_FOUND) target_link_libraries(Tangential_complex_test_TC ${TBB_LIBRARIES}) endif() diff --git a/src/cmake/modules/GUDHI_third_party_libraries.cmake b/src/cmake/modules/GUDHI_third_party_libraries.cmake index 2be79ee4..8f486118 100644 --- a/src/cmake/modules/GUDHI_third_party_libraries.cmake +++ b/src/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 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.") diff --git a/src/common/include/gudhi/Clock.h b/src/common/include/gudhi/Clock.h index 77f196ca..eff48e41 100644 --- a/src/common/include/gudhi/Clock.h +++ b/src/common/include/gudhi/Clock.h @@ -23,9 +23,9 @@ #ifndef CLOCK_H_ #define CLOCK_H_ -#include - +#include #include +#include namespace Gudhi { @@ -33,20 +33,20 @@ class Clock { public: // Construct and start the timer Clock(const std::string& msg_ = std::string()) - : startTime(boost::posix_time::microsec_clock::local_time()), + : startTime(std::chrono::system_clock::now()), end_called(false), msg(msg_) { } // Restart the timer void begin() const { end_called = false; - startTime = boost::posix_time::microsec_clock::local_time(); + startTime = std::chrono::system_clock::now(); } // Stop the timer void end() const { end_called = true; - endTime = boost::posix_time::microsec_clock::local_time(); + endTime = std::chrono::system_clock::now(); } std::string message() const { @@ -71,15 +71,15 @@ class Clock { // - or now otherwise. In this case, the timer is not stopped. double num_seconds() const { if (!end_called) { - auto end = boost::posix_time::microsec_clock::local_time(); - return (end - startTime).total_milliseconds() / 1000.; + auto end = std::chrono::system_clock::now(); + return std::chrono::duration_cast(end-startTime).count() / 1000.; } else { - return (endTime - startTime).total_milliseconds() / 1000.; + return std::chrono::duration_cast(endTime-startTime).count() / 1000.; } } private: - mutable boost::posix_time::ptime startTime, endTime; + mutable std::chrono::time_point startTime, endTime; mutable bool end_called; std::string msg; }; -- cgit v1.2.3 From 547a7c9cb50d1818c9412d10cca9655503db625c Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Tue, 13 Jun 2017 20:42:51 +0000 Subject: Try to fix Windows compilation for Conda git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/boost_system_no_deprecated_test@2541 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: afa1b10e300aafbc92a85b3519f4b39add2ae6e4 --- src/cmake/modules/GUDHI_third_party_libraries.cmake | 4 ++++ src/cython/CMakeLists.txt | 3 +++ 2 files changed, 7 insertions(+) (limited to 'src/cmake') diff --git a/src/cmake/modules/GUDHI_third_party_libraries.cmake b/src/cmake/modules/GUDHI_third_party_libraries.cmake index 8f486118..7cd57b25 100644 --- a/src/cmake/modules/GUDHI_third_party_libraries.cmake +++ b/src/cmake/modules/GUDHI_third_party_libraries.cmake @@ -10,6 +10,10 @@ find_package(GMP) if(GMP_FOUND) message(STATUS "GMP_LIBRARIES = ${GMP_LIBRARIES}") INCLUDE_DIRECTORIES(${GMP_INCLUDE_DIR}) + get_filename_component(lib_we ${GMP_LIBRARIES} NAME_WE) + + message("++ lib_we = ${lib_we}") + find_package(GMPXX) if(GMPXX_FOUND) message(STATUS "GMPXX_LIBRARIES = ${GMPXX_LIBRARIES}") diff --git a/src/cython/CMakeLists.txt b/src/cython/CMakeLists.txt index adcc64e4..2a0a3844 100644 --- a/src/cython/CMakeLists.txt +++ b/src/cython/CMakeLists.txt @@ -8,6 +8,9 @@ if(CYTHON_FOUND) set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DBOOST_ALL_NO_LIB', ") set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DBOOST_SYSTEM_NO_DEPRECATED', ") + if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'boost_thread', ") + endif() # Gudhi and CGAL compilation option if(MSVC) set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'/fp:strict', ") -- cgit v1.2.3 From f6d8aaaacf4a2802d3aaad6d326f9510fdb2ddf7 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Wed, 14 Jun 2017 05:24:01 +0000 Subject: Add traces for debug git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/boost_system_no_deprecated_test@2542 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: a9e8098443114a4fe6e9c19e6410169580c134c6 --- src/cmake/modules/GUDHI_third_party_libraries.cmake | 4 ---- src/cython/CMakeLists.txt | 10 ++++++++-- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'src/cmake') diff --git a/src/cmake/modules/GUDHI_third_party_libraries.cmake b/src/cmake/modules/GUDHI_third_party_libraries.cmake index 7cd57b25..8f486118 100644 --- a/src/cmake/modules/GUDHI_third_party_libraries.cmake +++ b/src/cmake/modules/GUDHI_third_party_libraries.cmake @@ -10,10 +10,6 @@ find_package(GMP) if(GMP_FOUND) message(STATUS "GMP_LIBRARIES = ${GMP_LIBRARIES}") INCLUDE_DIRECTORIES(${GMP_INCLUDE_DIR}) - get_filename_component(lib_we ${GMP_LIBRARIES} NAME_WE) - - message("++ lib_we = ${lib_we}") - find_package(GMPXX) if(GMPXX_FOUND) message(STATUS "GMPXX_LIBRARIES = ${GMPXX_LIBRARIES}") diff --git a/src/cython/CMakeLists.txt b/src/cython/CMakeLists.txt index 2a0a3844..eff36f93 100644 --- a/src/cython/CMakeLists.txt +++ b/src/cython/CMakeLists.txt @@ -8,6 +8,7 @@ if(CYTHON_FOUND) set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DBOOST_ALL_NO_LIB', ") set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DBOOST_SYSTEM_NO_DEPRECATED', ") + message("++ Boost_THREAD_LIBRARY=${Boost_THREAD_LIBRARY} - Boost_thread_LIBRARY=${Boost_thread_LIBRARY} - ") if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'boost_thread', ") endif() @@ -106,6 +107,7 @@ if(CYTHON_FOUND) if(CGAL_FOUND) # Add CGAL compilation args + message("++ CGAL_LIBRARIES = ${CGAL_LIBRARIES}") if(CGAL_HEADER_ONLY) set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DCGAL_HEADER_ONLY', ") else(CGAL_HEADER_ONLY) @@ -119,10 +121,14 @@ if(CYTHON_FOUND) # GMP and GMPXX are not required, but if present, CGAL will link with them. if(GMP_FOUND) set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DCGAL_USE_GMP', ") + get_filename_component(GMP_LIBRARY_FILE_NAME ${GMP_LIBRARIES} NAME_WE) + message("++ GMP_LIBRARY_FILE_NAME = ${GMP_LIBRARY_FILE_NAME}") if(WIN32) - set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'libgmp-10', ") + set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'${GMP_LIBRARY_FILE_NAME}', ") else(WIN32) - set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'gmp', ") + STRING(REGEX REPLACE "lib" "" UNIX_GMP_LIBRARY_FILE_NAME ${GMP_LIBRARY_FILE_NAME}) + message("++ UNIX_GMP_LIBRARY_FILE_NAME = ${UNIX_GMP_LIBRARY_FILE_NAME}") + set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'${UNIX_GMP_LIBRARY_FILE_NAME}', ") endif(WIN32) set(GUDHI_CYTHON_LIBRARY_DIRS "${GUDHI_CYTHON_LIBRARY_DIRS}'${GMP_LIBRARIES_DIR}', ") if(GMPXX_FOUND) -- cgit v1.2.3 From 2fc118133e76f05fc55d86cf32883223191fe473 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Thu, 17 Aug 2017 16:10:46 +0000 Subject: Add file formats for Python. Binding for persistence write files Launch py.test with the command "python -m pytest" (shall work everywhere) git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/persistence_diagram_improvement@2611 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 9443a7eb5b580ece7708ff57949ad08339c1c5c3 --- .../include/gudhi/Persistent_cohomology.h | 13 +++++++--- .../modules/GUDHI_third_party_libraries.cmake | 2 -- src/common/doc/file_formats.h | 6 ++++- src/cython/CMakeLists.txt | 14 +++++----- src/cython/cython/simplex_tree.pyx | 22 +++++++++++++++- src/cython/doc/_templates/layout.html | 1 + src/cython/doc/fileformats.rst | 30 ++++++++++++++++++++++ src/cython/doc/reader_utils_ref.rst | 11 ++++++++ 8 files changed, 84 insertions(+), 15 deletions(-) create mode 100644 src/cython/doc/fileformats.rst create mode 100644 src/cython/doc/reader_utils_ref.rst (limited to 'src/cmake') diff --git a/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h b/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h index 672fda48..e0a147b3 100644 --- a/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h +++ b/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h @@ -591,10 +591,17 @@ class Persistent_cohomology { std::ofstream diagram_out(diagram_name.c_str()); cmp_intervals_by_length cmp(cpx_); std::sort(std::begin(persistent_pairs_), std::end(persistent_pairs_), cmp); + bool has_infinity = std::numeric_limits::has_infinity; for (auto pair : persistent_pairs_) { - diagram_out << cpx_->dimension(get<0>(pair)) << " " - << cpx_->filtration(get<0>(pair)) << " " - << cpx_->filtration(get<1>(pair)) << std::endl; + // Special case on windows, inf is "1.#INF" + if (has_infinity && cpx_->filtration(get<1>(pair)) == std::numeric_limits::infinity()) { + diagram_out << cpx_->dimension(get<0>(pair)) << " " + << cpx_->filtration(get<0>(pair)) << " inf" << std::endl; + } else { + diagram_out << cpx_->dimension(get<0>(pair)) << " " + << cpx_->filtration(get<0>(pair)) << " " + << cpx_->filtration(get<1>(pair)) << std::endl; + } } } diff --git a/src/cmake/modules/GUDHI_third_party_libraries.cmake b/src/cmake/modules/GUDHI_third_party_libraries.cmake index 8f486118..e29ba40c 100644 --- a/src/cmake/modules/GUDHI_third_party_libraries.cmake +++ b/src/cmake/modules/GUDHI_third_party_libraries.cmake @@ -117,8 +117,6 @@ 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 diff --git a/src/common/doc/file_formats.h b/src/common/doc/file_formats.h index 9d0415b1..d715aa4d 100644 --- a/src/common/doc/file_formats.h +++ b/src/common/doc/file_formats.h @@ -26,7 +26,7 @@ namespace Gudhi { /*! \page fileformats File formats - + \tableofcontents \section FileFormatsPers Persistence Diagram @@ -49,6 +49,10 @@ namespace Gudhi { \endverbatim Other sample files can be found in the `data/persistence_diagram` folder. + + Such files can be generated with `Gudhi::persistent_cohomology::Persistent_cohomology::output_diagram()` and read with + `Gudhi::read_persistence_intervals_and_dimension()`, `Gudhi::read_persistence_intervals_grouped_by_dimension()` or + `Gudhi::read_persistence_intervals_in_dimension()`. */ } // namespace Gudhi diff --git a/src/cython/CMakeLists.txt b/src/cython/CMakeLists.txt index f427b3c5..a06be008 100644 --- a/src/cython/CMakeLists.txt +++ b/src/cython/CMakeLists.txt @@ -16,7 +16,7 @@ function( add_gudhi_cython_lib THE_LIB ) endfunction( add_gudhi_cython_lib ) if(CYTHON_FOUND) - message("++ ${PYTHON_EXECUTABLE} v.${PYTHON_VERSION_STRING} - Cython is ${CYTHON_EXECUTABLE} - py.test is ${PYTEST_PATH} - Sphinx is ${SPHINX_PATH}") + message("++ ${PYTHON_EXECUTABLE} v.${PYTHON_VERSION_STRING} - Cython is ${CYTHON_EXECUTABLE} - Sphinx is ${SPHINX_PATH}") set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DBOOST_RESULT_OF_USE_DECLTYPE', ") set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DBOOST_ALL_NO_LIB', ") @@ -305,13 +305,11 @@ if(CYTHON_FOUND) set_tests_properties(witness_complex_from_nearest_landmark_table_py_test PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}") # Unitary tests are available through py.test - if(PYTEST_PATH) - add_test( - NAME gudhi_cython_py_test - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMAND ${PYTHON_EXECUTABLE} "${PYTEST_PATH}") - set_tests_properties(gudhi_cython_py_test PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}") - endif(PYTEST_PATH) + add_test( + NAME gudhi_cython_py_test + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${PYTHON_EXECUTABLE} -m pytest) + set_tests_properties(gudhi_cython_py_test PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}") # Documentation generation is available through sphinx if(SPHINX_PATH) diff --git a/src/cython/cython/simplex_tree.pyx b/src/cython/cython/simplex_tree.pyx index 2acdac3c..9e3b2345 100644 --- a/src/cython/cython/simplex_tree.pyx +++ b/src/cython/cython/simplex_tree.pyx @@ -61,6 +61,7 @@ cdef extern from "Persistent_cohomology_interface.h" namespace "Gudhi": vector[int] betti_numbers() vector[int] persistent_betti_numbers(double from_value, double to_value) vector[pair[double,double]] intervals_in_dimension(int dimension) + void write_output_diagram(string diagram_file_name) # SimplexTree python interface cdef class SimplexTree: @@ -385,7 +386,7 @@ cdef class SimplexTree: complex in a specific dimension. :param dimension: The specific dimension. - :type from_value: int. + :type dimension: int. :returns: The persistence intervals. :rtype: list of pair of float @@ -399,3 +400,22 @@ cdef class SimplexTree: print("intervals_in_dim function requires persistence function" " to be launched first.") return intervals_result + + def write_persistence_diagram(self, persistence_file=''): + """This function writes the persistence intervals of the simplicial + complex in a user given file name. + + :param persistence_file: The specific dimension. + :type persistence_file: string. + + :note: intervals_in_dim function requires persistence function to be + launched first. + """ + if self.pcohptr != NULL: + if persistence_file != '': + self.pcohptr.write_output_diagram(str.encode(persistence_file)) + else: + print("persistence_file must be specified") + else: + print("intervals_in_dim function requires persistence function" + " to be launched first.") diff --git a/src/cython/doc/_templates/layout.html b/src/cython/doc/_templates/layout.html index b11c1236..243f33c6 100644 --- a/src/cython/doc/_templates/layout.html +++ b/src/cython/doc/_templates/layout.html @@ -65,6 +65,7 @@ {#- old style sidebars: using blocks -- should be deprecated #} {%- block sidebartoc %}

GUDHI

+

File formats

GUDHI installation

Acknowledging the GUDHI library

Index

diff --git a/src/cython/doc/fileformats.rst b/src/cython/doc/fileformats.rst new file mode 100644 index 00000000..36225b6d --- /dev/null +++ b/src/cython/doc/fileformats.rst @@ -0,0 +1,30 @@ +File formats +############ + +To find the correct function to read the files, please refer to :doc:`reader_utils_ref` + +Persistence Diagram +******************* + +Such a file, whose extension is usually ``.pers``, contains a list of persistence intervals. + +Lines starting with ``#`` are ignored (comments). + +Other lines might contain 2, 3 or 4 values (the number of values on each line must be the same for all lines):: + + [[field] dimension] birth death + +Here is a simple sample file:: + + # Persistence diagram example + 2 2.7 3.7 + 2 9.6 14. + # Some comments + 3 34.2 34.974 + 4 3. inf + +Other sample files can be found in the data/persistence_diagram folder. + +Such files can be generated with :meth:`gudhi.SimplexTree.write_persistence_diagram` and read with +:meth:`gudhi.read_persistence_intervals_grouped_by_dimension`, or +:meth:`gudhi.read_persistence_intervals_in_dimension`. diff --git a/src/cython/doc/reader_utils_ref.rst b/src/cython/doc/reader_utils_ref.rst new file mode 100644 index 00000000..9c1ea6fc --- /dev/null +++ b/src/cython/doc/reader_utils_ref.rst @@ -0,0 +1,11 @@ +============================= +Reader utils reference manual +============================= + +.. autofunction:: gudhi.read_off + +.. autofunction:: gudhi.read_lower_triangular_matrix_from_csv_file + +.. autofunction:: gudhi.read_persistence_intervals_grouped_by_dimension + +.. autofunction:: gudhi.read_persistence_intervals_in_dimension -- cgit v1.2.3 From ef36c8b63bc353ac9d4e6982b9bba6797d546e51 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Fri, 18 Aug 2017 09:40:19 +0000 Subject: Fix sphinx bug when python3 is not in /usr/bin git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/persistence_diagram_improvement@2613 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 07f67d4cc1f3b558b191115e0979ce3ce0580206 --- src/cmake/modules/GUDHI_third_party_libraries.cmake | 2 +- src/cython/CMakeLists.txt | 1 + src/cython/doc/python3-sphinx-build | 11 ----------- src/cython/doc/python3-sphinx-build.in | 11 +++++++++++ 4 files changed, 13 insertions(+), 12 deletions(-) delete mode 100755 src/cython/doc/python3-sphinx-build create mode 100755 src/cython/doc/python3-sphinx-build.in (limited to 'src/cmake') diff --git a/src/cmake/modules/GUDHI_third_party_libraries.cmake b/src/cmake/modules/GUDHI_third_party_libraries.cmake index e29ba40c..dbf2106a 100644 --- a/src/cmake/modules/GUDHI_third_party_libraries.cmake +++ b/src/cmake/modules/GUDHI_third_party_libraries.cmake @@ -123,7 +123,7 @@ if(PYTHONINTERP_FOUND AND CYTHON_FOUND) find_program( SPHINX_PATH sphinx-build ) elseif(PYTHON_VERSION_MAJOR EQUAL 3) # No sphinx-build in Pyton3, just hack it - set(SPHINX_PATH "${CMAKE_SOURCE_DIR}/${GUDHI_CYTHON_PATH}/doc/python3-sphinx-build") + set(SPHINX_PATH "${CMAKE_CURRENT_BINARY_DIR}/${GUDHI_CYTHON_PATH}/doc/python3-sphinx-build") 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) diff --git a/src/cython/CMakeLists.txt b/src/cython/CMakeLists.txt index a06be008..ab5ea9ef 100644 --- a/src/cython/CMakeLists.txt +++ b/src/cython/CMakeLists.txt @@ -194,6 +194,7 @@ if(CYTHON_FOUND) endif(UNIX) # set sphinx-build in make files + configure_file(doc/python3-sphinx-build.in "${CMAKE_CURRENT_BINARY_DIR}/doc/python3-sphinx-build" @ONLY) configure_file(doc/Makefile.in "${CMAKE_CURRENT_BINARY_DIR}/doc/Makefile" @ONLY) configure_file(doc/make.bat.in "${CMAKE_CURRENT_BINARY_DIR}/doc/make.bat" @ONLY) diff --git a/src/cython/doc/python3-sphinx-build b/src/cython/doc/python3-sphinx-build deleted file mode 100755 index 44b94169..00000000 --- a/src/cython/doc/python3-sphinx-build +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/python3 - -""" -Emulate sphinx-build for python3 -""" - -from sys import exit, argv -from sphinx import main - -if __name__ == '__main__': - exit(main(argv)) diff --git a/src/cython/doc/python3-sphinx-build.in b/src/cython/doc/python3-sphinx-build.in new file mode 100755 index 00000000..c97965f5 --- /dev/null +++ b/src/cython/doc/python3-sphinx-build.in @@ -0,0 +1,11 @@ +#!@PYTHON_EXECUTABLE@ + +""" +Emulate sphinx-build for python3 +""" + +from sys import exit, argv +from sphinx import main + +if __name__ == '__main__': + exit(main(argv)) -- cgit v1.2.3 From 5470c3565cfb4b9e3827a42bfdc3fbec461638a5 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Tue, 12 Sep 2017 10:05:46 +0000 Subject: Fix in Python3 if sphinx is not installed git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/cythonization_improvement@2663 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 0005d7fe2e7e8513a276543295c02351456595cc --- src/cmake/modules/GUDHI_third_party_libraries.cmake | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/cmake') diff --git a/src/cmake/modules/GUDHI_third_party_libraries.cmake b/src/cmake/modules/GUDHI_third_party_libraries.cmake index dbf2106a..4cf2f445 100644 --- a/src/cmake/modules/GUDHI_third_party_libraries.cmake +++ b/src/cmake/modules/GUDHI_third_party_libraries.cmake @@ -122,8 +122,12 @@ if(PYTHONINTERP_FOUND AND CYTHON_FOUND) # Documentation generation is available through sphinx find_program( SPHINX_PATH sphinx-build ) elseif(PYTHON_VERSION_MAJOR EQUAL 3) - # No sphinx-build in Pyton3, just hack it - set(SPHINX_PATH "${CMAKE_CURRENT_BINARY_DIR}/${GUDHI_CYTHON_PATH}/doc/python3-sphinx-build") + execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "from sphinx import main" + RESULT_VARIABLE SPHINX_MODULE_IS_INSTALLED) + if(SPHINX_MODULE_IS_INSTALLED) + # No sphinx-build in Pyton3, just hack it + set(SPHINX_PATH "${CMAKE_CURRENT_BINARY_DIR}/${GUDHI_CYTHON_PATH}/doc/python3-sphinx-build") + endif(SPHINX_MODULE_IS_INSTALLED) 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) -- cgit v1.2.3 From 3dd4db9ad872eecae58e6edf3c16915ca1ec7ccc Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Tue, 12 Sep 2017 11:26:30 +0000 Subject: Add debug traces git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/cythonization_improvement@2664 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: e4c572d98f4628e7f9b36fd9925ba7ce68e3cf81 --- src/cmake/modules/GUDHI_third_party_libraries.cmake | 1 + 1 file changed, 1 insertion(+) (limited to 'src/cmake') diff --git a/src/cmake/modules/GUDHI_third_party_libraries.cmake b/src/cmake/modules/GUDHI_third_party_libraries.cmake index 4cf2f445..799d28b6 100644 --- a/src/cmake/modules/GUDHI_third_party_libraries.cmake +++ b/src/cmake/modules/GUDHI_third_party_libraries.cmake @@ -124,6 +124,7 @@ if(PYTHONINTERP_FOUND AND CYTHON_FOUND) elseif(PYTHON_VERSION_MAJOR EQUAL 3) execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "from sphinx import main" RESULT_VARIABLE SPHINX_MODULE_IS_INSTALLED) + message(" --- SPHINX_MODULE_IS_INSTALLED --- ${SPHINX_MODULE_IS_INSTALLED}") if(SPHINX_MODULE_IS_INSTALLED) # No sphinx-build in Pyton3, just hack it set(SPHINX_PATH "${CMAKE_CURRENT_BINARY_DIR}/${GUDHI_CYTHON_PATH}/doc/python3-sphinx-build") -- cgit v1.2.3 From 90f4783f287e266d3d8787d0d18b84d27f8b96b6 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Tue, 12 Sep 2017 12:45:20 +0000 Subject: Modification rollback git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/cythonization_improvement@2665 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 2f977f8b93c6104d2b7c8f16c13da974b36f1535 --- src/cmake/modules/GUDHI_third_party_libraries.cmake | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'src/cmake') diff --git a/src/cmake/modules/GUDHI_third_party_libraries.cmake b/src/cmake/modules/GUDHI_third_party_libraries.cmake index 799d28b6..dbf2106a 100644 --- a/src/cmake/modules/GUDHI_third_party_libraries.cmake +++ b/src/cmake/modules/GUDHI_third_party_libraries.cmake @@ -122,13 +122,8 @@ if(PYTHONINTERP_FOUND AND CYTHON_FOUND) # Documentation generation is available through sphinx find_program( SPHINX_PATH sphinx-build ) elseif(PYTHON_VERSION_MAJOR EQUAL 3) - execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "from sphinx import main" - RESULT_VARIABLE SPHINX_MODULE_IS_INSTALLED) - message(" --- SPHINX_MODULE_IS_INSTALLED --- ${SPHINX_MODULE_IS_INSTALLED}") - if(SPHINX_MODULE_IS_INSTALLED) - # No sphinx-build in Pyton3, just hack it - set(SPHINX_PATH "${CMAKE_CURRENT_BINARY_DIR}/${GUDHI_CYTHON_PATH}/doc/python3-sphinx-build") - endif(SPHINX_MODULE_IS_INSTALLED) + # No sphinx-build in Pyton3, just hack it + set(SPHINX_PATH "${CMAKE_CURRENT_BINARY_DIR}/${GUDHI_CYTHON_PATH}/doc/python3-sphinx-build") 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) -- cgit v1.2.3 From 8a22b7c6111b41e91766cdd53c0116b845e068b5 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Tue, 12 Sep 2017 21:47:19 +0000 Subject: Fix sphinx build for python3 on Ubuntu git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/cythonization_improvement@2667 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: c720b8be2919344e06f3d71cefdd7693439f63f0 --- src/cmake/modules/GUDHI_third_party_libraries.cmake | 2 +- src/cython/CMakeLists.txt | 9 +++------ src/cython/doc/python3-sphinx-build.in | 11 ----------- src/cython/doc/python3-sphinx-build.py | 11 +++++++++++ 4 files changed, 15 insertions(+), 18 deletions(-) delete mode 100755 src/cython/doc/python3-sphinx-build.in create mode 100755 src/cython/doc/python3-sphinx-build.py (limited to 'src/cmake') diff --git a/src/cmake/modules/GUDHI_third_party_libraries.cmake b/src/cmake/modules/GUDHI_third_party_libraries.cmake index dbf2106a..f2bbafdc 100644 --- a/src/cmake/modules/GUDHI_third_party_libraries.cmake +++ b/src/cmake/modules/GUDHI_third_party_libraries.cmake @@ -123,7 +123,7 @@ if(PYTHONINTERP_FOUND AND CYTHON_FOUND) find_program( SPHINX_PATH sphinx-build ) elseif(PYTHON_VERSION_MAJOR EQUAL 3) # No sphinx-build in Pyton3, just hack it - set(SPHINX_PATH "${CMAKE_CURRENT_BINARY_DIR}/${GUDHI_CYTHON_PATH}/doc/python3-sphinx-build") + 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) diff --git a/src/cython/CMakeLists.txt b/src/cython/CMakeLists.txt index baeeb203..d1761f47 100644 --- a/src/cython/CMakeLists.txt +++ b/src/cython/CMakeLists.txt @@ -75,7 +75,7 @@ if(CYTHON_FOUND) if (NOT CGAL_VERSION VERSION_LESS 4.8.1) set(GUDHI_CYTHON_BOTTLENECK_DISTANCE "include '${CMAKE_CURRENT_SOURCE_DIR}/cython/bottleneck_distance.pyx'") - endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1) + endif (NOT CGAL_VERSION VERSION_LESS 4.8.1) if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1) set(GUDHI_CYTHON_SUBSAMPLING "include '${CMAKE_CURRENT_SOURCE_DIR}/cython/subsampling.pyx'") set(GUDHI_CYTHON_TANGENTIAL_COMPLEX "include '${CMAKE_CURRENT_SOURCE_DIR}/cython/tangential_complex.pyx'") @@ -300,20 +300,17 @@ if(CYTHON_FOUND) # Documentation generation is available through sphinx - requires all modules if(SPHINX_PATH AND NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1) - # set sphinx-build in make files - configure_file(doc/python3-sphinx-build.in "${CMAKE_CURRENT_BINARY_DIR}/doc/python3-sphinx-build" @ONLY) - # sphinx target requires gudhi.so, because conf.py reads gudhi version from it add_custom_target(sphinx WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/doc COMMAND ${CMAKE_COMMAND} -E env "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}" - ${SPHINX_PATH} -b html . "${CMAKE_CURRENT_BINARY_DIR}/sphinx" + ${SPHINX_PATH} -b html ${CMAKE_CURRENT_SOURCE_DIR}/doc sphinx DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/gudhi.so") add_test(NAME sphinx_py_test WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${CMAKE_COMMAND} -E env "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}" - ${SPHINX_PATH} -b doctest ${CMAKE_CURRENT_SOURCE_DIR}/doc "${CMAKE_CURRENT_BINARY_DIR}/sphinx") + ${SPHINX_PATH} -b doctest ${CMAKE_CURRENT_SOURCE_DIR}/doc doctest) endif(SPHINX_PATH AND NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1) endif(CYTHON_FOUND) diff --git a/src/cython/doc/python3-sphinx-build.in b/src/cython/doc/python3-sphinx-build.in deleted file mode 100755 index c97965f5..00000000 --- a/src/cython/doc/python3-sphinx-build.in +++ /dev/null @@ -1,11 +0,0 @@ -#!@PYTHON_EXECUTABLE@ - -""" -Emulate sphinx-build for python3 -""" - -from sys import exit, argv -from sphinx import main - -if __name__ == '__main__': - exit(main(argv)) diff --git a/src/cython/doc/python3-sphinx-build.py b/src/cython/doc/python3-sphinx-build.py new file mode 100755 index 00000000..44b94169 --- /dev/null +++ b/src/cython/doc/python3-sphinx-build.py @@ -0,0 +1,11 @@ +#!/usr/bin/python3 + +""" +Emulate sphinx-build for python3 +""" + +from sys import exit, argv +from sphinx import main + +if __name__ == '__main__': + exit(main(argv)) -- cgit v1.2.3