-- cgit v1.2.3 From d6bb19de457fa74c84dbd6d8afa63074fefb4552 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Thu, 18 May 2017 08:47:16 +0000 Subject: Modify the way cmake handles utilities, examples, test and benchmarks with new options to activate/desactivate them. Move hypergenerator as a common utility. Move random point generation from hypergenerator in src/common/include/gudhi/random_point_generators.h git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/cmake_modules_for_gudhi@2442 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: e2d13e4b0c09455fb604b684f6d71530352271eb --- CMakeLists.txt | 76 +++------ data/points/generator/CMakeLists.txt | 15 -- data/points/generator/README | 29 ---- data/points/generator/hypergenerator.cpp | 133 --------------- src/CMakeLists.txt | 34 ++-- src/cmake/modules/GUDHI_modules.cmake | 43 +++++ src/cmake/modules/GUDHI_user_version_target.cmake | 90 ++++++++++ src/cmake/modules/GUDHI_user_version_target.txt | 91 ---------- src/common/include/gudhi/random_point_generators.h | 32 ++++ src/common/utilities/CMakeLists.txt | 15 ++ src/common/utilities/README | 19 +++ src/common/utilities/hypergenerator.cpp | 189 +++++++++++++++++++++ 12 files changed, 430 insertions(+), 336 deletions(-) delete mode 100644 data/points/generator/CMakeLists.txt delete mode 100644 data/points/generator/hypergenerator.cpp create mode 100644 src/cmake/modules/GUDHI_modules.cmake create mode 100644 src/cmake/modules/GUDHI_user_version_target.cmake delete mode 100644 src/cmake/modules/GUDHI_user_version_target.txt create mode 100644 src/common/utilities/CMakeLists.txt create mode 100644 src/common/utilities/README create mode 100644 src/common/utilities/hypergenerator.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 324f8648..360eb87a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,10 +10,6 @@ message("CMAKE_MODULE_PATH = ${CMAKE_MODULE_PATH}") enable_testing() -# For "make user_version" -include("${CMAKE_MODULE_PATH}/GUDHI_user_version_target.txt") -# For "make doxygen" -include(GUDHI_doxygen_target) # This variable is used by Cython CMakeLists.txt to know its path set(GUDHI_CYTHON_PATH "src/cython") # For third parties libraries management - To be done last as CGAL updates CMAKE_MODULE_PATH @@ -38,54 +34,34 @@ if (DEBUG_TRACES) add_definitions(-DDEBUG_TRACES) endif() -include_directories(src/common/include/) -include_directories(src/Alpha_complex/include/) -include_directories(src/Bitmap_cubical_complex/include/) -include_directories(src/Bottleneck_distance/include/) -include_directories(src/Contraction/include/) -include_directories(src/Hasse_complex/include/) -include_directories(src/Persistent_cohomology/include/) -include_directories(src/Rips_complex/include/) -include_directories(src/Simplex_tree/include/) -include_directories(src/Skeleton_blocker/include/) -include_directories(src/Spatial_searching/include/) -include_directories(src/Subsampling/include/) -include_directories(src/Tangential_complex/include/) -include_directories(src/Witness_complex/include/) +# Modules list can be found in CMAKE_MODULE_PATH/GUDHI_modules.cmake +include(GUDHI_modules) -add_subdirectory(src/common/example) -add_subdirectory(src/common/test) -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/Persistent_cohomology/benchmark) -add_subdirectory(src/Skeleton_blocker/test) -add_subdirectory(src/Skeleton_blocker/example) -add_subdirectory(src/Contraction/example) -add_subdirectory(src/Witness_complex/test) -add_subdirectory(src/Witness_complex/example) -add_subdirectory(src/Bitmap_cubical_complex/test) -add_subdirectory(src/Bitmap_cubical_complex/example) -add_subdirectory(src/Alpha_complex/example) -add_subdirectory(src/Alpha_complex/test) -add_subdirectory(src/Spatial_searching/example) -add_subdirectory(src/Spatial_searching/test) -add_subdirectory(src/Subsampling/example) -add_subdirectory(src/Subsampling/test) -add_subdirectory(src/Tangential_complex/example) -add_subdirectory(src/Tangential_complex/test) -add_subdirectory(src/Tangential_complex/benchmark) -add_subdirectory(src/Bottleneck_distance/example) -add_subdirectory(src/Bottleneck_distance/test) -add_subdirectory(src/Bottleneck_distance/benchmark) -add_subdirectory(src/Rips_complex/example) -add_subdirectory(src/Rips_complex/test) +# 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() -# data points generator -add_subdirectory(data/points/generator) +# Include module CMake subdirectories +# GUDHI_SUB_DIRECTORIES is managed in CMAKE_MODULE_PATH/GUDHI_modules.cmake +foreach(GUDHI_MODULE ${GUDHI_MODULES}) + foreach(GUDHI_SUB_DIRECTORY ${GUDHI_SUB_DIRECTORIES}) + if(EXISTS ${CMAKE_SOURCE_DIR}/src/${GUDHI_MODULE}/${GUDHI_SUB_DIRECTORY}/CMakeLists.txt) + add_subdirectory(src/${GUDHI_MODULE}/${GUDHI_SUB_DIRECTORY}/) + endif() + endforeach() +endforeach() add_subdirectory(src/GudhUI) -# specific for cython module -add_subdirectory(${GUDHI_CYTHON_PATH}) +if (NOT WITHOUT_GUDHI_PYTHON) + # specific for cython module + add_subdirectory(${GUDHI_CYTHON_PATH}) +endif() + +# For "make user_version" - Requires GUDHI_modules to be performed +include(GUDHI_user_version_target) +# For "make doxygen" - Requires GUDHI_user_version_target to be performed +include(GUDHI_doxygen_target) diff --git a/data/points/generator/CMakeLists.txt b/data/points/generator/CMakeLists.txt deleted file mode 100644 index 88d377a7..00000000 --- a/data/points/generator/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ -cmake_minimum_required(VERSION 2.6) -project(data_points_generator) - -if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.6.0) - add_executable ( data_points_generator hypergenerator.cpp ) - target_link_libraries(data_points_generator ${Boost_SYSTEM_LIBRARY}) - add_test(NAME data_points_generator_on_sphere_1000_3_15.2 COMMAND $ - "on" "sphere" "onSphere.off" "1000" "3" "15.2") - add_test(NAME data_points_generator_in_sphere_100_2 COMMAND $ - "in" "sphere" "inSphere.off" "100" "2") - - # on cube is not available in CGAL - add_test(NAME data_points_generator_in_cube_10000_3_5.8 COMMAND $ - "in" "cube" "inCube.off" "10000" "3" "5.8") -endif(NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.6.0) diff --git a/data/points/generator/README b/data/points/generator/README index 951bcfe1..3183a51f 100644 --- a/data/points/generator/README +++ b/data/points/generator/README @@ -1,32 +1,3 @@ -=========================== C++ generators ===================================== - -To build the C++ generators, run in a Terminal: - -cd /path-to-gudhi/ -cmake . -cd /path-to-data-generator/ -make - -======================= data_points_generator ================================== - -Example of use : - -*** Hyper sphere|cube generator - -./data_points_generator on sphere onSphere.off 1000 3 15.2 - - => generates a onSphere.off file with 1000 points randomized on a sphere of dimension 3 and radius 15.2 - -./data_points_generator in sphere inSphere.off 100 2 - - => generates a inSphere.off file with 100 points randomized in a sphere of dimension 2 (circle) and radius 1.0 (default) - -./data_points_generator in cube inCube.off 10000 3 5.8 - - => generates a inCube.off file with 10000 points randomized in a cube of dimension 3 and side 5.8 - -!! Warning: hypegenerator on cube is not available !! - ===================== aurelien_alvarez_surfaces_in_R8 ========================== This generator is written in Python. diff --git a/data/points/generator/hypergenerator.cpp b/data/points/generator/hypergenerator.cpp deleted file mode 100644 index 5831de18..00000000 --- a/data/points/generator/hypergenerator.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* This file is part of the Gudhi Library. The Gudhi library - * (Geometric Understanding in Higher Dimensions) is a generic C++ - * library for computational topology. - * - * Author(s): Vincent Rouvreau - * - * Copyright (C) 2014 INRIA Saclay (France) - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include -#include -#include -#include - -#include -#include -#include -#include // for std::ofstream -#include - -typedef CGAL::Epick_d< CGAL::Dynamic_dimension_tag > K; -typedef K::Point_d Point; - -void usage(char * const progName) { - std::cerr << "Usage: " << progName << " in|on sphere|cube off_file_name points_number[integer > 0] " << - "dimension[integer > 1] radius[double > 0.0 | default = 1.0]" << std::endl; - exit(-1); -} - -int main(int argc, char **argv) { - // program args management - if ((argc != 6) && (argc != 7)) { - std::cerr << "Error: Number of arguments (" << argc << ") is not correct" << std::endl; - usage(argv[0]); - } - - int points_number = atoi(argv[4]); - if (points_number <= 0) { - std::cerr << "Error: " << argv[4] << " is not correct" << std::endl; - usage(argv[0]); - } - - int dimension = atoi(argv[5]); - if (dimension <= 0) { - std::cerr << "Error: " << argv[5] << " is not correct" << std::endl; - usage(argv[0]); - } - - double radius = 1.0; - if (argc == 7) { - radius = atof(argv[6]); - if (radius <= 0.0) { - std::cerr << "Error: " << argv[6] << " is not correct" << std::endl; - usage(argv[0]); - } - } - - bool in = false; - if (strcmp(argv[1], "in") == 0) { - in = true; - } else if (strcmp(argv[1], "on") != 0) { - std::cerr << "Error: " << argv[1] << " is not correct" << std::endl; - usage(argv[0]); - } - - bool sphere = false; - if (memcmp(argv[2], "sphere", sizeof("sphere")) == 0) { - sphere = true; - } else if (memcmp(argv[2], "cube", sizeof("cube")) != 0) { - std::cerr << "Error: " << argv[2] << " is not correct" << std::endl; - usage(argv[0]); - } - - std::ofstream diagram_out(argv[3]); - if (dimension == 3) { - diagram_out << "OFF" << std::endl; - diagram_out << points_number << " 0 0" << std::endl; - } else { - diagram_out << "nOFF" << std::endl; - diagram_out << dimension << " " << points_number << " 0 0" << std::endl; - } - - if (diagram_out.is_open()) { - // Instanciate a random point generator - CGAL::Random rng(0); - // Generate "points_number" random points in a vector - std::vector points; - if (in) { - if (sphere) { - CGAL::Random_points_in_ball_d rand_it(dimension, radius, rng); - CGAL::cpp11::copy_n(rand_it, points_number, std::back_inserter(points)); - } else { - CGAL::Random_points_in_cube_d rand_it(dimension, radius, rng); - CGAL::cpp11::copy_n(rand_it, points_number, std::back_inserter(points)); - } - } else { // means "on" - if (sphere) { - CGAL::Random_points_on_sphere_d rand_it(dimension, radius, rng); - CGAL::cpp11::copy_n(rand_it, points_number, std::back_inserter(points)); - } else { - std::cerr << "Sorry: on cube is not available" << std::endl; - usage(argv[0]); - } - } - - for (auto thePoint : points) { - int i = 0; - for (; i < dimension - 1; i++) { - diagram_out << thePoint[i] << " "; - } - diagram_out << thePoint[i] << std::endl; // last point + Carriage Return - } - } else { - std::cerr << "Error: " << argv[3] << " cannot be opened" << std::endl; - usage(argv[0]); - } - - return 0; -} - diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ebcb6888..77a03c17 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -7,6 +7,9 @@ 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) + # For "make doxygen" set(GUDHI_USER_VERSION_DIR ${CMAKE_SOURCE_DIR}) include(GUDHI_doxygen_target) @@ -39,27 +42,22 @@ endif() # Gudhi compilation part include_directories(include) -add_subdirectory(example/common) -add_subdirectory(example/Simplex_tree) -add_subdirectory(example/Persistent_cohomology) -add_subdirectory(example/Skeleton_blocker) -add_subdirectory(example/Contraction) -add_subdirectory(example/Bitmap_cubical_complex) -add_subdirectory(example/Witness_complex) -add_subdirectory(example/Alpha_complex) -add_subdirectory(example/Rips_complex) -add_subdirectory(example/Spatial_searching) -add_subdirectory(example/Subsampling) -add_subdirectory(example/Tangential_complex) -add_subdirectory(example/Bottleneck_distance) - -# data points generator -add_subdirectory(data/points/generator) +# Include module CMake subdirectories +# GUDHI_SUB_DIRECTORIES is managed in CMAKE_MODULE_PATH/GUDHI_modules.cmake +foreach(GUDHI_MODULE ${GUDHI_MODULES}) + foreach(GUDHI_SUB_DIRECTORY ${GUDHI_SUB_DIRECTORIES}) + if(EXISTS ${CMAKE_SOURCE_DIR}/${GUDHI_SUB_DIRECTORY}/${GUDHI_MODULE}/CMakeLists.txt) + add_subdirectory(src/${GUDHI_MODULE}/${GUDHI_SUB_DIRECTORY}/) + endif(EXISTS ${CMAKE_SOURCE_DIR}/${GUDHI_SUB_DIRECTORY}/${GUDHI_MODULE}/CMakeLists.txt) + endforeach(GUDHI_SUB_DIRECTORY ${GUDHI_SUB_DIRECTORIES}) +endforeach(GUDHI_MODULE ${GUDHI_MODULES}) add_subdirectory(GudhUI) -# specific for cython module -add_subdirectory(${GUDHI_CYTHON_PATH}) +if (NOT WITHOUT_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 new file mode 100644 index 00000000..6a26d7bf --- /dev/null +++ b/src/cmake/modules/GUDHI_modules.cmake @@ -0,0 +1,43 @@ +# A function to add a new module in GUDHI + +set(GUDHI_MODULES "") +function(add_gudhi_module file_path) + set(GUDHI_MODULES ${GUDHI_MODULES} ${file_path} PARENT_SCOPE) +endfunction(add_gudhi_module) + +# Add your new module in the list, order is not important + +add_gudhi_module(common) +add_gudhi_module(Alpha_complex) +add_gudhi_module(Bitmap_cubical_complex) +add_gudhi_module(Bottleneck_distance) +add_gudhi_module(Contraction) +add_gudhi_module(Hasse_complex) +add_gudhi_module(Persistent_cohomology) +add_gudhi_module(Rips_complex) +add_gudhi_module(Simplex_tree) +add_gudhi_module(Skeleton_blocker) +add_gudhi_module(Spatial_searching) +add_gudhi_module(Subsampling) +add_gudhi_module(Tangential_complex) +add_gudhi_module(Witness_complex) + +# message("++ GUDHI_MODULES list is:\"${GUDHI_MODULES}\"") + +if (WITH_GUDHI_BENCHMARK) + set(GUDHI_SUB_DIRECTORIES "${GUDHI_SUB_DIRECTORIES};benchmark") +endif() +if (WITH_GUDHI_EXAMPLE) + set(GUDHI_SUB_DIRECTORIES "${GUDHI_SUB_DIRECTORIES};example") +endif() +if (NOT WITHOUT_GUDHI_TEST) + set(GUDHI_SUB_DIRECTORIES "${GUDHI_SUB_DIRECTORIES};test") +endif() +if (NOT WITHOUT_GUDHI_UTILITIES) + set(GUDHI_SUB_DIRECTORIES "${GUDHI_SUB_DIRECTORIES};utilities") +endif() + +message("++ GUDHI_SUB_DIRECTORIES list is:\"${GUDHI_SUB_DIRECTORIES}\"") + + + diff --git a/src/cmake/modules/GUDHI_user_version_target.cmake b/src/cmake/modules/GUDHI_user_version_target.cmake new file mode 100644 index 00000000..a764e88a --- /dev/null +++ b/src/cmake/modules/GUDHI_user_version_target.cmake @@ -0,0 +1,90 @@ +# Some functionnalities requires CMake 2.8.11 minimum +if (NOT CMAKE_VERSION VERSION_LESS 2.8.11) + + # Definition of the custom target user_version + add_custom_target(user_version) + + if(DEFINED USER_VERSION_DIR) + # set the GUDHI_USER_VERSION_DIR with USER_VERSION_DIR defined by the user + set(GUDHI_USER_VERSION_DIR ${CMAKE_CURRENT_BINARY_DIR}/${USER_VERSION_DIR}) + else() + # set the GUDHI_USER_VERSION_DIR with timestamp and Gudhi version number + string(TIMESTAMP DATE_AND_TIME "%Y-%m-%d-%H-%M-%S") + set(GUDHI_USER_VERSION_DIR ${CMAKE_CURRENT_BINARY_DIR}/${DATE_AND_TIME}_GUDHI_${GUDHI_VERSION}) + endif() + + set(GUDHI_DOXYGEN_DEPENDENCY user_version) + + add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E + make_directory ${GUDHI_USER_VERSION_DIR} + COMMENT "user_version creation in ${GUDHI_USER_VERSION_DIR}") + + add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E + copy ${CMAKE_SOURCE_DIR}/Conventions.txt ${GUDHI_USER_VERSION_DIR}/Conventions.txt) + add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E + copy ${CMAKE_SOURCE_DIR}/README ${GUDHI_USER_VERSION_DIR}/README) + add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E + copy ${CMAKE_SOURCE_DIR}/COPYING ${GUDHI_USER_VERSION_DIR}/COPYING) + add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E + copy ${CMAKE_SOURCE_DIR}/src/CMakeLists.txt ${GUDHI_USER_VERSION_DIR}/CMakeLists.txt) + add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E + copy ${CMAKE_SOURCE_DIR}/src/Doxyfile ${GUDHI_USER_VERSION_DIR}/Doxyfile) + add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E + copy ${CMAKE_SOURCE_DIR}/src/GUDHIConfigVersion.cmake.in ${GUDHI_USER_VERSION_DIR}/GUDHIConfigVersion.cmake.in) + add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E + copy ${CMAKE_SOURCE_DIR}/src/GUDHIConfig.cmake.in ${GUDHI_USER_VERSION_DIR}/GUDHIConfig.cmake.in) + add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E + copy ${CMAKE_SOURCE_DIR}/CMakeGUDHIVersion.txt ${GUDHI_USER_VERSION_DIR}/CMakeGUDHIVersion.txt) + + add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E + copy_directory ${CMAKE_SOURCE_DIR}/biblio ${GUDHI_USER_VERSION_DIR}/biblio) + add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E + copy_directory ${CMAKE_SOURCE_DIR}/src/cython ${GUDHI_USER_VERSION_DIR}/cython) + add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E + copy_directory ${CMAKE_SOURCE_DIR}/data ${GUDHI_USER_VERSION_DIR}/data) + add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E + copy_directory ${CMAKE_SOURCE_DIR}/src/cmake ${GUDHI_USER_VERSION_DIR}/cmake) + add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E + copy_directory ${CMAKE_SOURCE_DIR}/src/GudhUI ${GUDHI_USER_VERSION_DIR}/GudhUI) + + set(GUDHI_DIRECTORIES "doc;example;concept") + set(GUDHI_INCLUDE_DIRECTORIES "include/gudhi;include/gudhi_patches") + + foreach(GUDHI_MODULE ${GUDHI_MODULES}) + foreach(GUDHI_DIRECTORY ${GUDHI_DIRECTORIES}) + # Find files + file(GLOB GUDHI_FILES ${CMAKE_SOURCE_DIR}/src/${GUDHI_MODULE}/${GUDHI_DIRECTORY}/*) + + foreach(GUDHI_FILE ${GUDHI_FILES}) + get_filename_component(GUDHI_FILE_NAME ${GUDHI_FILE} NAME) + # GUDHI_FILE can be a file or a directory + if(IS_DIRECTORY ${GUDHI_FILE}) + add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E + copy_directory ${GUDHI_FILE} ${GUDHI_USER_VERSION_DIR}/${GUDHI_DIRECTORY}/${GUDHI_MODULE}/${GUDHI_FILE_NAME}) + else() + add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E + copy ${GUDHI_FILE} ${GUDHI_USER_VERSION_DIR}/${GUDHI_DIRECTORY}/${GUDHI_MODULE}/${GUDHI_FILE_NAME}) + endif() + endforeach() + endforeach(GUDHI_DIRECTORY ${GUDHI_DIRECTORIES}) + + foreach(GUDHI_INCLUDE_DIRECTORY ${GUDHI_INCLUDE_DIRECTORIES}) + # include files + file(GLOB GUDHI_INCLUDE_FILES ${CMAKE_SOURCE_DIR}/src/${GUDHI_MODULE}/${GUDHI_INCLUDE_DIRECTORY}/*) + + foreach(GUDHI_INCLUDE_FILE ${GUDHI_INCLUDE_FILES}) + get_filename_component(GUDHI_INCLUDE_FILE_NAME ${GUDHI_INCLUDE_FILE} NAME) + # GUDHI_INCLUDE_FILE can be a file or a directory + if(IS_DIRECTORY ${GUDHI_INCLUDE_FILE}) + add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E + copy_directory ${GUDHI_INCLUDE_FILE} ${GUDHI_USER_VERSION_DIR}/${GUDHI_INCLUDE_DIRECTORY}/${GUDHI_INCLUDE_FILE_NAME}) + else() + add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E + copy ${GUDHI_INCLUDE_FILE} ${GUDHI_USER_VERSION_DIR}/${GUDHI_INCLUDE_DIRECTORY}/${GUDHI_INCLUDE_FILE_NAME}) + endif() + endforeach() + endforeach(GUDHI_INCLUDE_DIRECTORY ${GUDHI_INCLUDE_DIRECTORIES}) + + endforeach(GUDHI_MODULE ${GUDHI_MODULES}) + +endif() diff --git a/src/cmake/modules/GUDHI_user_version_target.txt b/src/cmake/modules/GUDHI_user_version_target.txt deleted file mode 100644 index ca6bcd34..00000000 --- a/src/cmake/modules/GUDHI_user_version_target.txt +++ /dev/null @@ -1,91 +0,0 @@ -# Some functionnalities requires CMake 2.8.11 minimum -if (NOT CMAKE_VERSION VERSION_LESS 2.8.11) - - # Definition of the custom target user_version - add_custom_target(user_version) - - if(DEFINED USER_VERSION_DIR) - # set the GUDHI_USER_VERSION_DIR with USER_VERSION_DIR defined by the user - set(GUDHI_USER_VERSION_DIR ${CMAKE_CURRENT_BINARY_DIR}/${USER_VERSION_DIR}) - else() - # set the GUDHI_USER_VERSION_DIR with timestamp and Gudhi version number - string(TIMESTAMP DATE_AND_TIME "%Y-%m-%d-%H-%M-%S") - set(GUDHI_USER_VERSION_DIR ${CMAKE_CURRENT_BINARY_DIR}/${DATE_AND_TIME}_GUDHI_${GUDHI_VERSION}) - endif() - - set(GUDHI_DOXYGEN_DEPENDENCY user_version) - - add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E - make_directory ${GUDHI_USER_VERSION_DIR} - COMMENT "user_version creation in ${GUDHI_USER_VERSION_DIR}") - - add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E - copy ${CMAKE_SOURCE_DIR}/Conventions.txt ${GUDHI_USER_VERSION_DIR}/Conventions.txt) - add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E - copy ${CMAKE_SOURCE_DIR}/README ${GUDHI_USER_VERSION_DIR}/README) - add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E - copy ${CMAKE_SOURCE_DIR}/COPYING ${GUDHI_USER_VERSION_DIR}/COPYING) - add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E - copy ${CMAKE_SOURCE_DIR}/src/CMakeLists.txt ${GUDHI_USER_VERSION_DIR}/CMakeLists.txt) - add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E - copy ${CMAKE_SOURCE_DIR}/src/Doxyfile ${GUDHI_USER_VERSION_DIR}/Doxyfile) - add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E - copy ${CMAKE_SOURCE_DIR}/src/GUDHIConfigVersion.cmake.in ${GUDHI_USER_VERSION_DIR}/GUDHIConfigVersion.cmake.in) - add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E - copy ${CMAKE_SOURCE_DIR}/src/GUDHIConfig.cmake.in ${GUDHI_USER_VERSION_DIR}/GUDHIConfig.cmake.in) - add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E - copy ${CMAKE_SOURCE_DIR}/CMakeGUDHIVersion.txt ${GUDHI_USER_VERSION_DIR}/CMakeGUDHIVersion.txt) - - add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E - copy_directory ${CMAKE_SOURCE_DIR}/biblio ${GUDHI_USER_VERSION_DIR}/biblio) - add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E - copy_directory ${CMAKE_SOURCE_DIR}/src/cython ${GUDHI_USER_VERSION_DIR}/cython) - add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E - copy_directory ${CMAKE_SOURCE_DIR}/data ${GUDHI_USER_VERSION_DIR}/data) - add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E - copy_directory ${CMAKE_SOURCE_DIR}/src/cmake ${GUDHI_USER_VERSION_DIR}/cmake) - add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E - copy_directory ${CMAKE_SOURCE_DIR}/src/GudhUI ${GUDHI_USER_VERSION_DIR}/GudhUI) - - set(GUDHI_MODULES "common;Alpha_complex;Bitmap_cubical_complex;Bottleneck_distance;Contraction;Hasse_complex;Persistent_cohomology;Rips_complex;Simplex_tree;Skeleton_blocker;Spatial_searching;Subsampling;Tangential_complex;Witness_complex") - set(GUDHI_DIRECTORIES "doc;example;concept") - set(GUDHI_INCLUDE_DIRECTORIES "include/gudhi;include/gudhi_patches") - - foreach(GUDHI_MODULE ${GUDHI_MODULES}) - foreach(GUDHI_DIRECTORY ${GUDHI_DIRECTORIES}) - # Find files - file(GLOB GUDHI_FILES ${CMAKE_SOURCE_DIR}/src/${GUDHI_MODULE}/${GUDHI_DIRECTORY}/*) - - foreach(GUDHI_FILE ${GUDHI_FILES}) - get_filename_component(GUDHI_FILE_NAME ${GUDHI_FILE} NAME) - # GUDHI_FILE can be a file or a directory - if(IS_DIRECTORY ${GUDHI_FILE}) - add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E - copy_directory ${GUDHI_FILE} ${GUDHI_USER_VERSION_DIR}/${GUDHI_DIRECTORY}/${GUDHI_MODULE}/${GUDHI_FILE_NAME}) - else() - add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E - copy ${GUDHI_FILE} ${GUDHI_USER_VERSION_DIR}/${GUDHI_DIRECTORY}/${GUDHI_MODULE}/${GUDHI_FILE_NAME}) - endif() - endforeach() - endforeach(GUDHI_DIRECTORY ${GUDHI_DIRECTORIES}) - - foreach(GUDHI_INCLUDE_DIRECTORY ${GUDHI_INCLUDE_DIRECTORIES}) - # include files - file(GLOB GUDHI_INCLUDE_FILES ${CMAKE_SOURCE_DIR}/src/${GUDHI_MODULE}/${GUDHI_INCLUDE_DIRECTORY}/*) - - foreach(GUDHI_INCLUDE_FILE ${GUDHI_INCLUDE_FILES}) - get_filename_component(GUDHI_INCLUDE_FILE_NAME ${GUDHI_INCLUDE_FILE} NAME) - # GUDHI_INCLUDE_FILE can be a file or a directory - if(IS_DIRECTORY ${GUDHI_INCLUDE_FILE}) - add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E - copy_directory ${GUDHI_INCLUDE_FILE} ${GUDHI_USER_VERSION_DIR}/${GUDHI_INCLUDE_DIRECTORY}/${GUDHI_INCLUDE_FILE_NAME}) - else() - add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E - copy ${GUDHI_INCLUDE_FILE} ${GUDHI_USER_VERSION_DIR}/${GUDHI_INCLUDE_DIRECTORY}/${GUDHI_INCLUDE_FILE_NAME}) - endif() - endforeach() - endforeach(GUDHI_INCLUDE_DIRECTORY ${GUDHI_INCLUDE_DIRECTORIES}) - - endforeach(GUDHI_MODULE ${GUDHI_MODULES}) - -endif() diff --git a/src/common/include/gudhi/random_point_generators.h b/src/common/include/gudhi/random_point_generators.h index 2ec465ef..9df77760 100644 --- a/src/common/include/gudhi/random_point_generators.h +++ b/src/common/include/gudhi/random_point_generators.h @@ -281,6 +281,38 @@ std::vector generate_points_on_sphere_d(std::size_t nu return points; } +template +std::vector generate_points_in_ball_d(std::size_t num_points, int dim, double radius) { + typedef typename Kernel::Point_d Point; + Kernel k; + CGAL::Random rng; + CGAL::Random_points_in_ball_d generator(dim, radius); + std::vector points; + points.reserve(num_points); + for (std::size_t i = 0; i < num_points;) { + Point p = *generator++; + points.push_back(p); + ++i; + } + return points; +} + +template +std::vector generate_points_in_cube_d(std::size_t num_points, int dim, double radius) { + typedef typename Kernel::Point_d Point; + Kernel k; + CGAL::Random rng; + CGAL::Random_points_in_cube_d generator(dim, radius); + std::vector points; + points.reserve(num_points); + for (std::size_t i = 0; i < num_points;) { + Point p = *generator++; + points.push_back(p); + ++i; + } + return points; +} + template std::vector generate_points_on_two_spheres_d(std::size_t num_points, int dim, double radius, double distance_between_centers, diff --git a/src/common/utilities/CMakeLists.txt b/src/common/utilities/CMakeLists.txt new file mode 100644 index 00000000..88d377a7 --- /dev/null +++ b/src/common/utilities/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 2.6) +project(data_points_generator) + +if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.6.0) + add_executable ( data_points_generator hypergenerator.cpp ) + target_link_libraries(data_points_generator ${Boost_SYSTEM_LIBRARY}) + add_test(NAME data_points_generator_on_sphere_1000_3_15.2 COMMAND $ + "on" "sphere" "onSphere.off" "1000" "3" "15.2") + add_test(NAME data_points_generator_in_sphere_100_2 COMMAND $ + "in" "sphere" "inSphere.off" "100" "2") + + # on cube is not available in CGAL + add_test(NAME data_points_generator_in_cube_10000_3_5.8 COMMAND $ + "in" "cube" "inCube.off" "10000" "3" "5.8") +endif(NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.6.0) diff --git a/src/common/utilities/README b/src/common/utilities/README new file mode 100644 index 00000000..f2ece556 --- /dev/null +++ b/src/common/utilities/README @@ -0,0 +1,19 @@ +======================= data_points_generator ================================== + +Example of use : + +*** Hyper sphere|cube generator + +./data_points_generator on sphere onSphere.off 1000 3 15.2 + + => generates a onSphere.off file with 1000 points randomized on a sphere of dimension 3 and radius 15.2 + +./data_points_generator in sphere inSphere.off 100 2 + + => generates a inSphere.off file with 100 points randomized in a sphere of dimension 2 (circle) and radius 1.0 (default) + +./data_points_generator in cube inCube.off 10000 3 5.8 + + => generates a inCube.off file with 10000 points randomized in a cube of dimension 3 and side 5.8 + +!! Warning: hypegenerator on cube is not available !! diff --git a/src/common/utilities/hypergenerator.cpp b/src/common/utilities/hypergenerator.cpp new file mode 100644 index 00000000..0f310a13 --- /dev/null +++ b/src/common/utilities/hypergenerator.cpp @@ -0,0 +1,189 @@ +/* This file is part of the Gudhi Library. The Gudhi library + * (Geometric Understanding in Higher Dimensions) is a generic C++ + * library for computational topology. + * + * Author(s): Vincent Rouvreau + * + * Copyright (C) 2014 INRIA Saclay (France) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include + +#include +#include +#include + +#include +#include +#include +#include // for std::ofstream +#include + +typedef CGAL::Epick_d< CGAL::Dynamic_dimension_tag > K; +typedef K::Point_d Point; + +void usage(char * const progName) { + std::cerr << "Usage: " << progName << " in|on sphere|cube off_file_name points_number[integer > 0] " << + "dimension[integer > 1] radius[double > 0.0 | default = 1.0]" << std::endl; + exit(-1); +} + +int main(int argc, char **argv) { + // program args management + if ((argc != 6) && (argc != 7)) { + std::cerr << "Error: Number of arguments (" << argc << ") is not correct" << std::endl; + usage(argv[0]); + } + + int points_number = atoi(argv[4]); + if (points_number <= 0) { + std::cerr << "Error: " << argv[4] << " is not correct" << std::endl; + usage(argv[0]); + } + + int dimension = atoi(argv[5]); + if (dimension <= 0) { + std::cerr << "Error: " << argv[5] << " is not correct" << std::endl; + usage(argv[0]); + } + + double radius = 1.0; + if (argc == 7) { + radius = atof(argv[6]); + if (radius <= 0.0) { + std::cerr << "Error: " << argv[6] << " is not correct" << std::endl; + usage(argv[0]); + } + } + + bool in = false; + if (strcmp(argv[1], "in") == 0) { + in = true; + } else if (strcmp(argv[1], "on") != 0) { + std::cerr << "Error: " << argv[1] << " is not correct" << std::endl; + usage(argv[0]); + } + + enum class Data_shape { sphere, cube, curve, torus, klein, undefined } ; + + Data_shape shape = Data_shape::undefined; + if (memcmp(argv[2], "sphere", sizeof("sphere")) == 0) { + shape = Data_shape::sphere; + } else if (memcmp(argv[2], "cube", sizeof("cube")) == 0) { + shape = Data_shape::cube; + } else if (memcmp(argv[2], "curve", sizeof("curve")) == 0) { + shape = Data_shape::curve; + } else if (memcmp(argv[2], "torus", sizeof("torus")) == 0) { + shape = Data_shape::torus; + } else if (memcmp(argv[2], "klein", sizeof("klein")) == 0) { + shape = Data_shape::klein; + } else { + std::cerr << "Error: " << argv[2] << " is not correct" << std::endl; + usage(argv[0]); + } + + std::ofstream diagram_out(argv[3]); + if (dimension == 3) { + diagram_out << "OFF" << std::endl; + diagram_out << points_number << " 0 0" << std::endl; + } else { + diagram_out << "nOFF" << std::endl; + diagram_out << dimension << " " << points_number << " 0 0" << std::endl; + } + + if (diagram_out.is_open()) { + // Generate "points_number" random points in a vector + std::vector points; + if (in) { + switch (shape) { + case Data_shape::sphere: + points = Gudhi::generate_points_in_ball_d(points_number, dimension, radius); + break; + case Data_shape::cube: + points = Gudhi::generate_points_in_ball_d(points_number, dimension, radius); + break; + case Data_shape::curve: + std::cerr << "Sorry: in curve is not available" << std::endl; + usage(argv[0]); + break; + case Data_shape::torus: + std::cerr << "Sorry: in torus is not available" << std::endl; + usage(argv[0]); + break; + case Data_shape::klein: + std::cerr << "Sorry: in klein is not available" << std::endl; + usage(argv[0]); + break; + default: + usage(argv[0]); + break; + } + } else { // means "on" + switch (shape) { + case Data_shape::sphere: + points = Gudhi::generate_points_on_sphere_d(points_number, dimension, radius); + break; + case Data_shape::cube: + std::cerr << "Sorry: on cube is not available" << std::endl; + usage(argv[0]); + break; + case Data_shape::curve: + points = Gudhi::generate_points_on_moment_curve(points_number, dimension, -radius/2., radius/2.); + break; + case Data_shape::torus: + if (dimension == 3) + points = Gudhi::generate_points_on_torus_3D(points_number, dimension, radius, radius/2.); + else + points = Gudhi::generate_points_on_torus_d(points_number, dimension, true); + break; + case Data_shape::klein: + switch (dimension) { + case 3: + points = Gudhi::generate_points_on_klein_bottle_3D(points_number, radius, radius/2., true); + break; + case 4: + points = Gudhi::generate_points_on_klein_bottle_4D(points_number, radius, radius/2., 0., true); + break; + case 5: + points = Gudhi::generate_points_on_klein_bottle_variant_5D(points_number, radius, radius/2., true); + break; + default: + std::cerr << "Sorry: on klein is only available for dimension 3, 4 and 5" << std::endl; + usage(argv[0]); + break; + } + break; + default: + usage(argv[0]); + break; + } + } + + for (auto thePoint : points) { + int i = 0; + for (; i < dimension - 1; i++) { + diagram_out << thePoint[i] << " "; + } + diagram_out << thePoint[i] << std::endl; // last point + Carriage Return + } + } else { + std::cerr << "Error: " << argv[3] << " cannot be opened" << std::endl; + usage(argv[0]); + } + + return 0; +} + -- cgit v1.2.3 From ec3f93103f5a1937d3f8bbf37af3837a1089bf03 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Fri, 19 May 2017 16:13:50 +0000 Subject: Move src/common/utilities/hypergenerator.cpp in src/common/utilities Management of Python distribution packages make install is now installing utilities and GUDHI python module git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/cmake_modules_for_gudhi@2453 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: a85576c7ae062718900f0db2bfb0dd3f26e87177 --- CMakeLists.txt | 19 ++- src/CMakeLists.txt | 27 ++- src/GudhUI/CMakeLists.txt | 2 + src/cmake/modules/GUDHI_modules.cmake | 17 -- .../modules/GUDHI_third_party_libraries.cmake | 7 +- src/cmake/modules/GUDHI_user_version_target.cmake | 2 +- src/common/utilities/CMakeLists.txt | 15 +- src/common/utilities/README | 10 +- src/common/utilities/hypergenerator.cpp | 189 --------------------- .../utilities/off_file_from_shape_generator.cpp | 189 +++++++++++++++++++++ src/cython/CMakeLists.txt | 10 +- 11 files changed, 260 insertions(+), 227 deletions(-) delete mode 100644 src/common/utilities/hypergenerator.cpp create mode 100644 src/common/utilities/off_file_from_shape_generator.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 360eb87a..c9ceb92b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,6 +37,23 @@ 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 + +add_gudhi_module(common) +add_gudhi_module(Alpha_complex) +add_gudhi_module(Bitmap_cubical_complex) +add_gudhi_module(Bottleneck_distance) +add_gudhi_module(Contraction) +add_gudhi_module(Hasse_complex) +add_gudhi_module(Persistent_cohomology) +add_gudhi_module(Rips_complex) +add_gudhi_module(Simplex_tree) +add_gudhi_module(Skeleton_blocker) +add_gudhi_module(Spatial_searching) +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/) @@ -63,5 +80,5 @@ endif() # For "make user_version" - Requires GUDHI_modules to be performed include(GUDHI_user_version_target) -# For "make doxygen" - Requires GUDHI_user_version_target to be performed +# For "make doxygen" - Requires GUDHI_USER_VERSION_DIR to be set - Done in GUDHI_user_version_target for dev version include(GUDHI_doxygen_target) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 77a03c17..8abfcf44 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -10,7 +10,24 @@ 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) -# For "make doxygen" +# Add your new module in the list, order is not important + +add_gudhi_module(common) +add_gudhi_module(Alpha_complex) +add_gudhi_module(Bitmap_cubical_complex) +add_gudhi_module(Bottleneck_distance) +add_gudhi_module(Contraction) +add_gudhi_module(Hasse_complex) +add_gudhi_module(Persistent_cohomology) +add_gudhi_module(Rips_complex) +add_gudhi_module(Simplex_tree) +add_gudhi_module(Skeleton_blocker) +add_gudhi_module(Spatial_searching) +add_gudhi_module(Subsampling) +add_gudhi_module(Tangential_complex) +add_gudhi_module(Witness_complex) + +# For "make doxygen" - Requires GUDHI_USER_VERSION_DIR to be set set(GUDHI_USER_VERSION_DIR ${CMAKE_SOURCE_DIR}) include(GUDHI_doxygen_target) @@ -47,10 +64,10 @@ include_directories(include) foreach(GUDHI_MODULE ${GUDHI_MODULES}) foreach(GUDHI_SUB_DIRECTORY ${GUDHI_SUB_DIRECTORIES}) if(EXISTS ${CMAKE_SOURCE_DIR}/${GUDHI_SUB_DIRECTORY}/${GUDHI_MODULE}/CMakeLists.txt) - add_subdirectory(src/${GUDHI_MODULE}/${GUDHI_SUB_DIRECTORY}/) - endif(EXISTS ${CMAKE_SOURCE_DIR}/${GUDHI_SUB_DIRECTORY}/${GUDHI_MODULE}/CMakeLists.txt) - endforeach(GUDHI_SUB_DIRECTORY ${GUDHI_SUB_DIRECTORIES}) -endforeach(GUDHI_MODULE ${GUDHI_MODULES}) + add_subdirectory(${CMAKE_SOURCE_DIR}/${GUDHI_SUB_DIRECTORY}/${GUDHI_MODULE}/) + endif() + endforeach() +endforeach() add_subdirectory(GudhUI) diff --git a/src/GudhUI/CMakeLists.txt b/src/GudhUI/CMakeLists.txt index ca2e47c1..57861946 100644 --- a/src/GudhUI/CMakeLists.txt +++ b/src/GudhUI/CMakeLists.txt @@ -56,6 +56,8 @@ if (TBB_FOUND) target_link_libraries( GudhUI ${TBB_LIBRARIES}) endif() + install(TARGETS GudhUI DESTINATION bin) + ############################################################################### else() diff --git a/src/cmake/modules/GUDHI_modules.cmake b/src/cmake/modules/GUDHI_modules.cmake index 6a26d7bf..20fc8d17 100644 --- a/src/cmake/modules/GUDHI_modules.cmake +++ b/src/cmake/modules/GUDHI_modules.cmake @@ -5,23 +5,6 @@ function(add_gudhi_module file_path) set(GUDHI_MODULES ${GUDHI_MODULES} ${file_path} PARENT_SCOPE) endfunction(add_gudhi_module) -# Add your new module in the list, order is not important - -add_gudhi_module(common) -add_gudhi_module(Alpha_complex) -add_gudhi_module(Bitmap_cubical_complex) -add_gudhi_module(Bottleneck_distance) -add_gudhi_module(Contraction) -add_gudhi_module(Hasse_complex) -add_gudhi_module(Persistent_cohomology) -add_gudhi_module(Rips_complex) -add_gudhi_module(Simplex_tree) -add_gudhi_module(Skeleton_blocker) -add_gudhi_module(Spatial_searching) -add_gudhi_module(Subsampling) -add_gudhi_module(Tangential_complex) -add_gudhi_module(Witness_complex) - # message("++ GUDHI_MODULES list is:\"${GUDHI_MODULES}\"") if (WITH_GUDHI_BENCHMARK) diff --git a/src/cmake/modules/GUDHI_third_party_libraries.cmake b/src/cmake/modules/GUDHI_third_party_libraries.cmake index 5f84c602..8cb01d3c 100644 --- a/src/cmake/modules/GUDHI_third_party_libraries.cmake +++ b/src/cmake/modules/GUDHI_third_party_libraries.cmake @@ -135,10 +135,15 @@ if(PYTHONINTERP_FOUND AND CYTHON_FOUND) # Documentation generation is available through sphinx find_program( SPHINX_PATH sphinx-build ) elseif(PYTHON_VERSION_MAJOR EQUAL 3) - # Documentation generation is available through sphinx + # No sphinx-build in Pyton3, just hack it set(SPHINX_PATH "${CMAKE_SOURCE_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) + # get PYTHON_SITE_PACKAGES relative path from a python command line + execute_process( + COMMAND "${PYTHON_EXECUTABLE}" -c "from distutils.sysconfig import get_python_lib; print (get_python_lib(prefix='', plat_specific=True))" + OUTPUT_VARIABLE PYTHON_SITE_PACKAGES + OUTPUT_STRIP_TRAILING_WHITESPACE) endif(PYTHONINTERP_FOUND AND CYTHON_FOUND) diff --git a/src/cmake/modules/GUDHI_user_version_target.cmake b/src/cmake/modules/GUDHI_user_version_target.cmake index a764e88a..8642d3bf 100644 --- a/src/cmake/modules/GUDHI_user_version_target.cmake +++ b/src/cmake/modules/GUDHI_user_version_target.cmake @@ -47,7 +47,7 @@ if (NOT CMAKE_VERSION VERSION_LESS 2.8.11) add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/src/GudhUI ${GUDHI_USER_VERSION_DIR}/GudhUI) - set(GUDHI_DIRECTORIES "doc;example;concept") + set(GUDHI_DIRECTORIES "doc;example;concept;utilities") set(GUDHI_INCLUDE_DIRECTORIES "include/gudhi;include/gudhi_patches") foreach(GUDHI_MODULE ${GUDHI_MODULES}) diff --git a/src/common/utilities/CMakeLists.txt b/src/common/utilities/CMakeLists.txt index 88d377a7..c2e07e7e 100644 --- a/src/common/utilities/CMakeLists.txt +++ b/src/common/utilities/CMakeLists.txt @@ -1,15 +1,18 @@ cmake_minimum_required(VERSION 2.6) -project(data_points_generator) +project(off_file_from_shape_generator) if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.6.0) - add_executable ( data_points_generator hypergenerator.cpp ) - target_link_libraries(data_points_generator ${Boost_SYSTEM_LIBRARY}) - add_test(NAME data_points_generator_on_sphere_1000_3_15.2 COMMAND $ + add_executable ( off_file_from_shape_generator off_file_from_shape_generator.cpp ) + target_link_libraries(off_file_from_shape_generator ${Boost_SYSTEM_LIBRARY}) + add_test(NAME off_file_from_shape_generator_on_sphere_1000_3_15.2 COMMAND $ "on" "sphere" "onSphere.off" "1000" "3" "15.2") - add_test(NAME data_points_generator_in_sphere_100_2 COMMAND $ + add_test(NAME off_file_from_shape_generator_in_sphere_100_2 COMMAND $ "in" "sphere" "inSphere.off" "100" "2") # on cube is not available in CGAL - add_test(NAME data_points_generator_in_cube_10000_3_5.8 COMMAND $ + add_test(NAME off_file_from_shape_generator_in_cube_10000_3_5.8 COMMAND $ "in" "cube" "inCube.off" "10000" "3" "5.8") + + install(TARGETS off_file_from_shape_generator DESTINATION bin) + endif(NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.6.0) diff --git a/src/common/utilities/README b/src/common/utilities/README index f2ece556..dc841521 100644 --- a/src/common/utilities/README +++ b/src/common/utilities/README @@ -1,18 +1,18 @@ -======================= data_points_generator ================================== +======================= off_file_from_shape_generator ================================== Example of use : -*** Hyper sphere|cube generator +*** on|in sphere|cube|curve|torus|klein generator -./data_points_generator on sphere onSphere.off 1000 3 15.2 +./off_file_from_shape_generator on sphere onSphere.off 1000 3 15.2 => generates a onSphere.off file with 1000 points randomized on a sphere of dimension 3 and radius 15.2 -./data_points_generator in sphere inSphere.off 100 2 +./off_file_from_shape_generator in sphere inSphere.off 100 2 => generates a inSphere.off file with 100 points randomized in a sphere of dimension 2 (circle) and radius 1.0 (default) -./data_points_generator in cube inCube.off 10000 3 5.8 +./off_file_from_shape_generator in cube inCube.off 10000 3 5.8 => generates a inCube.off file with 10000 points randomized in a cube of dimension 3 and side 5.8 diff --git a/src/common/utilities/hypergenerator.cpp b/src/common/utilities/hypergenerator.cpp deleted file mode 100644 index 0f310a13..00000000 --- a/src/common/utilities/hypergenerator.cpp +++ /dev/null @@ -1,189 +0,0 @@ -/* This file is part of the Gudhi Library. The Gudhi library - * (Geometric Understanding in Higher Dimensions) is a generic C++ - * library for computational topology. - * - * Author(s): Vincent Rouvreau - * - * Copyright (C) 2014 INRIA Saclay (France) - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include - -#include -#include -#include - -#include -#include -#include -#include // for std::ofstream -#include - -typedef CGAL::Epick_d< CGAL::Dynamic_dimension_tag > K; -typedef K::Point_d Point; - -void usage(char * const progName) { - std::cerr << "Usage: " << progName << " in|on sphere|cube off_file_name points_number[integer > 0] " << - "dimension[integer > 1] radius[double > 0.0 | default = 1.0]" << std::endl; - exit(-1); -} - -int main(int argc, char **argv) { - // program args management - if ((argc != 6) && (argc != 7)) { - std::cerr << "Error: Number of arguments (" << argc << ") is not correct" << std::endl; - usage(argv[0]); - } - - int points_number = atoi(argv[4]); - if (points_number <= 0) { - std::cerr << "Error: " << argv[4] << " is not correct" << std::endl; - usage(argv[0]); - } - - int dimension = atoi(argv[5]); - if (dimension <= 0) { - std::cerr << "Error: " << argv[5] << " is not correct" << std::endl; - usage(argv[0]); - } - - double radius = 1.0; - if (argc == 7) { - radius = atof(argv[6]); - if (radius <= 0.0) { - std::cerr << "Error: " << argv[6] << " is not correct" << std::endl; - usage(argv[0]); - } - } - - bool in = false; - if (strcmp(argv[1], "in") == 0) { - in = true; - } else if (strcmp(argv[1], "on") != 0) { - std::cerr << "Error: " << argv[1] << " is not correct" << std::endl; - usage(argv[0]); - } - - enum class Data_shape { sphere, cube, curve, torus, klein, undefined } ; - - Data_shape shape = Data_shape::undefined; - if (memcmp(argv[2], "sphere", sizeof("sphere")) == 0) { - shape = Data_shape::sphere; - } else if (memcmp(argv[2], "cube", sizeof("cube")) == 0) { - shape = Data_shape::cube; - } else if (memcmp(argv[2], "curve", sizeof("curve")) == 0) { - shape = Data_shape::curve; - } else if (memcmp(argv[2], "torus", sizeof("torus")) == 0) { - shape = Data_shape::torus; - } else if (memcmp(argv[2], "klein", sizeof("klein")) == 0) { - shape = Data_shape::klein; - } else { - std::cerr << "Error: " << argv[2] << " is not correct" << std::endl; - usage(argv[0]); - } - - std::ofstream diagram_out(argv[3]); - if (dimension == 3) { - diagram_out << "OFF" << std::endl; - diagram_out << points_number << " 0 0" << std::endl; - } else { - diagram_out << "nOFF" << std::endl; - diagram_out << dimension << " " << points_number << " 0 0" << std::endl; - } - - if (diagram_out.is_open()) { - // Generate "points_number" random points in a vector - std::vector points; - if (in) { - switch (shape) { - case Data_shape::sphere: - points = Gudhi::generate_points_in_ball_d(points_number, dimension, radius); - break; - case Data_shape::cube: - points = Gudhi::generate_points_in_ball_d(points_number, dimension, radius); - break; - case Data_shape::curve: - std::cerr << "Sorry: in curve is not available" << std::endl; - usage(argv[0]); - break; - case Data_shape::torus: - std::cerr << "Sorry: in torus is not available" << std::endl; - usage(argv[0]); - break; - case Data_shape::klein: - std::cerr << "Sorry: in klein is not available" << std::endl; - usage(argv[0]); - break; - default: - usage(argv[0]); - break; - } - } else { // means "on" - switch (shape) { - case Data_shape::sphere: - points = Gudhi::generate_points_on_sphere_d(points_number, dimension, radius); - break; - case Data_shape::cube: - std::cerr << "Sorry: on cube is not available" << std::endl; - usage(argv[0]); - break; - case Data_shape::curve: - points = Gudhi::generate_points_on_moment_curve(points_number, dimension, -radius/2., radius/2.); - break; - case Data_shape::torus: - if (dimension == 3) - points = Gudhi::generate_points_on_torus_3D(points_number, dimension, radius, radius/2.); - else - points = Gudhi::generate_points_on_torus_d(points_number, dimension, true); - break; - case Data_shape::klein: - switch (dimension) { - case 3: - points = Gudhi::generate_points_on_klein_bottle_3D(points_number, radius, radius/2., true); - break; - case 4: - points = Gudhi::generate_points_on_klein_bottle_4D(points_number, radius, radius/2., 0., true); - break; - case 5: - points = Gudhi::generate_points_on_klein_bottle_variant_5D(points_number, radius, radius/2., true); - break; - default: - std::cerr << "Sorry: on klein is only available for dimension 3, 4 and 5" << std::endl; - usage(argv[0]); - break; - } - break; - default: - usage(argv[0]); - break; - } - } - - for (auto thePoint : points) { - int i = 0; - for (; i < dimension - 1; i++) { - diagram_out << thePoint[i] << " "; - } - diagram_out << thePoint[i] << std::endl; // last point + Carriage Return - } - } else { - std::cerr << "Error: " << argv[3] << " cannot be opened" << std::endl; - usage(argv[0]); - } - - return 0; -} - diff --git a/src/common/utilities/off_file_from_shape_generator.cpp b/src/common/utilities/off_file_from_shape_generator.cpp new file mode 100644 index 00000000..0f310a13 --- /dev/null +++ b/src/common/utilities/off_file_from_shape_generator.cpp @@ -0,0 +1,189 @@ +/* This file is part of the Gudhi Library. The Gudhi library + * (Geometric Understanding in Higher Dimensions) is a generic C++ + * library for computational topology. + * + * Author(s): Vincent Rouvreau + * + * Copyright (C) 2014 INRIA Saclay (France) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include + +#include +#include +#include + +#include +#include +#include +#include // for std::ofstream +#include + +typedef CGAL::Epick_d< CGAL::Dynamic_dimension_tag > K; +typedef K::Point_d Point; + +void usage(char * const progName) { + std::cerr << "Usage: " << progName << " in|on sphere|cube off_file_name points_number[integer > 0] " << + "dimension[integer > 1] radius[double > 0.0 | default = 1.0]" << std::endl; + exit(-1); +} + +int main(int argc, char **argv) { + // program args management + if ((argc != 6) && (argc != 7)) { + std::cerr << "Error: Number of arguments (" << argc << ") is not correct" << std::endl; + usage(argv[0]); + } + + int points_number = atoi(argv[4]); + if (points_number <= 0) { + std::cerr << "Error: " << argv[4] << " is not correct" << std::endl; + usage(argv[0]); + } + + int dimension = atoi(argv[5]); + if (dimension <= 0) { + std::cerr << "Error: " << argv[5] << " is not correct" << std::endl; + usage(argv[0]); + } + + double radius = 1.0; + if (argc == 7) { + radius = atof(argv[6]); + if (radius <= 0.0) { + std::cerr << "Error: " << argv[6] << " is not correct" << std::endl; + usage(argv[0]); + } + } + + bool in = false; + if (strcmp(argv[1], "in") == 0) { + in = true; + } else if (strcmp(argv[1], "on") != 0) { + std::cerr << "Error: " << argv[1] << " is not correct" << std::endl; + usage(argv[0]); + } + + enum class Data_shape { sphere, cube, curve, torus, klein, undefined } ; + + Data_shape shape = Data_shape::undefined; + if (memcmp(argv[2], "sphere", sizeof("sphere")) == 0) { + shape = Data_shape::sphere; + } else if (memcmp(argv[2], "cube", sizeof("cube")) == 0) { + shape = Data_shape::cube; + } else if (memcmp(argv[2], "curve", sizeof("curve")) == 0) { + shape = Data_shape::curve; + } else if (memcmp(argv[2], "torus", sizeof("torus")) == 0) { + shape = Data_shape::torus; + } else if (memcmp(argv[2], "klein", sizeof("klein")) == 0) { + shape = Data_shape::klein; + } else { + std::cerr << "Error: " << argv[2] << " is not correct" << std::endl; + usage(argv[0]); + } + + std::ofstream diagram_out(argv[3]); + if (dimension == 3) { + diagram_out << "OFF" << std::endl; + diagram_out << points_number << " 0 0" << std::endl; + } else { + diagram_out << "nOFF" << std::endl; + diagram_out << dimension << " " << points_number << " 0 0" << std::endl; + } + + if (diagram_out.is_open()) { + // Generate "points_number" random points in a vector + std::vector points; + if (in) { + switch (shape) { + case Data_shape::sphere: + points = Gudhi::generate_points_in_ball_d(points_number, dimension, radius); + break; + case Data_shape::cube: + points = Gudhi::generate_points_in_ball_d(points_number, dimension, radius); + break; + case Data_shape::curve: + std::cerr << "Sorry: in curve is not available" << std::endl; + usage(argv[0]); + break; + case Data_shape::torus: + std::cerr << "Sorry: in torus is not available" << std::endl; + usage(argv[0]); + break; + case Data_shape::klein: + std::cerr << "Sorry: in klein is not available" << std::endl; + usage(argv[0]); + break; + default: + usage(argv[0]); + break; + } + } else { // means "on" + switch (shape) { + case Data_shape::sphere: + points = Gudhi::generate_points_on_sphere_d(points_number, dimension, radius); + break; + case Data_shape::cube: + std::cerr << "Sorry: on cube is not available" << std::endl; + usage(argv[0]); + break; + case Data_shape::curve: + points = Gudhi::generate_points_on_moment_curve(points_number, dimension, -radius/2., radius/2.); + break; + case Data_shape::torus: + if (dimension == 3) + points = Gudhi::generate_points_on_torus_3D(points_number, dimension, radius, radius/2.); + else + points = Gudhi::generate_points_on_torus_d(points_number, dimension, true); + break; + case Data_shape::klein: + switch (dimension) { + case 3: + points = Gudhi::generate_points_on_klein_bottle_3D(points_number, radius, radius/2., true); + break; + case 4: + points = Gudhi::generate_points_on_klein_bottle_4D(points_number, radius, radius/2., 0., true); + break; + case 5: + points = Gudhi::generate_points_on_klein_bottle_variant_5D(points_number, radius, radius/2., true); + break; + default: + std::cerr << "Sorry: on klein is only available for dimension 3, 4 and 5" << std::endl; + usage(argv[0]); + break; + } + break; + default: + usage(argv[0]); + break; + } + } + + for (auto thePoint : points) { + int i = 0; + for (; i < dimension - 1; i++) { + diagram_out << thePoint[i] << " "; + } + diagram_out << thePoint[i] << std::endl; // last point + Carriage Return + } + } else { + std::cerr << "Error: " << argv[3] << " cannot be opened" << std::endl; + usage(argv[0]); + } + + return 0; +} + diff --git a/src/cython/CMakeLists.txt b/src/cython/CMakeLists.txt index 96c2acb3..62f8d368 100644 --- a/src/cython/CMakeLists.txt +++ b/src/cython/CMakeLists.txt @@ -168,17 +168,23 @@ if(CYTHON_FOUND) configure_file(gudhi.pyx.in "${CMAKE_CURRENT_BINARY_DIR}/gudhi.pyx" @ONLY) add_custom_command( - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/gudhi.so" + OUTPUT gudhi.so WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/cythonize_gudhi.py" "build_ext" "--inplace") - add_custom_target(cython ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/gudhi.so" + add_custom_target(cython ALL DEPENDS gudhi.so COMMENT "Do not forget to add ${CMAKE_CURRENT_BINARY_DIR}/ to your PYTHONPATH before using examples or tests") if(UNIX) set( ENV{PYTHONPATH} $ENV{PYTHONPATH}:${CMAKE_CURRENT_BINARY_DIR}/ ) endif(UNIX) + # For installation purpose + install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" DESTINATION "${PYTHON_SITE_PACKAGES}/" FILES_MATCHING + PATTERN "*.so" + PATTERN "*.dylib" + PATTERN "*.pyd") + # Test examples add_test(NAME alpha_complex_from_points_example_py_test WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} -- cgit v1.2.3 From bb5e82c41e9d3a79f8e1dc53cd1dd2c117e06111 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Tue, 30 May 2017 07:36:17 +0000 Subject: Add a warning git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/cmake_modules_for_gudhi@2465 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: a873c9c6fff031968747c3dec197aec06738c32a --- src/cython/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/cython/CMakeLists.txt b/src/cython/CMakeLists.txt index 62f8d368..d9f356f9 100644 --- a/src/cython/CMakeLists.txt +++ b/src/cython/CMakeLists.txt @@ -180,6 +180,7 @@ if(CYTHON_FOUND) endif(UNIX) # For installation purpose + # TODO(VR) : files matching pattern mechanism is copying all cython directory install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" DESTINATION "${PYTHON_SITE_PACKAGES}/" FILES_MATCHING PATTERN "*.so" PATTERN "*.dylib" -- cgit v1.2.3 From 5ca4efc2986846d5442a8f18941430cddadc1e80 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Tue, 30 May 2017 08:49:50 +0000 Subject: Make install examples mechanism git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/cmake_modules_for_gudhi@2467 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 018b6e55c392b37d02503e7822e0a586061c987d --- src/Alpha_complex/example/CMakeLists.txt | 4 ++++ src/Bitmap_cubical_complex/example/CMakeLists.txt | 4 ++++ src/Bottleneck_distance/example/CMakeLists.txt | 4 ++++ src/Contraction/example/CMakeLists.txt | 3 +++ src/Persistent_cohomology/example/CMakeLists.txt | 24 ++++++++++++++++++++--- src/Rips_complex/example/CMakeLists.txt | 5 +++++ src/Simplex_tree/example/CMakeLists.txt | 6 ++++++ src/Skeleton_blocker/example/CMakeLists.txt | 4 ++++ src/Spatial_searching/example/CMakeLists.txt | 1 + src/Subsampling/example/CMakeLists.txt | 6 ++++++ src/Tangential_complex/example/CMakeLists.txt | 3 +++ src/Witness_complex/example/CMakeLists.txt | 9 +++++++++ src/common/example/CMakeLists.txt | 5 +++++ 13 files changed, 75 insertions(+), 3 deletions(-) diff --git a/src/Alpha_complex/example/CMakeLists.txt b/src/Alpha_complex/example/CMakeLists.txt index a4853d78..4badcb91 100644 --- a/src/Alpha_complex/example/CMakeLists.txt +++ b/src/Alpha_complex/example/CMakeLists.txt @@ -29,4 +29,8 @@ if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.7.0) add_test(Alpha_complex_example_from_off_32_diff_files ${DIFF_PATH} ${CMAKE_CURRENT_BINARY_DIR}/alphaoffreader_result_32.txt ${CMAKE_CURRENT_BINARY_DIR}/alphaoffreader_for_doc_32.txt) endif() + + install(TARGETS Alpha_complex_example_from_points DESTINATION bin) + install(TARGETS Alpha_complex_example_from_off DESTINATION bin) + endif(NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.7.0) diff --git a/src/Bitmap_cubical_complex/example/CMakeLists.txt b/src/Bitmap_cubical_complex/example/CMakeLists.txt index 241a11e5..47f5e0c6 100644 --- a/src/Bitmap_cubical_complex/example/CMakeLists.txt +++ b/src/Bitmap_cubical_complex/example/CMakeLists.txt @@ -34,3 +34,7 @@ add_test(NAME Bitmap_cubical_complex_example_periodic_boundary_conditions_2d_tor add_test(NAME Bitmap_cubical_complex_example_periodic_boundary_conditions_3d_torus COMMAND $ "${CMAKE_SOURCE_DIR}/data/bitmap/3d_torus.txt") + +install(TARGETS Bitmap_cubical_complex DESTINATION bin) +install(TARGETS Random_bitmap_cubical_complex DESTINATION bin) +install(TARGETS Bitmap_cubical_complex_periodic_boundary_conditions DESTINATION bin) diff --git a/src/Bottleneck_distance/example/CMakeLists.txt b/src/Bottleneck_distance/example/CMakeLists.txt index 0d0bff45..0534a2c4 100644 --- a/src/Bottleneck_distance/example/CMakeLists.txt +++ b/src/Bottleneck_distance/example/CMakeLists.txt @@ -19,4 +19,8 @@ if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1) COMMAND $ "${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off" "-r" "0.15" "-m" "0.12" "-d" "3" "-p" "3") + install(TARGETS bottleneck_read_file_example DESTINATION bin) + install(TARGETS bottleneck_basic_example DESTINATION bin) + install(TARGETS alpha_rips_persistence_bottleneck_distance DESTINATION bin) + endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1) diff --git a/src/Contraction/example/CMakeLists.txt b/src/Contraction/example/CMakeLists.txt index 51a6832d..b2b38dea 100644 --- a/src/Contraction/example/CMakeLists.txt +++ b/src/Contraction/example/CMakeLists.txt @@ -16,3 +16,6 @@ add_test(NAME Contraction_example_tore3D_0.2 COMMAND $ # "${CMAKE_SOURCE_DIR}/data/points/SO3_10000.off" "0.3") + +install(TARGETS RipsContraction DESTINATION bin) +install(TARGETS GarlandHeckbert DESTINATION bin) diff --git a/src/Persistent_cohomology/example/CMakeLists.txt b/src/Persistent_cohomology/example/CMakeLists.txt index 3c45e79b..a9884c49 100644 --- a/src/Persistent_cohomology/example/CMakeLists.txt +++ b/src/Persistent_cohomology/example/CMakeLists.txt @@ -47,7 +47,15 @@ add_test(NAME Persistent_cohomology_example_from_file_3_2_0 COMMAND $ "${CMAKE_SOURCE_DIR}/data/filtered_simplicial_complex/bunny_5000_complex.fsc" "-p" "3" "-m" "100") - + +install(TARGETS plain_homology DESTINATION bin) +install(TARGETS persistence_from_simple_simplex_tree DESTINATION bin) +install(TARGETS rips_distance_matrix_persistence DESTINATION bin) +install(TARGETS rips_persistence DESTINATION bin) +install(TARGETS rips_persistence_step_by_step DESTINATION bin) +install(TARGETS rips_persistence_via_boundary_matrix DESTINATION bin) +install(TARGETS persistence_from_file DESTINATION bin) + if(GMP_FOUND) if(GMPXX_FOUND) add_executable(rips_multifield_persistence rips_multifield_persistence.cpp ) @@ -56,8 +64,9 @@ if(GMP_FOUND) if (TBB_FOUND) target_link_libraries(rips_multifield_persistence ${TBB_LIBRARIES}) endif(TBB_FOUND) - add_test(NAME Persistent_cohomology_example_multifield_2_71 COMMAND $ - "${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off" "-r" "0.25" "-m" "0.5" "-d" "3" "-p" "2" "-q" "71") + add_test(NAME Persistent_cohomology_example_multifield_2_71 COMMAND $ + "${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off" "-r" "0.25" "-m" "0.5" "-d" "3" "-p" "2" "-q" "71") + install(TARGETS rips_multifield_persistence DESTINATION bin) endif(GMPXX_FOUND) endif(GMP_FOUND) @@ -81,6 +90,10 @@ if(CGAL_FOUND) add_test(NAME Persistent_cohomology_example_weighted_alpha_complex_3d COMMAND $ "${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off" "${CMAKE_SOURCE_DIR}/data/points/tore3D_300.weights" "2" "0.45") + install(TARGETS alpha_complex_3d_persistence DESTINATION bin) + install(TARGETS exact_alpha_complex_3d_persistence DESTINATION bin) + install(TARGETS weighted_alpha_complex_3d_persistence DESTINATION bin) + if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.7.0) add_executable (alpha_complex_persistence alpha_complex_persistence.cpp) target_link_libraries(alpha_complex_persistence @@ -102,5 +115,10 @@ if(CGAL_FOUND) add_test(NAME Persistent_cohomology_example_periodic_alpha_complex_3d COMMAND $ "${CMAKE_SOURCE_DIR}/data/points/grid_10_10_10_in_0_1.off" "${CMAKE_SOURCE_DIR}/data/points/iso_cuboid_3_in_0_1.txt" "2" "0") add_test(NAME Persistent_cohomology_example_custom_persistence_sort COMMAND $) + + install(TARGETS alpha_complex_persistence DESTINATION bin) + install(TARGETS periodic_alpha_complex_3d_persistence DESTINATION bin) + install(TARGETS custom_persistence_sort DESTINATION bin) + endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.7.0) endif(CGAL_FOUND) diff --git a/src/Rips_complex/example/CMakeLists.txt b/src/Rips_complex/example/CMakeLists.txt index 8aee79e2..712db16e 100644 --- a/src/Rips_complex/example/CMakeLists.txt +++ b/src/Rips_complex/example/CMakeLists.txt @@ -56,3 +56,8 @@ if (DIFF_PATH) ${CMAKE_CURRENT_BINARY_DIR}/ripscsvreader_result_12_3.txt ${CMAKE_CURRENT_BINARY_DIR}/full_skeleton_rips_for_doc.txt) endif() + +install(TARGETS Rips_complex_example_from_off DESTINATION bin) +install(TARGETS Rips_complex_example_one_skeleton_from_points DESTINATION bin) +install(TARGETS Rips_complex_example_one_skeleton_from_distance_matrix DESTINATION bin) +install(TARGETS Rips_complex_example_from_csv_distance_matrix DESTINATION bin) diff --git a/src/Simplex_tree/example/CMakeLists.txt b/src/Simplex_tree/example/CMakeLists.txt index b1ea98d4..d05bb187 100644 --- a/src/Simplex_tree/example/CMakeLists.txt +++ b/src/Simplex_tree/example/CMakeLists.txt @@ -19,6 +19,9 @@ add_test(NAME Simplex_tree_example_simple_simplex_tree COMMAND $) +install(TARGETS Simplex_tree_example_from_cliques_of_graph DESTINATION bin) +install(TARGETS Simplex_tree_example_simple_simplex_tree DESTINATION bin) +install(TARGETS Simplex_tree_example_mini_simplex_tree DESTINATION bin) # An example with Simplex-tree using CGAL alpha_shapes_3 if(GMP_FOUND AND CGAL_FOUND) @@ -29,4 +32,7 @@ if(GMP_FOUND AND CGAL_FOUND) endif() add_test(NAME Simplex_tree_example_alpha_shapes_3_from_off COMMAND $ "${CMAKE_SOURCE_DIR}/data/points/bunny_5000.off") + + install(TARGETS Simplex_tree_example_alpha_shapes_3_from_off DESTINATION bin) + endif() diff --git a/src/Skeleton_blocker/example/CMakeLists.txt b/src/Skeleton_blocker/example/CMakeLists.txt index c887e408..ce51ac39 100644 --- a/src/Skeleton_blocker/example/CMakeLists.txt +++ b/src/Skeleton_blocker/example/CMakeLists.txt @@ -10,3 +10,7 @@ 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 $) + +install(TARGETS Skeleton_blocker_example_from_simplices DESTINATION bin) +install(TARGETS Skeleton_blocker_example_iteration DESTINATION bin) +install(TARGETS Skeleton_blocker_example_link DESTINATION bin) diff --git a/src/Spatial_searching/example/CMakeLists.txt b/src/Spatial_searching/example/CMakeLists.txt index f4b9f3cb..4cf3d863 100644 --- a/src/Spatial_searching/example/CMakeLists.txt +++ b/src/Spatial_searching/example/CMakeLists.txt @@ -6,4 +6,5 @@ if(NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1) target_link_libraries(Spatial_searching_example_spatial_searching ${CGAL_LIBRARY}) add_test(NAME Spatial_searching_example_spatial_searching COMMAND $) + install(TARGETS Spatial_searching_example_spatial_searching DESTINATION bin) endif(NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1) diff --git a/src/Subsampling/example/CMakeLists.txt b/src/Subsampling/example/CMakeLists.txt index 71b8d2e8..34400b1e 100644 --- a/src/Subsampling/example/CMakeLists.txt +++ b/src/Subsampling/example/CMakeLists.txt @@ -14,4 +14,10 @@ if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1) COMMAND $) add_test(NAME Subsampling_example_sparsify_point_set COMMAND $) + + install(TARGETS Subsampling_example_pick_n_random_points DESTINATION bin) + install(TARGETS Subsampling_example_choose_n_farthest_points DESTINATION bin) + install(TARGETS Subsampling_example_custom_kernel DESTINATION bin) + install(TARGETS Subsampling_example_sparsify_point_set DESTINATION bin) + endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1) diff --git a/src/Tangential_complex/example/CMakeLists.txt b/src/Tangential_complex/example/CMakeLists.txt index 339d0581..45c7642b 100644 --- a/src/Tangential_complex/example/CMakeLists.txt +++ b/src/Tangential_complex/example/CMakeLists.txt @@ -15,4 +15,7 @@ if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1) COMMAND $) add_test(NAME Tangential_complex_example_with_perturb COMMAND $) + + install(TARGETS Tangential_complex_example_basic DESTINATION bin) + install(TARGETS Tangential_complex_example_with_perturb DESTINATION bin) endif(NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1) diff --git a/src/Witness_complex/example/CMakeLists.txt b/src/Witness_complex/example/CMakeLists.txt index 670651ce..1e18d024 100644 --- a/src/Witness_complex/example/CMakeLists.txt +++ b/src/Witness_complex/example/CMakeLists.txt @@ -9,6 +9,8 @@ endif() add_test(NAME Witness_complex_example_nearest_landmark_table COMMAND $) +install(TARGETS Witness_complex_example_nearest_landmark_table DESTINATION bin) + # CGAL and Eigen3 are required for Euclidean version of Witness if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.6.0) add_executable( Witness_complex_example_off example_witness_complex_off.cpp ) @@ -43,4 +45,11 @@ if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.6.0) add_test(NAME Witness_complex_example_strong_test_torus_persistence COMMAND $ "${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off" "-l" "20" "-a" "0.5") + + install(TARGETS Witness_complex_example_off DESTINATION bin) + install(TARGETS Witness_complex_example_strong_off DESTINATION bin) + install(TARGETS Witness_complex_example_sphere DESTINATION bin) + install(TARGETS Witness_complex_example_witness_persistence DESTINATION bin) + install(TARGETS Witness_complex_example_strong_witness_persistence DESTINATION bin) + endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.6.0) diff --git a/src/common/example/CMakeLists.txt b/src/common/example/CMakeLists.txt index d5311b18..af3c2c9d 100644 --- a/src/common/example/CMakeLists.txt +++ b/src/common/example/CMakeLists.txt @@ -6,6 +6,8 @@ target_link_libraries(vector_double_off_reader ${Boost_SYSTEM_LIBRARY} ${CGAL_L add_test(NAME Common_example_vector_double_off_reader COMMAND $ "${CMAKE_SOURCE_DIR}/data/points/SO3_10000.off") +install(TARGETS vector_double_off_reader DESTINATION bin) + if(CGAL_FOUND) add_executable ( cgal_3D_off_reader example_CGAL_3D_points_off_reader.cpp ) target_link_libraries(cgal_3D_off_reader ${Boost_SYSTEM_LIBRARY} ${CGAL_LIBRARY}) @@ -19,4 +21,7 @@ if(CGAL_FOUND) add_test(NAME Common_example_vector_cgal_off_reader COMMAND $ "${CMAKE_SOURCE_DIR}/data/points/alphacomplexdoc.off") endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.7.0) + + install(TARGETS cgal_3D_off_reader DESTINATION bin) + install(TARGETS cgal_off_reader DESTINATION bin) endif() -- cgit v1.2.3 -- cgit v1.2.3