From e8cfcc7017f9002a229996232fdb2d03a41d7ea7 Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Fri, 21 Aug 2020 15:40:17 +0200 Subject: Fix compilation issues when cgal but no eigen --- src/Alpha_complex/example/CMakeLists.txt | 8 ++- src/Alpha_complex/include/gudhi/Alpha_complex_3d.h | 2 - src/Alpha_complex/test/CMakeLists.txt | 6 +- src/Alpha_complex/utilities/CMakeLists.txt | 4 +- src/Collapse/example/CMakeLists.txt | 41 ++++++++------ .../include/gudhi/Flag_complex_edge_collapser.h | 6 ++ src/Collapse/test/CMakeLists.txt | 16 ++++-- src/Collapse/utilities/CMakeLists.txt | 66 ++++++++++++---------- 8 files changed, 87 insertions(+), 62 deletions(-) diff --git a/src/Alpha_complex/example/CMakeLists.txt b/src/Alpha_complex/example/CMakeLists.txt index 2eecd50c..6e231773 100644 --- a/src/Alpha_complex/example/CMakeLists.txt +++ b/src/Alpha_complex/example/CMakeLists.txt @@ -25,7 +25,7 @@ if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.11.0) add_test(NAME Alpha_complex_example_fast_from_off_32 COMMAND $ "${CMAKE_SOURCE_DIR}/data/points/alphacomplexdoc.off" "32.0" "${CMAKE_CURRENT_BINARY_DIR}/fastalphaoffreader_result_32.txt") -if (DIFF_PATH) + if (DIFF_PATH) # Do not forget to copy test results files in current binary dir file(COPY "alphaoffreader_for_doc_32.txt" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/) file(COPY "alphaoffreader_for_doc_60.txt" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/) @@ -43,8 +43,10 @@ if (DIFF_PATH) add_test(Alpha_complex_example_fast_from_off_32_diff_files ${DIFF_PATH} ${CMAKE_CURRENT_BINARY_DIR}/fastalphaoffreader_result_32.txt ${CMAKE_CURRENT_BINARY_DIR}/alphaoffreader_for_doc_32.txt) set_tests_properties(Alpha_complex_example_fast_from_off_32_diff_files PROPERTIES DEPENDS Alpha_complex_example_fast_from_off_32) -endif() + endif() + endif(NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.11.0) +if (NOT CGAL_VERSION VERSION_LESS 4.11.0) add_executable ( Alpha_complex_example_weighted_3d_from_points Weighted_alpha_complex_3d_from_points.cpp ) target_link_libraries(Alpha_complex_example_weighted_3d_from_points ${CGAL_LIBRARY}) if (TBB_FOUND) @@ -61,4 +63,4 @@ endif() add_test(NAME Alpha_complex_example_3d_from_points COMMAND $) -endif(NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.11.0) +endif(NOT CGAL_VERSION VERSION_LESS 4.11.0) diff --git a/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h b/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h index 2c1b97a4..622b10ee 100644 --- a/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h +++ b/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h @@ -38,8 +38,6 @@ #include #include // for CGAL_VERSION_NR -#include // for EIGEN_VERSION_AT_LEAST - #include #include diff --git a/src/Alpha_complex/test/CMakeLists.txt b/src/Alpha_complex/test/CMakeLists.txt index fe4b23e4..f38bd096 100644 --- a/src/Alpha_complex/test/CMakeLists.txt +++ b/src/Alpha_complex/test/CMakeLists.txt @@ -18,6 +18,10 @@ if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.11.0) gudhi_add_boost_test(Alpha_complex_test_unit) gudhi_add_boost_test(Delaunay_complex_test_unit) +endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.11.0) + +if (NOT CGAL_VERSION VERSION_LESS 4.11.0) + add_executable ( Alpha_complex_3d_test_unit Alpha_complex_3d_unit_test.cpp ) target_link_libraries(Alpha_complex_3d_test_unit ${CGAL_LIBRARY}) add_executable ( Weighted_alpha_complex_3d_test_unit Weighted_alpha_complex_3d_unit_test.cpp ) @@ -38,4 +42,4 @@ if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.11.0) gudhi_add_boost_test(Periodic_alpha_complex_3d_test_unit) gudhi_add_boost_test(Weighted_periodic_alpha_complex_3d_test_unit) -endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.11.0) +endif (NOT CGAL_VERSION VERSION_LESS 4.11.0) diff --git a/src/Alpha_complex/utilities/CMakeLists.txt b/src/Alpha_complex/utilities/CMakeLists.txt index 2ffbdde0..f0ddfc2c 100644 --- a/src/Alpha_complex/utilities/CMakeLists.txt +++ b/src/Alpha_complex/utilities/CMakeLists.txt @@ -27,7 +27,9 @@ if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.11.0) endif() install(TARGETS alpha_complex_persistence DESTINATION bin) +endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.11.0) +if (NOT CGAL_VERSION VERSION_LESS 4.11.0) add_executable(alpha_complex_3d_persistence alpha_complex_3d_persistence.cpp) target_link_libraries(alpha_complex_3d_persistence ${CGAL_LIBRARY} Boost::program_options) if (TBB_FOUND) @@ -75,4 +77,4 @@ if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.11.0) install(TARGETS alpha_complex_3d_persistence DESTINATION bin) -endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.11.0) +endif (NOT CGAL_VERSION VERSION_LESS 4.11.0) diff --git a/src/Collapse/example/CMakeLists.txt b/src/Collapse/example/CMakeLists.txt index ba0e75e3..4456a844 100644 --- a/src/Collapse/example/CMakeLists.txt +++ b/src/Collapse/example/CMakeLists.txt @@ -1,23 +1,28 @@ project(Edge_collapse_examples) -# Point cloud -add_executable ( Edge_collapse_example_basic edge_collapse_basic_example.cpp ) -if (TBB_FOUND) - target_link_libraries(Edge_collapse_example_basic ${TBB_LIBRARIES}) -endif() +if (NOT EIGEN3_VERSION VERSION_LESS 3.1.0) -add_test(NAME Edge_collapse_example_basic COMMAND $) + # Point cloud + add_executable ( Edge_collapse_example_basic edge_collapse_basic_example.cpp ) + + if (TBB_FOUND) + target_link_libraries(Edge_collapse_example_basic ${TBB_LIBRARIES}) + endif() + + add_test(NAME Edge_collapse_example_basic COMMAND $) + + # Point cloud + add_executable ( Edge_collapse_conserve_persistence edge_collapse_conserve_persistence.cpp ) + + if (TBB_FOUND) + target_link_libraries(Edge_collapse_conserve_persistence ${TBB_LIBRARIES}) + endif() + + add_test(NAME Edge_collapse_conserve_persistence_1 COMMAND $ + "${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off" "0.2") + + add_test(NAME Edge_collapse_conserve_persistence_2 COMMAND $ + "${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off" "1.8") -# Point cloud -add_executable ( Edge_collapse_conserve_persistence edge_collapse_conserve_persistence.cpp ) - -if (TBB_FOUND) - target_link_libraries(Edge_collapse_conserve_persistence ${TBB_LIBRARIES}) -endif() - -add_test(NAME Edge_collapse_conserve_persistence_1 COMMAND $ - "${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off" "0.2") - -add_test(NAME Edge_collapse_conserve_persistence_2 COMMAND $ - "${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off" "1.8") +endif() \ No newline at end of file diff --git a/src/Collapse/include/gudhi/Flag_complex_edge_collapser.h b/src/Collapse/include/gudhi/Flag_complex_edge_collapser.h index b6b7f7c1..d3aead70 100644 --- a/src/Collapse/include/gudhi/Flag_complex_edge_collapser.h +++ b/src/Collapse/include/gudhi/Flag_complex_edge_collapser.h @@ -18,6 +18,7 @@ #include #include +#include // for EIGEN_VERSION_AT_LEAST #ifdef GUDHI_USE_TBB #include @@ -34,6 +35,11 @@ #include // for std::inserter #include // for std::decay +// Make compilation fail - required for external projects - https://github.com/GUDHI/gudhi-devel/issues/10 +#if !EIGEN_VERSION_AT_LEAST(3,1,0) +# error Alpha_complex is only available for Eigen3 >= 3.1.0 installed with CGAL +#endif + namespace Gudhi { namespace collapse { diff --git a/src/Collapse/test/CMakeLists.txt b/src/Collapse/test/CMakeLists.txt index c7eafb46..c04199e2 100644 --- a/src/Collapse/test/CMakeLists.txt +++ b/src/Collapse/test/CMakeLists.txt @@ -1,9 +1,13 @@ project(Collapse_tests) -include(GUDHI_boost_test) +if (NOT EIGEN3_VERSION VERSION_LESS 3.1.0) -add_executable ( Collapse_test_unit collapse_unit_test.cpp ) -if (TBB_FOUND) - target_link_libraries(Collapse_test_unit ${TBB_LIBRARIES}) -endif() -gudhi_add_boost_test(Collapse_test_unit) + include(GUDHI_boost_test) + + add_executable ( Collapse_test_unit collapse_unit_test.cpp ) + if (TBB_FOUND) + target_link_libraries(Collapse_test_unit ${TBB_LIBRARIES}) + endif() + gudhi_add_boost_test(Collapse_test_unit) + +endif() \ No newline at end of file diff --git a/src/Collapse/utilities/CMakeLists.txt b/src/Collapse/utilities/CMakeLists.txt index c742144b..97fef649 100644 --- a/src/Collapse/utilities/CMakeLists.txt +++ b/src/Collapse/utilities/CMakeLists.txt @@ -1,33 +1,37 @@ project(Collapse_utilities) -# From a point cloud -add_executable ( point_cloud_edge_collapse_rips_persistence point_cloud_edge_collapse_rips_persistence.cpp ) -target_link_libraries(point_cloud_edge_collapse_rips_persistence Boost::program_options) - -if (TBB_FOUND) - target_link_libraries(point_cloud_edge_collapse_rips_persistence ${TBB_LIBRARIES}) -endif() -add_test(NAME Edge_collapse_utilities_point_cloud_rips_persistence COMMAND $ - "${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off" "-r" "0.25" "-m" "0.5" "-d" "3" "-p" "3" "-o" "off_results.pers") - -install(TARGETS point_cloud_edge_collapse_rips_persistence DESTINATION bin) - -# From a distance matrix -add_executable ( distance_matrix_edge_collapse_rips_persistence distance_matrix_edge_collapse_rips_persistence.cpp ) -target_link_libraries(distance_matrix_edge_collapse_rips_persistence Boost::program_options) - -if (TBB_FOUND) - target_link_libraries(distance_matrix_edge_collapse_rips_persistence ${TBB_LIBRARIES}) -endif() -add_test(NAME Edge_collapse_utilities_distance_matrix_rips_persistence COMMAND $ - "${CMAKE_SOURCE_DIR}/data/distance_matrix/tore3D_1307_distance_matrix.csv" "-r" "0.25" "-m" "0.5" "-d" "3" "-p" "3" "-o" "csv_results.pers") - -install(TARGETS distance_matrix_edge_collapse_rips_persistence DESTINATION bin) - -if (DIFF_PATH) - add_test(Edge_collapse_utilities_diff_persistence ${DIFF_PATH} - "off_results.pers" "csv_results.pers") - set_tests_properties(Edge_collapse_utilities_diff_persistence PROPERTIES DEPENDS - "Edge_collapse_utilities_point_cloud_rips_persistence;Edge_collapse_utilities_distance_matrix_rips_persistence") - -endif() +if (NOT EIGEN3_VERSION VERSION_LESS 3.1.0) + + # From a point cloud + add_executable ( point_cloud_edge_collapse_rips_persistence point_cloud_edge_collapse_rips_persistence.cpp ) + target_link_libraries(point_cloud_edge_collapse_rips_persistence Boost::program_options) + + if (TBB_FOUND) + target_link_libraries(point_cloud_edge_collapse_rips_persistence ${TBB_LIBRARIES}) + endif() + add_test(NAME Edge_collapse_utilities_point_cloud_rips_persistence COMMAND $ + "${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off" "-r" "0.25" "-m" "0.5" "-d" "3" "-p" "3" "-o" "off_results.pers") + + install(TARGETS point_cloud_edge_collapse_rips_persistence DESTINATION bin) + + # From a distance matrix + add_executable ( distance_matrix_edge_collapse_rips_persistence distance_matrix_edge_collapse_rips_persistence.cpp ) + target_link_libraries(distance_matrix_edge_collapse_rips_persistence Boost::program_options) + + if (TBB_FOUND) + target_link_libraries(distance_matrix_edge_collapse_rips_persistence ${TBB_LIBRARIES}) + endif() + add_test(NAME Edge_collapse_utilities_distance_matrix_rips_persistence COMMAND $ + "${CMAKE_SOURCE_DIR}/data/distance_matrix/tore3D_1307_distance_matrix.csv" "-r" "0.25" "-m" "0.5" "-d" "3" "-p" "3" "-o" "csv_results.pers") + + install(TARGETS distance_matrix_edge_collapse_rips_persistence DESTINATION bin) + + if (DIFF_PATH) + add_test(Edge_collapse_utilities_diff_persistence ${DIFF_PATH} + "off_results.pers" "csv_results.pers") + set_tests_properties(Edge_collapse_utilities_diff_persistence PROPERTIES DEPENDS + "Edge_collapse_utilities_point_cloud_rips_persistence;Edge_collapse_utilities_distance_matrix_rips_persistence") + + endif() + +endif() \ No newline at end of file -- cgit v1.2.3