-- cgit v1.2.3 From 22a90cae3ce7ca63ca712a74281410e61e829dd2 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Thu, 14 Jan 2016 14:31:08 +0000 Subject: AddressSanitizer bug fixes on Simplex tree copy constructor. debug_tree function git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/ST_insert_with_subfaces_fix@967 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: dd4b15dc8f2a4795d3a0b6fdcf4938aff152906b --- src/Simplex_tree/include/gudhi/Simplex_tree.h | 42 +++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/src/Simplex_tree/include/gudhi/Simplex_tree.h b/src/Simplex_tree/include/gudhi/Simplex_tree.h index 708cdef9..0a406076 100644 --- a/src/Simplex_tree/include/gudhi/Simplex_tree.h +++ b/src/Simplex_tree/include/gudhi/Simplex_tree.h @@ -325,11 +325,10 @@ class Simplex_tree { Simplex_tree(const Simplex_tree& simplex_source) : null_vertex_(simplex_source.null_vertex_), threshold_(simplex_source.threshold_), + root_(nullptr, null_vertex_ , simplex_source.root_.members_), filtration_vect_(), dimension_(simplex_source.dimension_) { auto root_source = simplex_source.root_; - auto memb_source = root_source.members(); - root_ = Siblings(nullptr, null_vertex_, memb_source); rec_copy(&root_, &root_source); } @@ -341,7 +340,7 @@ class Simplex_tree { Siblings * newsib = new Siblings(sib, sh_source->first); newsib->members_.reserve(sh_source->second.children()->members().size()); for (auto & child : sh_source->second.children()->members()) - newsib->members_.emplace_hint(newsib->members_.end(), child.first, Node(sib, child.second.filtration())); + newsib->members_.emplace_hint(newsib->members_.end(), child.first, Node(newsib, child.second.filtration())); rec_copy(newsib, sh_source->second.children()); sh->second.assign_children(newsib); } @@ -1105,6 +1104,43 @@ class Simplex_tree { os << filtration(sh) << " \n"; } } +/***************************************************************************************************************/ + public: + /** \brief Prints the simplex_tree hierarchically. + * Since it prints the vertices recursively, one can watch its tree shape. + */ + void debug_tree() { + std::cout << "{" << &root_ << "} -------------------------------------------------------------------" << std::endl; + for (auto sh = root_.members().begin(); sh != root_.members().end(); ++sh) { + std::cout << sh->first << " [" << sh->second.filtration() << "] "; + if (has_children(sh)) { + rec_debug_tree(sh->second.children()); + } else { + std::cout << " {- " << sh->second.children() << "} "; + } + std::cout << std::endl; + } + std::cout << "--------------------------------------------------------------------------------------" << std::endl; + } + + + /** \brief Recursively prints the simplex_tree, using depth first search. */ + private: + void rec_debug_tree(Siblings * sib) { + std::cout << " {" << sib << "} ("; + for (auto sh = sib->members().begin(); sh != sib->members().end(); ++sh) { + std::cout << " " << sh->first << " [" << sh->second.filtration() << "] "; + if (has_children(sh)) { + rec_debug_tree(sh->second.children()); + } else { + std::cout << " {- " << sh->second.children() << "} "; + } + } + std::cout << ")"; + } + +/*****************************************************************************************************************/ + private: Vertex_handle null_vertex_; -- cgit v1.2.3 -- cgit v1.2.3 From fe888c497547561dd749d3bf805ae275ca0a1629 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Tue, 19 Jan 2016 13:49:22 +0000 Subject: Remove all but Simplex tree test and example for tests suite to be fatser git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/Win64_Boost_Xunit_fix@976 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 97de76828552676ecf33cc8d47bc3a85a5e66253 --- CMakeLists.txt | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index edf7e63f..577ba6bb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,27 +65,27 @@ else() message(STATUS "boost library dirs:" ${Boost_LIBRARY_DIRS}) include_directories(src/common/include/) - include_directories(src/Bottleneck/include/) - include_directories(src/Contraction/include/) - include_directories(src/Hasse_complex/include/) - include_directories(src/Persistent_cohomology/include/) +# include_directories(src/Bottleneck/include/) +# include_directories(src/Contraction/include/) +# include_directories(src/Hasse_complex/include/) +# include_directories(src/Persistent_cohomology/include/) include_directories(src/Simplex_tree/include/) - include_directories(src/Skeleton_blocker/include/) +# include_directories(src/Skeleton_blocker/include/) add_subdirectory(src/Simplex_tree/test) add_subdirectory(src/Simplex_tree/example) - add_subdirectory(src/Persistent_cohomology/test) - add_subdirectory(src/Persistent_cohomology/example) - add_subdirectory(src/Skeleton_blocker/test) - add_subdirectory(src/Skeleton_blocker/example) - add_subdirectory(src/Contraction/example) +# add_subdirectory(src/Persistent_cohomology/test) +# add_subdirectory(src/Persistent_cohomology/example) +# add_subdirectory(src/Skeleton_blocker/test) +# add_subdirectory(src/Skeleton_blocker/example) +# add_subdirectory(src/Contraction/example) # data points generator - add_subdirectory(data/points/generator) +# add_subdirectory(data/points/generator) # Please let GudhUI in last compilation position as QT is known to modify CMAKE_CXX_FLAGS # GudhUI - add_subdirectory(src/GudhUI) +# add_subdirectory(src/GudhUI) endif() -- cgit v1.2.3 From 3b3ceceb624d48775ceb28ab455f0f547df9e6c4 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Tue, 19 Jan 2016 14:00:27 +0000 Subject: Try different values for xUnit git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/Win64_Boost_Xunit_fix@977 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: b3e39a4858a4be139236be0a87619164a35ea7c0 --- src/Simplex_tree/test/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Simplex_tree/test/CMakeLists.txt b/src/Simplex_tree/test/CMakeLists.txt index c9eae163..b1256768 100644 --- a/src/Simplex_tree/test/CMakeLists.txt +++ b/src/Simplex_tree/test/CMakeLists.txt @@ -24,5 +24,5 @@ file(COPY "simplex_tree_for_unit_test.txt" DESTINATION ${CMAKE_CURRENT_BINARY_DI add_test(NAME SimplexTreeUT COMMAND ${CMAKE_CURRENT_BINARY_DIR}/SimplexTreeUT # XML format for Jenkins xUnit plugin - --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/SimplexTreeUT.xml --log_level=test_suite --report_level=no) + --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/SimplexTreeUT.xml --log_level=all --report_level=no) -- cgit v1.2.3 From f4ac13983d5d977cab5c575184e9b21ee000485f Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Tue, 19 Jan 2016 15:07:56 +0000 Subject: rollback git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/Win64_Boost_Xunit_fix@978 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 6aeb45f999861185cda0d0961f22b4a08b413927 --- src/Simplex_tree/test/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Simplex_tree/test/CMakeLists.txt b/src/Simplex_tree/test/CMakeLists.txt index b1256768..c9eae163 100644 --- a/src/Simplex_tree/test/CMakeLists.txt +++ b/src/Simplex_tree/test/CMakeLists.txt @@ -24,5 +24,5 @@ file(COPY "simplex_tree_for_unit_test.txt" DESTINATION ${CMAKE_CURRENT_BINARY_DI add_test(NAME SimplexTreeUT COMMAND ${CMAKE_CURRENT_BINARY_DIR}/SimplexTreeUT # XML format for Jenkins xUnit plugin - --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/SimplexTreeUT.xml --log_level=all --report_level=no) + --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/SimplexTreeUT.xml --log_level=test_suite --report_level=no) -- cgit v1.2.3 From 98bb425ef8c401b2eb8d161393c389b5cf6070c8 Mon Sep 17 00:00:00 2001 From: salinasd Date: Sun, 31 Jan 2016 14:56:30 +0000 Subject: remove creation of useless visitor for test that were just used for display git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/ST_insert_with_subfaces_fix@990 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 13b3baec7f449d1d74cfaca2211571b468be1486 --- src/Skeleton_blocker/test/TestSkeletonBlockerComplex.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Skeleton_blocker/test/TestSkeletonBlockerComplex.cpp b/src/Skeleton_blocker/test/TestSkeletonBlockerComplex.cpp index 42482e23..71b1833b 100644 --- a/src/Skeleton_blocker/test/TestSkeletonBlockerComplex.cpp +++ b/src/Skeleton_blocker/test/TestSkeletonBlockerComplex.cpp @@ -601,7 +601,7 @@ bool test_link4() { } bool test_link5() { - Complex complex(0, new Print_complex_visitor()); + Complex complex(0); // Build the complexes build_complete(4, complex); complex.add_blocker(Simplex(Vertex_handle(0), Vertex_handle(1), Vertex_handle(2), Vertex_handle(3))); @@ -621,7 +621,7 @@ bool test_link5() { } bool test_link6() { - Complex complex(0, new Print_complex_visitor()); + Complex complex(0); // Build the complexes build_complete(4, complex); complex.add_blocker(Simplex(Vertex_handle(0), Vertex_handle(1), Vertex_handle(2))); @@ -642,7 +642,7 @@ bool test_link6() { } bool test_link7() { - Complex complex(0, new Print_complex_visitor()); + Complex complex(0); // Build the complexes build_complete(6, complex); complex.add_vertex(); -- cgit v1.2.3 From d15e4b04a8b333d0adc09e321241a6a5daa9b94a Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Thu, 4 Feb 2016 12:17:04 +0000 Subject: test with include CGAL_USE_FILE to fix windows issue git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/Win64_Boost_Xunit_fix@1000 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 11a5fb78933306cfc83951174b38a03837fef58a --- src/Simplex_tree/example/CMakeLists.txt | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/src/Simplex_tree/example/CMakeLists.txt b/src/Simplex_tree/example/CMakeLists.txt index c70cfe35..de75415d 100644 --- a/src/Simplex_tree/example/CMakeLists.txt +++ b/src/Simplex_tree/example/CMakeLists.txt @@ -14,11 +14,24 @@ add_test(mini_simplex_tree ${CMAKE_CURRENT_BINARY_DIR}/mini_simplex_tree) # An example with Simplex-tree using CGAL alpha_shapes_3 if(GMP_FOUND AND CGAL_FOUND) - message("CGAL_lib = ${CGAL_LIBRARIES_DIR}") - message("GMP_LIBRARIES = ${GMP_LIBRARIES}") - INCLUDE_DIRECTORIES(${GMP_INCLUDE_DIR}) - INCLUDE_DIRECTORIES(${CGAL_INCLUDE_DIRS}) - add_executable ( simplex_tree_from_alpha_shapes_3 simplex_tree_from_alpha_shapes_3.cpp ) - target_link_libraries(simplex_tree_from_alpha_shapes_3 ${GMP_LIBRARIES} ${CGAL_LIBRARY}) - add_test(simplex_tree_from_alpha_shapes_3 ${CMAKE_CURRENT_BINARY_DIR}/simplex_tree_from_alpha_shapes_3 ${CMAKE_SOURCE_DIR}/data/points/bunny_5000) + include( ${CGAL_USE_FILE} ) + # In CMakeLists.txt, when include(${CGAL_USE_FILE}), CXX_FLAGS are overwritten. + # cf. http://doc.cgal.org/latest/Manual/installation.html#title40 + # A workaround is to add "-std=c++11" again. + # 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. + if(NOT MSVC) + include(CheckCXXCompilerFlag) + CHECK_CXX_COMPILER_FLAG(-std=c++11 COMPILER_SUPPORTS_CXX11) + if(COMPILER_SUPPORTS_CXX11) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + endif() + endif() + # - End of workaround + + INCLUDE_DIRECTORIES(${GMP_INCLUDE_DIR}) + add_executable ( simplex_tree_from_alpha_shapes_3 simplex_tree_from_alpha_shapes_3.cpp ) + target_link_libraries(simplex_tree_from_alpha_shapes_3 ${GMP_LIBRARIES} ${CGAL_LIBRARY}) + add_test(simplex_tree_from_alpha_shapes_3 ${CMAKE_CURRENT_BINARY_DIR}/simplex_tree_from_alpha_shapes_3 ${CMAKE_SOURCE_DIR}/data/points/bunny_5000) endif() -- cgit v1.2.3 From 6892c6dbcf1eeaa27825d416503413a74808b625 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Thu, 4 Feb 2016 12:44:23 +0000 Subject: requires boost also git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/Win64_Boost_Xunit_fix@1001 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: aca5ee1d5587d2e613691a539bb166ac592c137c --- src/Simplex_tree/example/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Simplex_tree/example/CMakeLists.txt b/src/Simplex_tree/example/CMakeLists.txt index de75415d..a86b99a1 100644 --- a/src/Simplex_tree/example/CMakeLists.txt +++ b/src/Simplex_tree/example/CMakeLists.txt @@ -32,6 +32,6 @@ if(GMP_FOUND AND CGAL_FOUND) INCLUDE_DIRECTORIES(${GMP_INCLUDE_DIR}) add_executable ( simplex_tree_from_alpha_shapes_3 simplex_tree_from_alpha_shapes_3.cpp ) - target_link_libraries(simplex_tree_from_alpha_shapes_3 ${GMP_LIBRARIES} ${CGAL_LIBRARY}) + target_link_libraries(simplex_tree_from_alpha_shapes_3 ${GMP_LIBRARIES} ${CGAL_LIBRARY} ${Boost_SYSTEM_LIBRARY}) add_test(simplex_tree_from_alpha_shapes_3 ${CMAKE_CURRENT_BINARY_DIR}/simplex_tree_from_alpha_shapes_3 ${CMAKE_SOURCE_DIR}/data/points/bunny_5000) endif() -- cgit v1.2.3 From b83c3869618d3697eb476bd6942076ff7aedafe4 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Thu, 4 Feb 2016 12:55:21 +0000 Subject: roll back of main CMakeLists.txt git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/Win64_Boost_Xunit_fix@1002 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 6d35cce4cabe0afdb9bcabb23d8bbe6d63b6480e --- CMakeLists.txt | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 577ba6bb..edf7e63f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,27 +65,27 @@ else() message(STATUS "boost library dirs:" ${Boost_LIBRARY_DIRS}) include_directories(src/common/include/) -# include_directories(src/Bottleneck/include/) -# include_directories(src/Contraction/include/) -# include_directories(src/Hasse_complex/include/) -# include_directories(src/Persistent_cohomology/include/) + include_directories(src/Bottleneck/include/) + include_directories(src/Contraction/include/) + include_directories(src/Hasse_complex/include/) + include_directories(src/Persistent_cohomology/include/) include_directories(src/Simplex_tree/include/) -# include_directories(src/Skeleton_blocker/include/) + include_directories(src/Skeleton_blocker/include/) add_subdirectory(src/Simplex_tree/test) add_subdirectory(src/Simplex_tree/example) -# add_subdirectory(src/Persistent_cohomology/test) -# add_subdirectory(src/Persistent_cohomology/example) -# add_subdirectory(src/Skeleton_blocker/test) -# add_subdirectory(src/Skeleton_blocker/example) -# add_subdirectory(src/Contraction/example) + add_subdirectory(src/Persistent_cohomology/test) + add_subdirectory(src/Persistent_cohomology/example) + add_subdirectory(src/Skeleton_blocker/test) + add_subdirectory(src/Skeleton_blocker/example) + add_subdirectory(src/Contraction/example) # data points generator -# add_subdirectory(data/points/generator) + add_subdirectory(data/points/generator) # Please let GudhUI in last compilation position as QT is known to modify CMAKE_CXX_FLAGS # GudhUI -# add_subdirectory(src/GudhUI) + add_subdirectory(src/GudhUI) endif() -- cgit v1.2.3 From c85b24f7e0c489093e0c5ccca934eb53fafab623 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Thu, 4 Feb 2016 16:11:42 +0000 Subject: CMake strategy modification git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/Win64_Boost_Xunit_fix@1003 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: c917934525e020b54b2f4506b5c9d060a28c9d89 --- CMakeLists.txt | 105 +++++++++++++++----------- data/points/generator/CMakeLists.txt | 16 ---- src/Bottleneck/test/CMakeLists.txt | 4 - src/CMakeLists.txt | 67 ++++++++++------ src/GudhUI/CMakeLists.txt | 20 ----- src/Persistent_cohomology/test/CMakeLists.txt | 4 - src/Simplex_tree/example/CMakeLists.txt | 17 ----- src/Simplex_tree/test/CMakeLists.txt | 4 - src/Skeleton_blocker/test/CMakeLists.txt | 4 - 9 files changed, 105 insertions(+), 136 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index edf7e63f..8ced7b0d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,52 +7,71 @@ configure_file(GUDHIVersion.cmake.in "${PROJECT_BINARY_DIR}/GUDHIVersion.cmake" find_package(Boost REQUIRED COMPONENTS system filesystem unit_test_framework chrono timer program_options thread REQUIRED) -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}") - -enable_testing() - -if(MSVC) - # Turn off some VC++ warnings - SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267 /wd4668 /wd4311 /wd4800 /wd4820 /wd4503 /wd4244 /wd4345 /wd4996 /wd4396 /wd4018") -else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -std=c++11 -Wall -Wpedantic -Wsign-compare") - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -ggdb -O0") - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") -endif() - -set(Boost_USE_STATIC_LIBS ON) -set(Boost_USE_MULTITHREADED ON) -set(Boost_USE_STATIC_RUNTIME OFF) - -find_package(GMP) -if(GMP_FOUND) - find_package(GMPXX) -endif() - -find_package(CGAL) - -# Find TBB package for parallel sort - not mandatory, just optional. -set(TBB_FIND_QUIETLY ON) -find_package(TBB) - -# Required programs for unitary tests purpose -FIND_PROGRAM( GCOVR_PATH gcovr ) -if (GCOVR_PATH) - message("gcovr found in ${GCOVR_PATH}") -endif() -# Required programs for unitary tests purpose -FIND_PROGRAM( GPROF_PATH gprof ) -if (GPROF_PATH) - message("gprof found in ${GPROF_PATH}") -endif() - - if(NOT Boost_FOUND) message(FATAL_ERROR "NOTICE: This demo requires Boost and will not be compiled.") else() + + 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}") + + enable_testing() + + find_package(GMP) + if(GMP_FOUND) + INCLUDE_DIRECTORIES(${GMP_INCLUDE_DIR}) + find_package(GMPXX) + if(GMPXX_FOUND) + INCLUDE_DIRECTORIES(${GMPXX_INCLUDE_DIR}) + endif() + endif() + + # find CGAL package before set of CXX flags because + # in CMakeLists.txt, when include(${CGAL_USE_FILE}), CXX_FLAGS are overwritten. + # cf. http://doc.cgal.org/latest/Manual/installation.html#title40 + set(CGAL_DONT_OVERRIDE_CMAKE_FLAGS TRUE CACHE BOOL "Force CGAL to maintain CMAKE flags") + find_package(CGAL) + if(CGAL_FOUND) + include( ${CGAL_USE_FILE} ) + set(CMAKE_CXX_CGAL_FOR_GUDHI_FLAGS "-frounding-math") + endif() + + if(MSVC) + # Turn off some VC++ warnings + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267 /wd4668 /wd4311 /wd4800 /wd4820 /wd4503 /wd4244 /wd4345 /wd4996 /wd4396 /wd4018") + else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wpedantic -Wsign-compare ${CMAKE_CXX_CGAL_FOR_GUDHI_FLAGS}") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -ggdb -O0") + # set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") + endif() + + if(CMAKE_BUILD_TYPE MATCHES Debug) + message("Compilation flags are: ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG}") + else() + message("Compilation flags are: ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE}") + endif() + + set(Boost_USE_STATIC_LIBS ON) + set(Boost_USE_MULTITHREADED ON) + set(Boost_USE_STATIC_RUNTIME OFF) + + # Find TBB package for parallel sort - not mandatory, just optional. + set(TBB_FIND_QUIETLY ON) + find_package(TBB) + + # Required programs for unitary tests purpose + FIND_PROGRAM( GCOVR_PATH gcovr ) + if (GCOVR_PATH) + message("gcovr found in ${GCOVR_PATH}") + endif() + # Required programs for unitary tests purpose + FIND_PROGRAM( GPROF_PATH gprof ) + if (GPROF_PATH) + message("gprof found in ${GPROF_PATH}") + endif() + + # BOOST ISSUE result_of vs C++11 add_definitions(-DBOOST_RESULT_OF_USE_DECLTYPE) # BOOST ISSUE with Libraries name resolution under Windows diff --git a/data/points/generator/CMakeLists.txt b/data/points/generator/CMakeLists.txt index 26b44446..c01a380d 100644 --- a/data/points/generator/CMakeLists.txt +++ b/data/points/generator/CMakeLists.txt @@ -5,22 +5,6 @@ if(CGAL_FOUND) if (NOT CGAL_VERSION VERSION_LESS 4.6.0) message(STATUS "CGAL version: ${CGAL_VERSION}.") - include( ${CGAL_USE_FILE} ) - # In CMakeLists.txt, when include(${CGAL_USE_FILE}), CXX_FLAGS are overwritten. - # cf. http://doc.cgal.org/latest/Manual/installation.html#title40 - # A workaround is to add "-std=c++11" again. - # 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. - if(NOT MSVC) - include(CheckCXXCompilerFlag) - CHECK_CXX_COMPILER_FLAG(-std=c++11 COMPILER_SUPPORTS_CXX11) - if(COMPILER_SUPPORTS_CXX11) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") - endif() - endif() - # - End of workaround - find_package(Eigen3 3.1.0) if (EIGEN3_FOUND) include( ${EIGEN3_USE_FILE} ) diff --git a/src/Bottleneck/test/CMakeLists.txt b/src/Bottleneck/test/CMakeLists.txt index 3dfd80cd..ad63c080 100644 --- a/src/Bottleneck/test/CMakeLists.txt +++ b/src/Bottleneck/test/CMakeLists.txt @@ -4,14 +4,10 @@ project(GUDHIBottleneckUT) if (GCOVR_PATH) # for gcovr to make coverage reports - Corbera Jenkins plugin set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage") - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fprofile-arcs -ftest-coverage") - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fprofile-arcs -ftest-coverage") endif() if (GPROF_PATH) # for gprof to make coverage reports - Jenkins set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg") - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -pg") - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -pg") endif() add_executable ( BottleneckUT bottleneck_unit_test.cpp ) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3c38483c..a67e7c92 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -9,33 +9,52 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules/") find_package(Boost REQUIRED COMPONENTS system filesystem program_options chrono timer REQUIRED) -if (NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE "Release") -endif() -if(MSVC) - SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267 /wd4668 /wd4311 /wd4800 /wd4820 /wd4503 /wd4244 /wd4345 /wd4996 /wd4396 /wd4018") -else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -endif() - -set(Boost_USE_STATIC_LIBS ON) -set(Boost_USE_MULTITHREADED ON) -set(Boost_USE_STATIC_RUNTIME OFF) - -find_package(GMP) -if(GMP_FOUND) - find_package(GMPXX) -endif() - -find_package(CGAL) - -# Find TBB package for parallel sort - not mandatory, just optional. -set(TBB_FIND_QUIETLY ON) -find_package(TBB) - if(NOT Boost_FOUND) message(FATAL_ERROR "NOTICE: This demo requires Boost and will not be compiled.") else() + + find_package(GMP) + if(GMP_FOUND) + INCLUDE_DIRECTORIES(${GMP_INCLUDE_DIR}) + find_package(GMPXX) + if(GMPXX_FOUND) + INCLUDE_DIRECTORIES(${GMPXX_INCLUDE_DIR}) + endif() + endif() + + # find CGAL package before set of CXX flags because + # in CMakeLists.txt, when include(${CGAL_USE_FILE}), CXX_FLAGS are overwritten. + # cf. http://doc.cgal.org/latest/Manual/installation.html#title40 + set(CGAL_DONT_OVERRIDE_CMAKE_FLAGS TRUE CACHE BOOL "Force CGAL to maintain CMAKE flags") + find_package(CGAL) + if(CGAL_FOUND) + include( ${CGAL_USE_FILE} ) + set(CMAKE_CXX_CGAL_FOR_GUDHI_FLAGS "-frounding-math") + endif() + + if (NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE "Release") + endif() + if(MSVC) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267 /wd4668 /wd4311 /wd4800 /wd4820 /wd4503 /wd4244 /wd4345 /wd4996 /wd4396 /wd4018") + else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 ${CMAKE_CXX_CGAL_FOR_GUDHI_FLAGS}") + endif() + + if(CMAKE_BUILD_TYPE MATCHES Debug) + message("Compilation flags are: ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG}") + else() + message("Compilation flags are: ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE}") + endif() + + set(Boost_USE_STATIC_LIBS ON) + set(Boost_USE_MULTITHREADED ON) + set(Boost_USE_STATIC_RUNTIME OFF) + + # Find TBB package for parallel sort - not mandatory, just optional. + set(TBB_FIND_QUIETLY ON) + find_package(TBB) + # BOOST ISSUE result_of vs C++11 add_definitions(-DBOOST_RESULT_OF_USE_DECLTYPE) # BOOST ISSUE with Libraries name resolution under Windows diff --git a/src/GudhUI/CMakeLists.txt b/src/GudhUI/CMakeLists.txt index 71f4fd1a..1ee43d91 100644 --- a/src/GudhUI/CMakeLists.txt +++ b/src/GudhUI/CMakeLists.txt @@ -1,7 +1,6 @@ cmake_minimum_required(VERSION 2.8) project(GudhUI) -find_package(CGAL COMPONENTS Qt4) find_package(Qt4) find_package(QGLViewer) find_package(OpenGL) @@ -14,27 +13,8 @@ if ( CGAL_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND ) SET(Boost_USE_STATIC_LIBS ON) SET(Boost_USE_MULTITHREAD OFF) - INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) - LINK_DIRECTORIES(${Boost_LIBRARY_DIRS}) - include(${QT_USE_FILE}) - include(${CGAL_USE_FILE}) - # In CMakeLists.txt, when include(${CGAL_USE_FILE}), CXX_FLAGS are overwritten. - # cf. http://doc.cgal.org/latest/Manual/installation.html#title40 - # A workaround is to add "-std=c++11" again. - # 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. - if(NOT MSVC) - include(CheckCXXCompilerFlag) - CHECK_CXX_COMPILER_FLAG(-std=c++11 COMPILER_SUPPORTS_CXX11) - if(COMPILER_SUPPORTS_CXX11) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") - endif() - endif() - # - End of workaround - include_directories (${QGLVIEWER_INCLUDE_DIR}) include_directories(.) diff --git a/src/Persistent_cohomology/test/CMakeLists.txt b/src/Persistent_cohomology/test/CMakeLists.txt index ed63a6ac..d16be5be 100644 --- a/src/Persistent_cohomology/test/CMakeLists.txt +++ b/src/Persistent_cohomology/test/CMakeLists.txt @@ -4,14 +4,10 @@ project(GUDHIPersistentCohomologyUT) if (GCOVR_PATH) # for gcovr to make coverage reports - Corbera Jenkins plugin set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage") - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fprofile-arcs -ftest-coverage") - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fprofile-arcs -ftest-coverage") endif() if (GPROF_PATH) # for gprof to make coverage reports - Jenkins set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg") - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -pg") - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -pg") endif() add_executable ( PersistentCohomologyUT persistent_cohomology_unit_test.cpp ) diff --git a/src/Simplex_tree/example/CMakeLists.txt b/src/Simplex_tree/example/CMakeLists.txt index a86b99a1..200161a6 100644 --- a/src/Simplex_tree/example/CMakeLists.txt +++ b/src/Simplex_tree/example/CMakeLists.txt @@ -14,23 +14,6 @@ add_test(mini_simplex_tree ${CMAKE_CURRENT_BINARY_DIR}/mini_simplex_tree) # An example with Simplex-tree using CGAL alpha_shapes_3 if(GMP_FOUND AND CGAL_FOUND) - include( ${CGAL_USE_FILE} ) - # In CMakeLists.txt, when include(${CGAL_USE_FILE}), CXX_FLAGS are overwritten. - # cf. http://doc.cgal.org/latest/Manual/installation.html#title40 - # A workaround is to add "-std=c++11" again. - # 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. - if(NOT MSVC) - include(CheckCXXCompilerFlag) - CHECK_CXX_COMPILER_FLAG(-std=c++11 COMPILER_SUPPORTS_CXX11) - if(COMPILER_SUPPORTS_CXX11) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") - endif() - endif() - # - End of workaround - - INCLUDE_DIRECTORIES(${GMP_INCLUDE_DIR}) add_executable ( simplex_tree_from_alpha_shapes_3 simplex_tree_from_alpha_shapes_3.cpp ) target_link_libraries(simplex_tree_from_alpha_shapes_3 ${GMP_LIBRARIES} ${CGAL_LIBRARY} ${Boost_SYSTEM_LIBRARY}) add_test(simplex_tree_from_alpha_shapes_3 ${CMAKE_CURRENT_BINARY_DIR}/simplex_tree_from_alpha_shapes_3 ${CMAKE_SOURCE_DIR}/data/points/bunny_5000) diff --git a/src/Simplex_tree/test/CMakeLists.txt b/src/Simplex_tree/test/CMakeLists.txt index c9eae163..1f2f7d33 100644 --- a/src/Simplex_tree/test/CMakeLists.txt +++ b/src/Simplex_tree/test/CMakeLists.txt @@ -4,14 +4,10 @@ project(GUDHISimplexTreeUT) if (GCOVR_PATH) # for gcovr to make coverage reports - Corbera Jenkins plugin set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage") - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fprofile-arcs -ftest-coverage") - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fprofile-arcs -ftest-coverage") endif() if (GPROF_PATH) # for gprof to make coverage reports - Jenkins set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg") - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -pg") - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -pg") endif() add_executable ( SimplexTreeUT simplex_tree_unit_test.cpp ) diff --git a/src/Skeleton_blocker/test/CMakeLists.txt b/src/Skeleton_blocker/test/CMakeLists.txt index 8b6fb672..5e063845 100644 --- a/src/Skeleton_blocker/test/CMakeLists.txt +++ b/src/Skeleton_blocker/test/CMakeLists.txt @@ -4,14 +4,10 @@ project(GUDHIskbl) if (GCOVR_PATH) # for gcovr to make coverage reports - Corbera Jenkins plugin set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage") - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fprofile-arcs -ftest-coverage") - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fprofile-arcs -ftest-coverage") endif() if (GPROF_PATH) # for gprof to make coverage reports - Jenkins set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg") - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -pg") - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -pg") endif() add_executable(TestSkeletonBlockerComplex TestSkeletonBlockerComplex.cpp) -- cgit v1.2.3 From abb3faa7088cd6e59f769f2f3b31ecd1b3b0fc0e Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Tue, 9 Feb 2016 15:54:58 +0000 Subject: Finally, let CGAL set the flags, but before setting CXX_FLAGS with "-std=c++11" git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/Win64_Boost_Xunit_fix@1011 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: faeca77f4eebf969e608b0c3be67893d646845a9 --- CMakeLists.txt | 17 ++++++++--------- src/CMakeLists.txt | 21 ++++++++++----------- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8ced7b0d..0ee142c0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,29 +27,28 @@ else() endif() endif() - # find CGAL package before set of CXX flags because - # in CMakeLists.txt, when include(${CGAL_USE_FILE}), CXX_FLAGS are overwritten. + # In CMakeLists.txt, when include(${CGAL_USE_FILE}), CMAKE_CXX_FLAGS are overwritten. # cf. http://doc.cgal.org/latest/Manual/installation.html#title40 - set(CGAL_DONT_OVERRIDE_CMAKE_FLAGS TRUE CACHE BOOL "Force CGAL to maintain CMAKE flags") + # 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) if(CGAL_FOUND) include( ${CGAL_USE_FILE} ) - set(CMAKE_CXX_CGAL_FOR_GUDHI_FLAGS "-frounding-math") endif() if(MSVC) # Turn off some VC++ warnings set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267 /wd4668 /wd4311 /wd4800 /wd4820 /wd4503 /wd4244 /wd4345 /wd4996 /wd4396 /wd4018") else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wpedantic -Wsign-compare ${CMAKE_CXX_CGAL_FOR_GUDHI_FLAGS}") - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -ggdb -O0") - # set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wpedantic -Wsign-compare") endif() if(CMAKE_BUILD_TYPE MATCHES Debug) - message("Compilation flags are: ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG}") + message("++ Debug compilation flags are: ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG}") else() - message("Compilation flags are: ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE}") + message("++ Release compilation flags are: ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE}") endif() set(Boost_USE_STATIC_LIBS ON) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a67e7c92..97d53306 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -22,29 +22,28 @@ else() endif() endif() - # find CGAL package before set of CXX flags because - # in CMakeLists.txt, when include(${CGAL_USE_FILE}), CXX_FLAGS are overwritten. + # In CMakeLists.txt, when include(${CGAL_USE_FILE}), CMAKE_CXX_FLAGS are overwritten. # cf. http://doc.cgal.org/latest/Manual/installation.html#title40 - set(CGAL_DONT_OVERRIDE_CMAKE_FLAGS TRUE CACHE BOOL "Force CGAL to maintain CMAKE flags") + # 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) if(CGAL_FOUND) include( ${CGAL_USE_FILE} ) - set(CMAKE_CXX_CGAL_FOR_GUDHI_FLAGS "-frounding-math") - endif() - - if (NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE "Release") endif() + if(MSVC) + # Turn off some VC++ warnings set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267 /wd4668 /wd4311 /wd4800 /wd4820 /wd4503 /wd4244 /wd4345 /wd4996 /wd4396 /wd4018") else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 ${CMAKE_CXX_CGAL_FOR_GUDHI_FLAGS}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wpedantic -Wsign-compare") endif() if(CMAKE_BUILD_TYPE MATCHES Debug) - message("Compilation flags are: ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG}") + message("++ Debug compilation flags are: ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG}") else() - message("Compilation flags are: ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE}") + message("++ Release compilation flags are: ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE}") endif() set(Boost_USE_STATIC_LIBS ON) -- cgit v1.2.3