From 07c7e5841c961869b927875bbca91d10287f9fab Mon Sep 17 00:00:00 2001 From: Marc Glisse Date: Wed, 26 Feb 2020 22:03:18 +0100 Subject: Initial commit of tomato --- src/python/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/python/CMakeLists.txt') diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt index 090a7446..628fb391 100644 --- a/src/python/CMakeLists.txt +++ b/src/python/CMakeLists.txt @@ -35,6 +35,7 @@ if(PYTHONINTERP_FOUND) if(PYBIND11_FOUND) add_gudhi_debug_info("Pybind11 version ${PYBIND11_VERSION}") set(GUDHI_PYTHON_MODULES_EXTRA "${GUDHI_PYTHON_MODULES_EXTRA}'hera', ") + set(GUDHI_PYTHON_MODULES_EXTRA "${GUDHI_PYTHON_MODULES_EXTRA}'clustering', ") endif() if(CYTHON_FOUND) set(GUDHI_PYTHON_MODULES "${GUDHI_PYTHON_MODULES}'off_reader', ") @@ -226,6 +227,7 @@ endif(CGAL_FOUND) file(COPY "gudhi/persistence_graphical_tools.py" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/gudhi") file(COPY "gudhi/representations" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/gudhi/") file(COPY "gudhi/wasserstein.py" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/gudhi") + file(COPY "gudhi/clustering" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/gudhi" FILES_MATCHING PATTERN "*.py") add_custom_command( OUTPUT gudhi.so -- cgit v1.2.3 From 0c47b28201093851140ab499331017ef42312ce7 Mon Sep 17 00:00:00 2001 From: yuichi-ike Date: Thu, 21 May 2020 11:02:00 +0900 Subject: DTM Rips added (straightforward way) --- src/python/CMakeLists.txt | 10 ++++- src/python/doc/rips_complex_ref.rst | 13 ++++++ src/python/doc/rips_complex_sum.inc | 3 ++ src/python/doc/rips_complex_user.rst | 20 +++++++++ src/python/gudhi/dtm_rips_complex.py | 46 +++++++++++++++++++ src/python/test/test_dtm_rips_complex.py | 40 +++++++++++++++++ src/python/test/test_weighted_rips.py | 63 --------------------------- src/python/test/test_weighted_rips_complex.py | 63 +++++++++++++++++++++++++++ 8 files changed, 194 insertions(+), 64 deletions(-) create mode 100644 src/python/gudhi/dtm_rips_complex.py create mode 100644 src/python/test/test_dtm_rips_complex.py delete mode 100644 src/python/test/test_weighted_rips.py create mode 100644 src/python/test/test_weighted_rips_complex.py (limited to 'src/python/CMakeLists.txt') diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt index ab08cd6d..96dd3f6f 100644 --- a/src/python/CMakeLists.txt +++ b/src/python/CMakeLists.txt @@ -58,6 +58,7 @@ if(PYTHONINTERP_FOUND) set(GUDHI_PYTHON_MODULES_EXTRA "${GUDHI_PYTHON_MODULES_EXTRA}'wasserstein', ") set(GUDHI_PYTHON_MODULES_EXTRA "${GUDHI_PYTHON_MODULES_EXTRA}'point_cloud', ") set(GUDHI_PYTHON_MODULES_EXTRA "${GUDHI_PYTHON_MODULES_EXTRA}'weighted_rips_complex', ") + set(GUDHI_PYTHON_MODULES_EXTRA "${GUDHI_PYTHON_MODULES_EXTRA}'dtm_rips_complex', ") add_gudhi_debug_info("Python version ${PYTHON_VERSION_STRING}") add_gudhi_debug_info("Cython version ${CYTHON_VERSION}") @@ -234,6 +235,7 @@ if(PYTHONINTERP_FOUND) file(COPY "gudhi/wasserstein" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/gudhi") file(COPY "gudhi/point_cloud" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/gudhi") file(COPY "gudhi/weighted_rips_complex.py" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/gudhi") + file(COPY "gudhi/dtm_rips_complex.py" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/gudhi") add_custom_command( OUTPUT gudhi.so @@ -492,9 +494,15 @@ if(PYTHONINTERP_FOUND) # Weighted Rips if(SCIPY_FOUND) - add_gudhi_py_test(test_weighted_rips) + add_gudhi_py_test(test_weighted_rips_complex) endif() + # DTM Rips + if(SCIPY_FOUND) + add_gudhi_py_test(test_dtm_rips_complex) + endif() + + # Set missing or not modules set(GUDHI_MODULES ${GUDHI_MODULES} "python" CACHE INTERNAL "GUDHI_MODULES") else(CYTHON_FOUND) diff --git a/src/python/doc/rips_complex_ref.rst b/src/python/doc/rips_complex_ref.rst index 5f3e46c1..f781fd92 100644 --- a/src/python/doc/rips_complex_ref.rst +++ b/src/python/doc/rips_complex_ref.rst @@ -25,3 +25,16 @@ Weighted Rips complex reference manual :show-inheritance: .. automethod:: gudhi.weighted_rips_complex.WeightedRipsComplex.__init__ + +.. _dtm-rips-complex-reference-manual: + +================================= +DTM Rips complex reference manual +================================= + +.. autoclass:: gudhi.dtm_rips_complex.DtmRipsComplex + :members: + :undoc-members: + :show-inheritance: + + .. automethod:: gudhi.dtm_rips_complex.DtmRipsComplex.__init__ \ No newline at end of file diff --git a/src/python/doc/rips_complex_sum.inc b/src/python/doc/rips_complex_sum.inc index f7580714..9cd8074b 100644 --- a/src/python/doc/rips_complex_sum.inc +++ b/src/python/doc/rips_complex_sum.inc @@ -14,6 +14,9 @@ | | | | | | Weighted Rips complex constructs a simplicial complex from a distance | | | | matrix and weights on vertices. | | + | | | | + | | DTM Rips complex builds a simplicial complex from a point set or | | + | | a distance matrix. | | +----------------------------------------------------------------+------------------------------------------------------------------------+----------------------------------------------------------------------+ | * :doc:`rips_complex_user` | * :doc:`rips_complex_ref` | +----------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ diff --git a/src/python/doc/rips_complex_user.rst b/src/python/doc/rips_complex_user.rst index 819568be..eb2657df 100644 --- a/src/python/doc/rips_complex_user.rst +++ b/src/python/doc/rips_complex_user.rst @@ -398,3 +398,23 @@ The output is: .. testoutput:: [(0, (3.1622776601683795, inf)), (0, (3.1622776601683795, 5.39834563766817)), (0, (3.1622776601683795, 5.39834563766817))] + +DTM Rips Complex +---------------- + +`DtmdRipsComplex `_ builds a simplicial complex from a point set or a full distence matrix (in the form of ndarray), as described in the above example. + +.. testcode:: + + import numpy as np + from dtm_rips_complex import DtmRipsComplex + pts = np.array([[2.0, 2.0], [0.0, 1.0], [3.0, 4.0]]) + dtm_rips = DtmRipsComplex(points=pts, k=2) + st = dtm_rips.create_simplex_tree(max_dimension=2) + print(st.persistence()) + +The output is: + +.. testoutput:: + + [(0, (3.1622776601683795, inf)), (0, (3.1622776601683795, 5.39834563766817)), (0, (3.1622776601683795, 5.39834563766817))] diff --git a/src/python/gudhi/dtm_rips_complex.py b/src/python/gudhi/dtm_rips_complex.py new file mode 100644 index 00000000..6d2f9f31 --- /dev/null +++ b/src/python/gudhi/dtm_rips_complex.py @@ -0,0 +1,46 @@ +# This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT. +# See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details. +# Author(s): Yuichi Ike, Raphaël Tinarrage +# +# Copyright (C) 2020 Inria, Copyright (C) 2020 FUjitsu Laboratories Ltd. +# +# Modification(s): +# - YYYY/MM Author: Description of the modification + + +from gudhi.weighted_rips_complex import WeightedRipsComplex +from gudhi.point_cloud.dtm import DistanceToMeasure +from scipy.spatial.distance import cdist + +class DtmRipsComplex(WeightedRipsComplex): + """ + Class to generate a DTM Rips complex from a distance matrix or a point set, + in the way described in :cite:`dtmfiltrations`. + Remark that all the filtration values are doubled compared to the definition in the paper + for the consistency with RipsComplex. + """ + def __init__(self, + points=None, + distance_matrix=None, + k=1, + q=2, + max_filtration=float('inf')): + """ + Args: + points (Sequence[Sequence[float]]): list of points. + distance_matrix (ndarray): full distance matrix. + k (int): number of neighbors for the computation of DTM. Defaults to 1, which is equivalent to the usual Rips complex. + q (float): order used to compute the distance to measure. Defaults to 2. + max_filtration (float): specifies the maximal filtration value to be considered. + """ + if distance_matrix is None: + if points is None: + # Empty Rips construction + points=[] + distance_matrix = cdist(points,points) + self.distance_matrix = distance_matrix + dtm = DistanceToMeasure(k, q=q, metric="precomputed") + # TODO: address the error when k is too large + self.weights = dtm.fit_transform(distance_matrix) + self.max_filtration = max_filtration + diff --git a/src/python/test/test_dtm_rips_complex.py b/src/python/test/test_dtm_rips_complex.py new file mode 100644 index 00000000..bc6e5a59 --- /dev/null +++ b/src/python/test/test_dtm_rips_complex.py @@ -0,0 +1,40 @@ +""" This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT. + See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details. + Author(s): Yuichi Ike + + Copyright (C) 2020 Inria, Copyright (C) 2020 FUjitsu Laboratories Ltd. + + Modification(s): + - YYYY/MM Author: Description of the modification +""" + +from gudhi.dtm_rips_complex import DtmRipsComplex +import numpy as np +from math import sqrt +import pytest + +def test_dtm_rips_complex(): + pts = np.array([[2.0, 2.0], [0.0, 1.0], [3.0, 4.0]]) + dtm_rips = DtmRipsComplex(points=pts, k=2) + st = dtm_rips.create_simplex_tree(max_dimension=2) + st.persistence() + persistence_intervals0 = st.persistence_intervals_in_dimension(0) + assert persistence_intervals0 == pytest.approx(np.array([[3.16227766, 5.39834564],[3.16227766, 5.39834564], [3.16227766, float("inf")]])) + +def test_compatibility_with_rips(): + distance_matrix = np.array([[0, 1, 1, sqrt(2)], [1, 0, sqrt(2), 1], [1, sqrt(2), 0, 1], [sqrt(2), 1, 1, 0]]) + dtm_rips = DtmRipsComplex(distance_matrix=distance_matrix, max_filtration=42) + st = dtm_rips.create_simplex_tree(max_dimension=1) + assert list(st.get_filtration()) == [ + ([0], 0.0), + ([1], 0.0), + ([2], 0.0), + ([3], 0.0), + ([0, 1], 1.0), + ([0, 2], 1.0), + ([1, 3], 1.0), + ([2, 3], 1.0), + ([1, 2], sqrt(2)), + ([0, 3], sqrt(2)), + ] + diff --git a/src/python/test/test_weighted_rips.py b/src/python/test/test_weighted_rips.py deleted file mode 100644 index 7ef48333..00000000 --- a/src/python/test/test_weighted_rips.py +++ /dev/null @@ -1,63 +0,0 @@ -""" This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT. - See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details. - Author(s): Yuichi Ike and Masatoshi Takenouchi - - Copyright (C) 2020 Inria - - Modification(s): - - YYYY/MM Author: Description of the modification -""" - -from gudhi.weighted_rips_complex import WeightedRipsComplex -from gudhi.point_cloud.dtm import DistanceToMeasure -import numpy as np -from math import sqrt -from scipy.spatial.distance import cdist -import pytest - -def test_non_dtm_rips_complex(): - dist = [[], [1]] - weights = [1, 100] - w_rips = WeightedRipsComplex(distance_matrix=dist, weights=weights) - st = w_rips.create_simplex_tree(max_dimension=2) - assert st.filtration([0,1]) == pytest.approx(200.0) - -def test_compatibility_with_rips(): - distance_matrix = [[0], [1, 0], [1, sqrt(2), 0], [sqrt(2), 1, 1, 0]] - w_rips = WeightedRipsComplex(distance_matrix=distance_matrix,max_filtration=42) - st = w_rips.create_simplex_tree(max_dimension=1) - assert list(st.get_filtration()) == [ - ([0], 0.0), - ([1], 0.0), - ([2], 0.0), - ([3], 0.0), - ([0, 1], 1.0), - ([0, 2], 1.0), - ([1, 3], 1.0), - ([2, 3], 1.0), - ([1, 2], sqrt(2)), - ([0, 3], sqrt(2)), - ] - -def test_compatibility_with_filtered_rips(): - distance_matrix = [[0], [1, 0], [1, sqrt(2), 0], [sqrt(2), 1, 1, 0]] - w_rips = WeightedRipsComplex(distance_matrix=distance_matrix,max_filtration=1.0) - st = w_rips.create_simplex_tree(max_dimension=1) - - assert st.__is_defined() == True - assert st.__is_persistence_defined() == False - - assert st.num_simplices() == 8 - assert st.num_vertices() == 4 - -def test_dtm_rips_complex(): - pts = np.array([[2.0, 2.0], [0.0, 1.0], [3.0, 4.0]]) - dist = cdist(pts,pts) - dtm = DistanceToMeasure(2, q=2, metric="precomputed") - r = dtm.fit_transform(dist) - w_rips = WeightedRipsComplex(distance_matrix=dist, weights=r) - st = w_rips.create_simplex_tree(max_dimension=2) - st.persistence() - persistence_intervals0 = st.persistence_intervals_in_dimension(0) - assert persistence_intervals0 == pytest.approx(np.array([[3.16227766, 5.39834564],[3.16227766, 5.39834564], [3.16227766, float("inf")]])) - diff --git a/src/python/test/test_weighted_rips_complex.py b/src/python/test/test_weighted_rips_complex.py new file mode 100644 index 00000000..7ef48333 --- /dev/null +++ b/src/python/test/test_weighted_rips_complex.py @@ -0,0 +1,63 @@ +""" This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT. + See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details. + Author(s): Yuichi Ike and Masatoshi Takenouchi + + Copyright (C) 2020 Inria + + Modification(s): + - YYYY/MM Author: Description of the modification +""" + +from gudhi.weighted_rips_complex import WeightedRipsComplex +from gudhi.point_cloud.dtm import DistanceToMeasure +import numpy as np +from math import sqrt +from scipy.spatial.distance import cdist +import pytest + +def test_non_dtm_rips_complex(): + dist = [[], [1]] + weights = [1, 100] + w_rips = WeightedRipsComplex(distance_matrix=dist, weights=weights) + st = w_rips.create_simplex_tree(max_dimension=2) + assert st.filtration([0,1]) == pytest.approx(200.0) + +def test_compatibility_with_rips(): + distance_matrix = [[0], [1, 0], [1, sqrt(2), 0], [sqrt(2), 1, 1, 0]] + w_rips = WeightedRipsComplex(distance_matrix=distance_matrix,max_filtration=42) + st = w_rips.create_simplex_tree(max_dimension=1) + assert list(st.get_filtration()) == [ + ([0], 0.0), + ([1], 0.0), + ([2], 0.0), + ([3], 0.0), + ([0, 1], 1.0), + ([0, 2], 1.0), + ([1, 3], 1.0), + ([2, 3], 1.0), + ([1, 2], sqrt(2)), + ([0, 3], sqrt(2)), + ] + +def test_compatibility_with_filtered_rips(): + distance_matrix = [[0], [1, 0], [1, sqrt(2), 0], [sqrt(2), 1, 1, 0]] + w_rips = WeightedRipsComplex(distance_matrix=distance_matrix,max_filtration=1.0) + st = w_rips.create_simplex_tree(max_dimension=1) + + assert st.__is_defined() == True + assert st.__is_persistence_defined() == False + + assert st.num_simplices() == 8 + assert st.num_vertices() == 4 + +def test_dtm_rips_complex(): + pts = np.array([[2.0, 2.0], [0.0, 1.0], [3.0, 4.0]]) + dist = cdist(pts,pts) + dtm = DistanceToMeasure(2, q=2, metric="precomputed") + r = dtm.fit_transform(dist) + w_rips = WeightedRipsComplex(distance_matrix=dist, weights=r) + st = w_rips.create_simplex_tree(max_dimension=2) + st.persistence() + persistence_intervals0 = st.persistence_intervals_in_dimension(0) + assert persistence_intervals0 == pytest.approx(np.array([[3.16227766, 5.39834564],[3.16227766, 5.39834564], [3.16227766, float("inf")]])) + -- cgit v1.2.3 From 9f2c4f3c8ed6e4e11ba8e962ffc0ac957dd45d74 Mon Sep 17 00:00:00 2001 From: Marc Glisse Date: Tue, 26 May 2020 11:39:11 +0200 Subject: Run the test --- src/python/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/python/CMakeLists.txt') diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt index 02fe6c50..7186dc2b 100644 --- a/src/python/CMakeLists.txt +++ b/src/python/CMakeLists.txt @@ -491,6 +491,11 @@ if(PYTHONINTERP_FOUND) add_gudhi_py_test(test_dtm) endif() + # Tomato + if(SCIPY_FOUND AND PYBIND11_FOUND) + add_gudhi_py_test(test_tomato) + endif() + # Set missing or not modules set(GUDHI_MODULES ${GUDHI_MODULES} "python" CACHE INTERNAL "GUDHI_MODULES") else(CYTHON_FOUND) -- cgit v1.2.3 From 3a421e5e981a0d637bfc8c0cb9da66e8750e2a8c Mon Sep 17 00:00:00 2001 From: Marc Glisse Date: Wed, 27 May 2020 08:55:30 +0200 Subject: Test uses sklearn --- src/python/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/python/CMakeLists.txt') diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt index a8872d73..6939a4a6 100644 --- a/src/python/CMakeLists.txt +++ b/src/python/CMakeLists.txt @@ -494,7 +494,7 @@ if(PYTHONINTERP_FOUND) endif() # Tomato - if(SCIPY_FOUND AND PYBIND11_FOUND) + if(SCIPY_FOUND AND SKLEARN_FOUND AND PYBIND11_FOUND) add_gudhi_py_test(test_tomato) endif() -- cgit v1.2.3 From 433a8cdaa111ebb777450fc1ee2e316480e4b46a Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Sun, 31 May 2020 10:36:47 +0200 Subject: Add introduction to pypi description and new release version --- CMakeGUDHIVersion.txt | 2 +- src/python/CMakeLists.txt | 3 +++ src/python/setup.py.in | 14 ++++++++++---- 3 files changed, 14 insertions(+), 5 deletions(-) (limited to 'src/python/CMakeLists.txt') diff --git a/CMakeGUDHIVersion.txt b/CMakeGUDHIVersion.txt index 59226274..3d8be42d 100644 --- a/CMakeGUDHIVersion.txt +++ b/CMakeGUDHIVersion.txt @@ -1,6 +1,6 @@ set (GUDHI_MAJOR_VERSION 3) set (GUDHI_MINOR_VERSION 2) -set (GUDHI_PATCH_VERSION 0a0) +set (GUDHI_PATCH_VERSION 0a1) set(GUDHI_VERSION ${GUDHI_MAJOR_VERSION}.${GUDHI_MINOR_VERSION}.${GUDHI_PATCH_VERSION}) message(STATUS "GUDHI version : ${GUDHI_VERSION}") diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt index ab08cd6d..d4cb7477 100644 --- a/src/python/CMakeLists.txt +++ b/src/python/CMakeLists.txt @@ -235,6 +235,9 @@ if(PYTHONINTERP_FOUND) file(COPY "gudhi/point_cloud" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/gudhi") file(COPY "gudhi/weighted_rips_complex.py" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/gudhi") + # Other .py files + file(COPY "introduction.md" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/") + add_custom_command( OUTPUT gudhi.so WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} diff --git a/src/python/setup.py.in b/src/python/setup.py.in index 55d2b604..ff000a2c 100644 --- a/src/python/setup.py.in +++ b/src/python/setup.py.in @@ -13,6 +13,7 @@ from Cython.Build import cythonize from numpy import get_include as numpy_get_include import sys import pybind11 +from os import path __author__ = "Vincent Rouvreau" __copyright__ = "Copyright (C) 2016 Inria" @@ -62,6 +63,11 @@ for module in pybind11_modules: runtime_library_dirs=runtime_library_dirs, )) +# read the contents of introduction.md +this_directory = path.abspath(path.dirname(__file__)) +with open(path.join(this_directory, 'introduction.md'), encoding='utf-8') as f: + long_description = f.read() + setup( name = 'gudhi', packages=find_packages(), # find_namespace_packages(include=["gudhi*"]) @@ -75,10 +81,10 @@ setup( 'Source Code': 'https://github.com/GUDHI/gudhi-devel', 'License': 'https://gudhi.inria.fr/licensing/' }, - description='The Gudhi library is an open source library for Computational Topology and Topological Data ' \ - 'Analysis (TDA). It offers state-of-the-art algorithms to construct various types of simplicial complexes, ' \ - 'data structures to represent them, and algorithms to compute geometric approximations of shapes and ' \ - 'persistent homology.', + description='The Gudhi library is an open source library for ' \ + 'Computational Topology and Topological Data Analysis (TDA).', + long_description=long_description, + long_description_content_type='text/markdown', ext_modules = ext_modules, install_requires = ['cython','numpy >= 1.9',], setup_requires = ['numpy >= 1.9','pybind11',], -- cgit v1.2.3 From 5141caeff03f1e8c8c4ccae1ee7ca43fbcb2925f Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Sun, 31 May 2020 11:01:24 +0200 Subject: It was not markdown but rst... --- src/python/CMakeLists.txt | 2 +- src/python/introduction.md | 30 ------------------------------ src/python/introduction.rst | 33 +++++++++++++++++++++++++++++++++ src/python/setup.py.in | 2 +- 4 files changed, 35 insertions(+), 32 deletions(-) delete mode 100644 src/python/introduction.md create mode 100644 src/python/introduction.rst (limited to 'src/python/CMakeLists.txt') diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt index d4cb7477..fee6b6f5 100644 --- a/src/python/CMakeLists.txt +++ b/src/python/CMakeLists.txt @@ -236,7 +236,7 @@ if(PYTHONINTERP_FOUND) file(COPY "gudhi/weighted_rips_complex.py" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/gudhi") # Other .py files - file(COPY "introduction.md" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/") + file(COPY "introduction.rst" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/") add_custom_command( OUTPUT gudhi.so diff --git a/src/python/introduction.md b/src/python/introduction.md deleted file mode 100644 index 3277e0ac..00000000 --- a/src/python/introduction.md +++ /dev/null @@ -1,30 +0,0 @@ -![](https://gudhi.inria.fr/images/gudhi_architecture.png) - -#Introduction - -The Gudhi library is an open source library for Computational Topology and -Topological Data Analysis (TDA). It offers state-of-the-art algorithms -to construct various types of simplicial complexes, data structures to -represent them, and algorithms to compute geometric approximations of shapes -and persistent homology. - -The GUDHI library offers the following interoperable modules: -* Complexes: - * Cubical - * Simplicial: Rips, Witness, Alpha and Čech complexes - * Cover: Nerve and Graph induced complexes -* Data structures and basic operations: - * Simplex tree, Skeleton blockers and Toplex map - * Construction, update, filtration and simplification -* Topological descriptors computation -* Manifold reconstruction -* Topological descriptors tools: - * Bottleneck distance - * Statistical tools - * Persistence diagram and barcode - -For more information about Topological Data Analysis and its workflow, please -refer to the [Wikipedia TDA dedicated page][1]. - - [1]: https://en.wikipedia.org/wiki/Topological_data_analysis - diff --git a/src/python/introduction.rst b/src/python/introduction.rst new file mode 100644 index 00000000..2cc4642e --- /dev/null +++ b/src/python/introduction.rst @@ -0,0 +1,33 @@ +.. figure:: + https://gudhi.inria.fr/images/gudhi_architecture.png + :figclass: align-center + :width: 100 % + :alt: GUDHI + +Introduction +============ + +The Gudhi library is an open source library for Computational Topology and +Topological Data Analysis (TDA). It offers state-of-the-art algorithms +to construct various types of simplicial complexes, data structures to +represent them, and algorithms to compute geometric approximations of shapes +and persistent homology. + +The GUDHI library offers the following interoperable modules: + +* Complexes: + * Cubical + * Simplicial: Rips, Witness, Alpha and Čech complexes + * Cover: Nerve and Graph induced complexes +* Data structures and basic operations: + * Simplex tree, Skeleton blockers and Toplex map + * Construction, update, filtration and simplification +* Topological descriptors computation +* Manifold reconstruction +* Topological descriptors tools: + * Bottleneck distance + * Statistical tools + * Persistence diagram and barcode + +For more information about Topological Data Analysis and its workflow, please +refer to the `Wikipedia TDA dedicated page `_. diff --git a/src/python/setup.py.in b/src/python/setup.py.in index ff000a2c..4725bb44 100644 --- a/src/python/setup.py.in +++ b/src/python/setup.py.in @@ -65,7 +65,7 @@ for module in pybind11_modules: # read the contents of introduction.md this_directory = path.abspath(path.dirname(__file__)) -with open(path.join(this_directory, 'introduction.md'), encoding='utf-8') as f: +with open(path.join(this_directory, 'introduction.rst'), encoding='utf-8') as f: long_description = f.read() setup( -- cgit v1.2.3 From 4aff8dc700a0790373d82ae24076359c09ee04c8 Mon Sep 17 00:00:00 2001 From: Marc Glisse Date: Mon, 1 Jun 2020 15:24:28 +0200 Subject: Interface for hera's bottleneck_distance --- ext/hera | 2 +- .../modules/GUDHI_third_party_libraries.cmake | 1 + src/cmake/modules/GUDHI_user_version_target.cmake | 2 +- src/python/CMakeLists.txt | 8 +++- src/python/doc/bottleneck_distance_user.rst | 18 +++++-- src/python/gudhi/hera.cc | 56 ---------------------- src/python/gudhi/hera/__init__.py | 2 + src/python/gudhi/hera/bottleneck.cc | 45 +++++++++++++++++ src/python/gudhi/hera/wasserstein.cc | 56 ++++++++++++++++++++++ src/python/setup.py.in | 6 ++- src/python/test/test_bottleneck_distance.py | 6 ++- 11 files changed, 134 insertions(+), 68 deletions(-) delete mode 100644 src/python/gudhi/hera.cc create mode 100644 src/python/gudhi/hera/__init__.py create mode 100644 src/python/gudhi/hera/bottleneck.cc create mode 100644 src/python/gudhi/hera/wasserstein.cc (limited to 'src/python/CMakeLists.txt') diff --git a/ext/hera b/ext/hera index 0019cae9..2c5e6c60 160000 --- a/ext/hera +++ b/ext/hera @@ -1 +1 @@ -Subproject commit 0019cae9dc1e9d11aa03bc59681435ba7f21eea8 +Subproject commit 2c5e6c606ee37cd68bbe9f9915dba99f7677dd87 diff --git a/src/cmake/modules/GUDHI_third_party_libraries.cmake b/src/cmake/modules/GUDHI_third_party_libraries.cmake index f92fe93e..d80283d2 100644 --- a/src/cmake/modules/GUDHI_third_party_libraries.cmake +++ b/src/cmake/modules/GUDHI_third_party_libraries.cmake @@ -69,6 +69,7 @@ endif() # For those who dislike bundled dependencies, this indicates where to find a preinstalled Hera. set(HERA_WASSERSTEIN_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/ext/hera/wasserstein/include CACHE PATH "Directory where one can find Hera's wasserstein.h") +set(HERA_BOTTLENECK_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/ext/hera/bottleneck/include CACHE PATH "Directory where one can find Hera's bottleneck.h") option(WITH_GUDHI_USE_TBB "Build with Intel TBB parallelization" ON) diff --git a/src/cmake/modules/GUDHI_user_version_target.cmake b/src/cmake/modules/GUDHI_user_version_target.cmake index e99bb42d..491fa459 100644 --- a/src/cmake/modules/GUDHI_user_version_target.cmake +++ b/src/cmake/modules/GUDHI_user_version_target.cmake @@ -68,7 +68,7 @@ add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/src/GudhUI ${GUDHI_USER_VERSION_DIR}/GudhUI) add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E - copy_directory ${CMAKE_SOURCE_DIR}/ext/hera/wasserstein/include ${GUDHI_USER_VERSION_DIR}/ext/hera/wasserstein/include) + copy_directory ${CMAKE_SOURCE_DIR}/ext/hera ${GUDHI_USER_VERSION_DIR}/ext/hera) set(GUDHI_DIRECTORIES "doc;example;concept;utilities") diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt index 96dd3f6f..1e81cac8 100644 --- a/src/python/CMakeLists.txt +++ b/src/python/CMakeLists.txt @@ -130,7 +130,8 @@ if(PYTHONINTERP_FOUND) set(GUDHI_CYTHON_MODULES "${GUDHI_CYTHON_MODULES}'reader_utils', ") set(GUDHI_CYTHON_MODULES "${GUDHI_CYTHON_MODULES}'witness_complex', ") set(GUDHI_CYTHON_MODULES "${GUDHI_CYTHON_MODULES}'strong_witness_complex', ") - set(GUDHI_PYBIND11_MODULES "${GUDHI_PYBIND11_MODULES}'hera', ") + set(GUDHI_PYBIND11_MODULES "${GUDHI_PYBIND11_MODULES}'hera/wasserstein', ") + set(GUDHI_PYBIND11_MODULES "${GUDHI_PYBIND11_MODULES}'hera/bottleneck', ") if (NOT CGAL_VERSION VERSION_LESS 4.11.0) set(GUDHI_PYBIND11_MODULES "${GUDHI_PYBIND11_MODULES}'bottleneck', ") set(GUDHI_CYTHON_MODULES "${GUDHI_CYTHON_MODULES}'nerve_gic', ") @@ -236,6 +237,7 @@ if(PYTHONINTERP_FOUND) file(COPY "gudhi/point_cloud" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/gudhi") file(COPY "gudhi/weighted_rips_complex.py" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/gudhi") file(COPY "gudhi/dtm_rips_complex.py" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/gudhi") + file(COPY "gudhi/hera/__init__.py" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/gudhi/hera") add_custom_command( OUTPUT gudhi.so @@ -355,7 +357,9 @@ if(PYTHONINTERP_FOUND) COMMAND ${CMAKE_COMMAND} -E env "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}" ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/example/bottleneck_basic_example.py") - add_gudhi_py_test(test_bottleneck_distance) + if (PYBIND11_FOUND) + add_gudhi_py_test(test_bottleneck_distance) + endif() # Cover complex file(COPY ${CMAKE_SOURCE_DIR}/data/points/human.off DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/) diff --git a/src/python/doc/bottleneck_distance_user.rst b/src/python/doc/bottleneck_distance_user.rst index 89da89d3..49bd3706 100644 --- a/src/python/doc/bottleneck_distance_user.rst +++ b/src/python/doc/bottleneck_distance_user.rst @@ -9,14 +9,22 @@ Definition .. include:: bottleneck_distance_sum.inc -This implementation is based on ideas from "Geometry Helps in Bottleneck Matching and Related Problems" -:cite:`DBLP:journals/algorithmica/EfratIK01`. Another relevant publication, although it was not used is -"Geometry Helps to Compare Persistence Diagrams" :cite:`Kerber:2017:GHC:3047249.3064175`. +This implementation by François Godi is based on ideas from "Geometry Helps in Bottleneck Matching and Related Problems" +:cite:`DBLP:journals/algorithmica/EfratIK01` and requires `CGAL `_. -Function --------- .. autofunction:: gudhi.bottleneck_distance +This other implementation comes from `Hera +`_ (BSD-3-Clause) which is +based on "Geometry Helps to Compare Persistence Diagrams" +:cite:`Kerber:2017:GHC:3047249.3064175` by Michael Kerber, Dmitriy +Morozov, and Arnur Nigmetov. + +Beware that its approximation allows for a multiplicative error, while the function above uses an additive error. + +.. autofunction:: gudhi.hera.bottleneck_distance + + Distance computation -------------------- diff --git a/src/python/gudhi/hera.cc b/src/python/gudhi/hera.cc deleted file mode 100644 index ea80a9a8..00000000 --- a/src/python/gudhi/hera.cc +++ /dev/null @@ -1,56 +0,0 @@ -/* This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT. - * See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details. - * Author(s): Marc Glisse - * - * Copyright (C) 2020 Inria - * - * Modification(s): - * - YYYY/MM Author: Description of the modification - */ - -#include // Hera - -#include - -double wasserstein_distance( - Dgm d1, Dgm d2, - double wasserstein_power, double internal_p, - double delta) -{ - // I *think* the call to request() has to be before releasing the GIL. - auto diag1 = numpy_to_range_of_pairs(d1); - auto diag2 = numpy_to_range_of_pairs(d2); - - py::gil_scoped_release release; - - hera::AuctionParams params; - params.wasserstein_power = wasserstein_power; - // hera encodes infinity as -1... - if(std::isinf(internal_p)) internal_p = hera::get_infinity(); - params.internal_p = internal_p; - params.delta = delta; - // The extra parameters are purposedly not exposed for now. - return hera::wasserstein_dist(diag1, diag2, params); -} - -PYBIND11_MODULE(hera, m) { - m.def("wasserstein_distance", &wasserstein_distance, - py::arg("X"), py::arg("Y"), - py::arg("order") = 1, - py::arg("internal_p") = std::numeric_limits::infinity(), - py::arg("delta") = .01, - R"pbdoc( - Compute the Wasserstein distance between two diagrams. - Points at infinity are supported. - - Parameters: - X (n x 2 numpy array): First diagram - Y (n x 2 numpy array): Second diagram - order (float): Wasserstein exponent W_q - internal_p (float): Internal Minkowski norm L^p in R^2 - delta (float): Relative error 1+delta - - Returns: - float: Approximate Wasserstein distance W_q(X,Y) - )pbdoc"); -} diff --git a/src/python/gudhi/hera/__init__.py b/src/python/gudhi/hera/__init__.py new file mode 100644 index 00000000..044f81cd --- /dev/null +++ b/src/python/gudhi/hera/__init__.py @@ -0,0 +1,2 @@ +from .wasserstein import wasserstein_distance +from .bottleneck import bottleneck_distance diff --git a/src/python/gudhi/hera/bottleneck.cc b/src/python/gudhi/hera/bottleneck.cc new file mode 100644 index 00000000..e00b4682 --- /dev/null +++ b/src/python/gudhi/hera/bottleneck.cc @@ -0,0 +1,45 @@ +/* This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT. + * See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details. + * Author(s): Marc Glisse + * + * Copyright (C) 2020 Inria + * + * Modification(s): + * - YYYY/MM Author: Description of the modification + */ + +#include // Hera + +#include + +double bottleneck_distance(Dgm d1, Dgm d2, double delta) +{ + // I *think* the call to request() has to be before releasing the GIL. + auto diag1 = numpy_to_range_of_pairs(d1); + auto diag2 = numpy_to_range_of_pairs(d2); + + py::gil_scoped_release release; + + if (delta == 0) + return hera::bottleneckDistExact(diag1, diag2); + else + return hera::bottleneckDistApprox(diag1, diag2, delta); +} + +PYBIND11_MODULE(bottleneck, m) { + m.def("bottleneck_distance", &bottleneck_distance, + py::arg("X"), py::arg("Y"), + py::arg("delta") = .01, + R"pbdoc( + Compute the Bottleneck distance between two diagrams. + Points at infinity are supported. + + Parameters: + X (n x 2 numpy array): First diagram + Y (n x 2 numpy array): Second diagram + delta (float): Relative error 1+delta + + Returns: + float: (approximate) bottleneck distance d_B(X,Y) + )pbdoc"); +} diff --git a/src/python/gudhi/hera/wasserstein.cc b/src/python/gudhi/hera/wasserstein.cc new file mode 100644 index 00000000..1a21f02f --- /dev/null +++ b/src/python/gudhi/hera/wasserstein.cc @@ -0,0 +1,56 @@ +/* This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT. + * See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details. + * Author(s): Marc Glisse + * + * Copyright (C) 2020 Inria + * + * Modification(s): + * - YYYY/MM Author: Description of the modification + */ + +#include // Hera + +#include + +double wasserstein_distance( + Dgm d1, Dgm d2, + double wasserstein_power, double internal_p, + double delta) +{ + // I *think* the call to request() has to be before releasing the GIL. + auto diag1 = numpy_to_range_of_pairs(d1); + auto diag2 = numpy_to_range_of_pairs(d2); + + py::gil_scoped_release release; + + hera::AuctionParams params; + params.wasserstein_power = wasserstein_power; + // hera encodes infinity as -1... + if(std::isinf(internal_p)) internal_p = hera::get_infinity(); + params.internal_p = internal_p; + params.delta = delta; + // The extra parameters are purposedly not exposed for now. + return hera::wasserstein_dist(diag1, diag2, params); +} + +PYBIND11_MODULE(wasserstein, m) { + m.def("wasserstein_distance", &wasserstein_distance, + py::arg("X"), py::arg("Y"), + py::arg("order") = 1, + py::arg("internal_p") = std::numeric_limits::infinity(), + py::arg("delta") = .01, + R"pbdoc( + Compute the Wasserstein distance between two diagrams. + Points at infinity are supported. + + Parameters: + X (n x 2 numpy array): First diagram + Y (n x 2 numpy array): Second diagram + order (float): Wasserstein exponent W_q + internal_p (float): Internal Minkowski norm L^p in R^2 + delta (float): Relative error 1+delta + + Returns: + float: Approximate Wasserstein distance W_q(X,Y) + )pbdoc"); +} diff --git a/src/python/setup.py.in b/src/python/setup.py.in index b9f4e3f0..9b3c7521 100644 --- a/src/python/setup.py.in +++ b/src/python/setup.py.in @@ -48,10 +48,12 @@ ext_modules = cythonize(ext_modules) for module in pybind11_modules: my_include_dirs = include_dirs + [pybind11.get_include(False), pybind11.get_include(True)] - if module == 'hera': + if module == 'hera/wasserstein': my_include_dirs = ['@HERA_WASSERSTEIN_INCLUDE_DIR@'] + my_include_dirs + elif module == 'hera/bottleneck': + my_include_dirs = ['@HERA_BOTTLENECK_INCLUDE_DIR@'] + my_include_dirs ext_modules.append(Extension( - 'gudhi.' + module, + 'gudhi.' + module.replace('/', '.'), sources = [source_dir + module + '.cc'], language = 'c++', include_dirs = my_include_dirs, diff --git a/src/python/test/test_bottleneck_distance.py b/src/python/test/test_bottleneck_distance.py index 70b2abad..6915bea8 100755 --- a/src/python/test/test_bottleneck_distance.py +++ b/src/python/test/test_bottleneck_distance.py @@ -9,6 +9,8 @@ """ import gudhi +import gudhi.hera +import pytest __author__ = "Vincent Rouvreau" __copyright__ = "Copyright (C) 2016 Inria" @@ -19,5 +21,7 @@ def test_basic_bottleneck(): diag1 = [[2.7, 3.7], [9.6, 14.0], [34.2, 34.974], [3.0, float("Inf")]] diag2 = [[2.8, 4.45], [9.5, 14.1], [3.2, float("Inf")]] - assert gudhi.bottleneck_distance(diag1, diag2, 0.1) == 0.8081763781405569 assert gudhi.bottleneck_distance(diag1, diag2) == 0.75 + assert gudhi.bottleneck_distance(diag1, diag2, 0.1) == pytest.approx(0.75, abs=0.1) + assert gudhi.hera.bottleneck_distance(diag1, diag2, 0) == 0.75 + assert gudhi.hera.bottleneck_distance(diag1, diag2, 0.1) == pytest.approx(0.75, rel=0.1) -- cgit v1.2.3 From e4a59f9ec6685534b03474cbcfe9395d601516e2 Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Thu, 11 Jun 2020 07:23:23 +0200 Subject: Add distributor the right to add dll to the package --- .github/workflows/pip-packaging-windows.yml | 7 ++----- CMakeGUDHIVersion.txt | 2 +- src/python/CMakeLists.txt | 5 ++++- src/python/gudhi/__init__.py.in | 3 +++ src/python/gudhi/_distributor_init.py | 18 ++++++++++++++++++ 5 files changed, 28 insertions(+), 7 deletions(-) create mode 100644 src/python/gudhi/_distributor_init.py (limited to 'src/python/CMakeLists.txt') diff --git a/.github/workflows/pip-packaging-windows.yml b/.github/workflows/pip-packaging-windows.yml index 95205258..fe4d0227 100644 --- a/.github/workflows/pip-packaging-windows.yml +++ b/.github/workflows/pip-packaging-windows.yml @@ -35,14 +35,11 @@ jobs: cd build cmake -DCMAKE_BUILD_TYPE=Release -DGMP_INCLUDE_DIR="c:/vcpkg/installed/x64-windows/include" -DGMP_LIBRARIES="c:/vcpkg/installed/x64-windows/lib/mpir.lib" -DGMP_LIBRARIES_DIR="c:/vcpkg/installed/x64-windows/lib" -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DPython_ADDITIONAL_VERSIONS=3 .. cd src/python + cp c:/vcpkg/installed/x64-windows/bin/mpfr.dll .libs/ + cp c:/vcpkg/installed/x64-windows/bin/mpir.dll .libs/ python setup.py bdist_wheel - name: Publish on PyPi env: TWINE_USERNAME: __token__ TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} run: python -m twine upload --repository-url https://test.pypi.org/legacy/ build/src/python/dist/* - - name: Upload artifacts - uses: actions/upload-artifact@v1 - with: - name: dependencies - path: c:/vcpkg/installed/x64-windows/bin/ diff --git a/CMakeGUDHIVersion.txt b/CMakeGUDHIVersion.txt index 4ad3921d..794b6ebf 100644 --- a/CMakeGUDHIVersion.txt +++ b/CMakeGUDHIVersion.txt @@ -1,6 +1,6 @@ set (GUDHI_MAJOR_VERSION 3) set (GUDHI_MINOR_VERSION 2) -set (GUDHI_PATCH_VERSION 0a16) +set (GUDHI_PATCH_VERSION 0a17) set(GUDHI_VERSION ${GUDHI_MAJOR_VERSION}.${GUDHI_MINOR_VERSION}.${GUDHI_PATCH_VERSION}) message(STATUS "GUDHI version : ${GUDHI_VERSION}") diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt index fee6b6f5..b35c8de7 100644 --- a/src/python/CMakeLists.txt +++ b/src/python/CMakeLists.txt @@ -235,8 +235,11 @@ if(PYTHONINTERP_FOUND) file(COPY "gudhi/point_cloud" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/gudhi") file(COPY "gudhi/weighted_rips_complex.py" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/gudhi") - # Other .py files + # Some files for pip package file(COPY "introduction.rst" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/") + file(COPY "gudhi/_distributor_init.py" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/gudhi") + file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/gudhi/.libs") + message(" o o o ${CMAKE_CURRENT_BINARY_DIR}/gudhi/.libs") add_custom_command( OUTPUT gudhi.so diff --git a/src/python/gudhi/__init__.py.in b/src/python/gudhi/__init__.py.in index 79e12fbc..e4198dcf 100644 --- a/src/python/gudhi/__init__.py.in +++ b/src/python/gudhi/__init__.py.in @@ -10,6 +10,9 @@ from importlib import import_module from sys import exc_info +# Allow distributors to run custom init code +from . import _distributor_init + __author__ = "GUDHI Editorial Board" __copyright__ = "Copyright (C) 2016 Inria" __license__ = "https://gudhi.inria.fr/licensing/" diff --git a/src/python/gudhi/_distributor_init.py b/src/python/gudhi/_distributor_init.py new file mode 100644 index 00000000..0ed451f9 --- /dev/null +++ b/src/python/gudhi/_distributor_init.py @@ -0,0 +1,18 @@ +''' +Helper to preload windows dlls to prevent dll not found errors. +Once a DLL is preloaded, its namespace is made available to any subsequent DLL. +''' +import os +from ctypes import WinDLL +import glob +if os.name == 'nt': + # convention for storing / loading the DLL from gudhi/.libs/, if present + try: + basedir = os.path.dirname(__file__) + except: + pass + else: + libs_dir = os.path.abspath(os.path.join(basedir, '.libs')) + if os.path.isdir(libs_dir): + for filename in glob.glob(os.path.join(libs_dir, '*dll')): + WinDLL(os.path.abspath(filename)) -- cgit v1.2.3 From aec85514aeaeac51d1589e6a24c4c393df892f91 Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Thu, 11 Jun 2020 12:03:49 +0200 Subject: Upload dlls from gudhi directory --- .github/workflows/pip-packaging-windows.yml | 4 ++-- CMakeGUDHIVersion.txt | 2 +- src/python/CMakeLists.txt | 3 --- src/python/gudhi/__init__.py.in | 3 --- src/python/gudhi/_distributor_init.py | 18 ------------------ src/python/setup.py.in | 1 + 6 files changed, 4 insertions(+), 27 deletions(-) delete mode 100644 src/python/gudhi/_distributor_init.py (limited to 'src/python/CMakeLists.txt') diff --git a/.github/workflows/pip-packaging-windows.yml b/.github/workflows/pip-packaging-windows.yml index f229b74f..d529d4f3 100644 --- a/.github/workflows/pip-packaging-windows.yml +++ b/.github/workflows/pip-packaging-windows.yml @@ -35,8 +35,8 @@ jobs: cd build cmake -DCMAKE_BUILD_TYPE=Release -DGMP_INCLUDE_DIR="c:/vcpkg/installed/x64-windows/include" -DGMP_LIBRARIES="c:/vcpkg/installed/x64-windows/lib/mpir.lib" -DGMP_LIBRARIES_DIR="c:/vcpkg/installed/x64-windows/lib" -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DPython_ADDITIONAL_VERSIONS=3 .. cd src/python - cp c:/vcpkg/installed/x64-windows/bin/mpfr.dll gudhi/.libs/ - cp c:/vcpkg/installed/x64-windows/bin/mpir.dll gudhi/.libs/ + cp c:/vcpkg/installed/x64-windows/bin/mpfr.dll gudhi/ + cp c:/vcpkg/installed/x64-windows/bin/mpir.dll gudhi/ python setup.py bdist_wheel - name: Publish on PyPi env: diff --git a/CMakeGUDHIVersion.txt b/CMakeGUDHIVersion.txt index 21f3d58c..85d69190 100644 --- a/CMakeGUDHIVersion.txt +++ b/CMakeGUDHIVersion.txt @@ -1,6 +1,6 @@ set (GUDHI_MAJOR_VERSION 3) set (GUDHI_MINOR_VERSION 2) -set (GUDHI_PATCH_VERSION 0a19) +set (GUDHI_PATCH_VERSION 0a20) set(GUDHI_VERSION ${GUDHI_MAJOR_VERSION}.${GUDHI_MINOR_VERSION}.${GUDHI_PATCH_VERSION}) message(STATUS "GUDHI version : ${GUDHI_VERSION}") diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt index b35c8de7..966f5ef0 100644 --- a/src/python/CMakeLists.txt +++ b/src/python/CMakeLists.txt @@ -237,9 +237,6 @@ if(PYTHONINTERP_FOUND) # Some files for pip package file(COPY "introduction.rst" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/") - file(COPY "gudhi/_distributor_init.py" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/gudhi") - file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/gudhi/.libs") - message(" o o o ${CMAKE_CURRENT_BINARY_DIR}/gudhi/.libs") add_custom_command( OUTPUT gudhi.so diff --git a/src/python/gudhi/__init__.py.in b/src/python/gudhi/__init__.py.in index e4198dcf..79e12fbc 100644 --- a/src/python/gudhi/__init__.py.in +++ b/src/python/gudhi/__init__.py.in @@ -10,9 +10,6 @@ from importlib import import_module from sys import exc_info -# Allow distributors to run custom init code -from . import _distributor_init - __author__ = "GUDHI Editorial Board" __copyright__ = "Copyright (C) 2016 Inria" __license__ = "https://gudhi.inria.fr/licensing/" diff --git a/src/python/gudhi/_distributor_init.py b/src/python/gudhi/_distributor_init.py deleted file mode 100644 index 6f3dc8a2..00000000 --- a/src/python/gudhi/_distributor_init.py +++ /dev/null @@ -1,18 +0,0 @@ -''' -Helper to preload windows dlls to prevent dll not found errors. -Once a DLL is preloaded, its namespace is made available to any subsequent DLL. -''' -import os -if os.name == 'nt': - # convention for storing / loading the DLL from gudhi/.libs/, if present - try: - basedir = os.path.dirname(__file__) - except: - pass - else: - libs_dir = os.path.abspath(os.path.join(basedir, '.libs')) - if os.path.isdir(libs_dir): - from ctypes import WinDLL - import glob - for filename in glob.glob(os.path.join(libs_dir, '*dll')): - WinDLL(os.path.abspath(filename)) diff --git a/src/python/setup.py.in b/src/python/setup.py.in index 875f1577..07ad818f 100644 --- a/src/python/setup.py.in +++ b/src/python/setup.py.in @@ -86,4 +86,5 @@ setup( ext_modules = ext_modules, install_requires = ['numpy >= 1.9',], setup_requires = ['cython','numpy >= 1.9','pybind11',], + package_data={"": ["*.dll"], }, ) -- cgit v1.2.3 From 90c796781ad5b32a58bf1e2ca496a3498ce94154 Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Wed, 24 Jun 2020 08:41:18 +0200 Subject: secure library_dirs in setup.py for Windows compilation --- src/python/CMakeLists.txt | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'src/python/CMakeLists.txt') diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt index 04f64ce3..4da351a1 100644 --- a/src/python/CMakeLists.txt +++ b/src/python/CMakeLists.txt @@ -14,6 +14,13 @@ function( add_GUDHI_PYTHON_lib THE_LIB ) endif(EXISTS ${THE_LIB}) endfunction( add_GUDHI_PYTHON_lib ) +function( add_GUDHI_PYTHON_lib_dir THE_LIB_DIR ) + # deals when it is not set - error on windows + if(EXISTS ${THE_LIB_DIR}) + set(GUDHI_PYTHON_LIBRARY_DIRS "${GUDHI_PYTHON_LIBRARY_DIRS}'${THE_LIB_DIR}', ") + endif(EXISTS ${THE_LIB_DIR}) +endfunction( add_GUDHI_PYTHON_lib_dir ) + # THE_TEST is the python test file name (without .py extension) containing tests functions function( add_gudhi_py_test THE_TEST ) if(PYTEST_FOUND) @@ -154,7 +161,7 @@ if(PYTHONINTERP_FOUND) else(CGAL_HEADER_ONLY) add_gudhi_debug_info("CGAL version ${CGAL_VERSION}") add_GUDHI_PYTHON_lib("${CGAL_LIBRARY}") - set(GUDHI_PYTHON_LIBRARY_DIRS "${GUDHI_PYTHON_LIBRARY_DIRS}'${CGAL_LIBRARIES_DIR}', ") + add_GUDHI_PYTHON_lib_dir("${CGAL_LIBRARIES_DIR}") message("** Add CGAL ${CGAL_LIBRARIES_DIR}") # If CGAL is not header only, CGAL library may link with boost system, if(CMAKE_BUILD_TYPE MATCHES Debug) @@ -162,7 +169,7 @@ if(PYTHONINTERP_FOUND) else() add_GUDHI_PYTHON_lib("${Boost_SYSTEM_LIBRARY_RELEASE}") endif() - set(GUDHI_PYTHON_LIBRARY_DIRS "${GUDHI_PYTHON_LIBRARY_DIRS}'${Boost_LIBRARY_DIRS}', ") + add_GUDHI_PYTHON_lib_dir("${Boost_LIBRARY_DIRS}") message("** Add Boost ${Boost_LIBRARY_DIRS}") endif(CGAL_HEADER_ONLY) # GMP and GMPXX are not required, but if present, CGAL will link with them. @@ -170,13 +177,13 @@ if(PYTHONINTERP_FOUND) add_gudhi_debug_info("GMP_LIBRARIES = ${GMP_LIBRARIES}") set(GUDHI_PYTHON_EXTRA_COMPILE_ARGS "${GUDHI_PYTHON_EXTRA_COMPILE_ARGS}'-DCGAL_USE_GMP', ") add_GUDHI_PYTHON_lib("${GMP_LIBRARIES}") - set(GUDHI_PYTHON_LIBRARY_DIRS "${GUDHI_PYTHON_LIBRARY_DIRS}'${GMP_LIBRARIES_DIR}', ") + add_GUDHI_PYTHON_lib_dir("${GMP_LIBRARIES_DIR}") message("** Add gmp ${GMP_LIBRARIES_DIR}") if(GMPXX_FOUND) add_gudhi_debug_info("GMPXX_LIBRARIES = ${GMPXX_LIBRARIES}") set(GUDHI_PYTHON_EXTRA_COMPILE_ARGS "${GUDHI_PYTHON_EXTRA_COMPILE_ARGS}'-DCGAL_USE_GMPXX', ") add_GUDHI_PYTHON_lib("${GMPXX_LIBRARIES}") - set(GUDHI_PYTHON_LIBRARY_DIRS "${GUDHI_PYTHON_LIBRARY_DIRS}'${GMPXX_LIBRARIES_DIR}', ") + add_GUDHI_PYTHON_lib_dir("${GMPXX_LIBRARIES_DIR}") message("** Add gmpxx ${GMPXX_LIBRARIES_DIR}") endif(GMPXX_FOUND) endif(GMP_FOUND) @@ -188,7 +195,7 @@ if(PYTHONINTERP_FOUND) if(NOT MPFR_LIBRARIES_DIR) get_filename_component(MPFR_LIBRARIES_DIR ${MPFR_LIBRARIES} PATH) endif(NOT MPFR_LIBRARIES_DIR) - set(GUDHI_PYTHON_LIBRARY_DIRS "${GUDHI_PYTHON_LIBRARY_DIRS}'${MPFR_LIBRARIES_DIR}', ") + add_GUDHI_PYTHON_lib_dir("${MPFR_LIBRARIES_DIR}") message("** Add mpfr ${MPFR_LIBRARIES}") endif(MPFR_FOUND) endif(CGAL_FOUND) @@ -216,7 +223,7 @@ if(PYTHONINTERP_FOUND) add_GUDHI_PYTHON_lib("${TBB_RELEASE_LIBRARY}") add_GUDHI_PYTHON_lib("${TBB_MALLOC_RELEASE_LIBRARY}") endif() - set(GUDHI_PYTHON_LIBRARY_DIRS "${GUDHI_PYTHON_LIBRARY_DIRS}'${TBB_LIBRARY_DIRS}', ") + add_GUDHI_PYTHON_lib_dir("${TBB_LIBRARY_DIRS}") message("** Add tbb ${TBB_LIBRARY_DIRS}") set(GUDHI_PYTHON_INCLUDE_DIRS "${GUDHI_PYTHON_INCLUDE_DIRS}'${TBB_INCLUDE_DIRS}', ") endif() -- cgit v1.2.3 From f0cafaee8c0958421b53463d52a5884b4891c7c7 Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Wed, 24 Jun 2020 16:07:47 +0200 Subject: Try to set MPFR_LIBRARIES_DIR --- .appveyor.yml | 10 +++++----- src/python/CMakeLists.txt | 8 +++++--- 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'src/python/CMakeLists.txt') diff --git a/.appveyor.yml b/.appveyor.yml index ae40071a..122c4749 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -11,23 +11,23 @@ configuration: environment: # update the vcpkg cache even if build fails APPVEYOR_SAVE_CACHE_ON_ERROR: true + PYTHON: "C:\\Python37-x64" + CMAKE_GMP_FLAGS: -DGMP_INCLUDE_DIR="c:/Tools/vcpkg/installed/x64-windows/include" -DGMP_LIBRARIES="c:/Tools/vcpkg/installed/x64-windows/lib/mpir.lib" + CMAKE_MPFR_FLAGS: -DMPFR_INCLUDE_DIR="c:/Tools/vcpkg/installed/x64-windows/include" -DMPFR_LIBRARIES="c:/Tools/vcpkg/installed/x64-windows/lib/mpfr.lib" -DMPFR_LIBRARIES_DIR="c:/Tools/vcpkg/installed/x64-windows/lib/" + CMAKE_VCPKG_FLAGS: -DCMAKE_TOOLCHAIN_FILE=c:/Tools/vcpkg/scripts/buildsystems/vcpkg.cmake matrix: - target: Examples CMAKE_FLAGS: -DWITH_GUDHI_EXAMPLE=ON -DWITH_GUDHI_TEST=OFF -DWITH_GUDHI_UTILITIES=OFF -DWITH_GUDHI_PYTHON=OFF - PYTHON: "C:\\Python37-x64" - target: UnitaryTests CMAKE_FLAGS: -DWITH_GUDHI_EXAMPLE=OFF -DWITH_GUDHI_TEST=ON -DWITH_GUDHI_UTILITIES=OFF -DWITH_GUDHI_PYTHON=OFF - PYTHON: "C:\\Python37-x64" - target: Utilities CMAKE_FLAGS: -DWITH_GUDHI_EXAMPLE=OFF -DWITH_GUDHI_TEST=OFF -DWITH_GUDHI_UTILITIES=ON -DWITH_GUDHI_PYTHON=OFF - PYTHON: "C:\\Python37-x64" - target: Python CMAKE_FLAGS: -DWITH_GUDHI_EXAMPLE=OFF -DWITH_GUDHI_TEST=OFF -DWITH_GUDHI_UTILITIES=OFF -DWITH_GUDHI_PYTHON=ON - PYTHON: "C:\\Python37-x64" cache: @@ -55,7 +55,7 @@ install: build_script: - mkdir build - cd build - - cmake -G "Visual Studio 15 2017 Win64" %CMAKE_FLAGS% -DGMP_INCLUDE_DIR="c:/Tools/vcpkg/installed/x64-windows/include" -DGMP_LIBRARIES="c:/Tools/vcpkg/installed/x64-windows/lib/mpir.lib" -DMPFR_INCLUDE_DIR="c:/Tools/vcpkg/installed/x64-windows/include" -DMPFR_LIBRARIES="c:/Tools/vcpkg/installed/x64-windows/lib/mpfr.lib" -DCMAKE_TOOLCHAIN_FILE=c:/Tools/vcpkg/scripts/buildsystems/vcpkg.cmake .. + - cmake -G "Visual Studio 15 2017 Win64" %CMAKE_FLAGS% %CMAKE_GMP_FLAGS% %CMAKE_MPFR_FLAGS% %CMAKE_VCPKG_FLAGS% .. - if [%target%]==[Python] ( cd src/python & type setup.py & diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt index 4da351a1..ba4f3e17 100644 --- a/src/python/CMakeLists.txt +++ b/src/python/CMakeLists.txt @@ -16,9 +16,11 @@ endfunction( add_GUDHI_PYTHON_lib ) function( add_GUDHI_PYTHON_lib_dir THE_LIB_DIR ) # deals when it is not set - error on windows - if(EXISTS ${THE_LIB_DIR}) - set(GUDHI_PYTHON_LIBRARY_DIRS "${GUDHI_PYTHON_LIBRARY_DIRS}'${THE_LIB_DIR}', ") - endif(EXISTS ${THE_LIB_DIR}) + foreach(LIB_DIR ${THE_LIB_DIR}) + if(EXISTS ${LIB_DIR}) + set(GUDHI_PYTHON_LIBRARY_DIRS "${GUDHI_PYTHON_LIBRARY_DIRS}'${LIB_DIR}', ") + endif(EXISTS ${LIB_DIR}) + endforeach() endfunction( add_GUDHI_PYTHON_lib_dir ) # THE_TEST is the python test file name (without .py extension) containing tests functions -- cgit v1.2.3 From 9089073e18c8335da0356b2e328c35aaf3b65813 Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Wed, 24 Jun 2020 17:08:29 +0200 Subject: Add some debug traces on mpfr release/debug packages --- src/python/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/python/CMakeLists.txt') diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt index ba4f3e17..459642e9 100644 --- a/src/python/CMakeLists.txt +++ b/src/python/CMakeLists.txt @@ -198,7 +198,7 @@ if(PYTHONINTERP_FOUND) get_filename_component(MPFR_LIBRARIES_DIR ${MPFR_LIBRARIES} PATH) endif(NOT MPFR_LIBRARIES_DIR) add_GUDHI_PYTHON_lib_dir("${MPFR_LIBRARIES_DIR}") - message("** Add mpfr ${MPFR_LIBRARIES}") + message("** Add mpfr ${MPFR_LIBRARIES} - release ${MPFR_LIBRARIES_RELEASE} - debug ${MPFR_LIBRARIES_DEBUG}") endif(MPFR_FOUND) endif(CGAL_FOUND) -- cgit v1.2.3 From 3e2c0e3554f35183ccf3779f87f5b70034d69156 Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Wed, 24 Jun 2020 22:55:37 +0200 Subject: Only mpfr is a list --- src/python/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/python/CMakeLists.txt') diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt index 459642e9..3b8198bd 100644 --- a/src/python/CMakeLists.txt +++ b/src/python/CMakeLists.txt @@ -16,11 +16,9 @@ endfunction( add_GUDHI_PYTHON_lib ) function( add_GUDHI_PYTHON_lib_dir THE_LIB_DIR ) # deals when it is not set - error on windows - foreach(LIB_DIR ${THE_LIB_DIR}) if(EXISTS ${LIB_DIR}) set(GUDHI_PYTHON_LIBRARY_DIRS "${GUDHI_PYTHON_LIBRARY_DIRS}'${LIB_DIR}', ") endif(EXISTS ${LIB_DIR}) - endforeach() endfunction( add_GUDHI_PYTHON_lib_dir ) # THE_TEST is the python test file name (without .py extension) containing tests functions @@ -192,7 +190,9 @@ if(PYTHONINTERP_FOUND) if(MPFR_FOUND) add_gudhi_debug_info("MPFR_LIBRARIES = ${MPFR_LIBRARIES}") set(GUDHI_PYTHON_EXTRA_COMPILE_ARGS "${GUDHI_PYTHON_EXTRA_COMPILE_ARGS}'-DCGAL_USE_MPFR', ") - add_GUDHI_PYTHON_lib("${MPFR_LIBRARIES}") + foreach(MPFR_LIB ${MPFR_LIBRARIES}) + add_GUDHI_PYTHON_lib("${MPFR_LIB}") + endforeach() # In case CGAL is not header only, all MPFR variables are set except MPFR_LIBRARIES_DIR - Just set it if(NOT MPFR_LIBRARIES_DIR) get_filename_component(MPFR_LIBRARIES_DIR ${MPFR_LIBRARIES} PATH) -- cgit v1.2.3 From 078db27a01c696bba81737f3b722255af7fa2619 Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Thu, 25 Jun 2020 07:17:22 +0200 Subject: Clean up the modifications --- .appveyor.yml | 2 +- src/python/CMakeLists.txt | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'src/python/CMakeLists.txt') diff --git a/.appveyor.yml b/.appveyor.yml index 122c4749..a257debc 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -13,7 +13,7 @@ environment: APPVEYOR_SAVE_CACHE_ON_ERROR: true PYTHON: "C:\\Python37-x64" CMAKE_GMP_FLAGS: -DGMP_INCLUDE_DIR="c:/Tools/vcpkg/installed/x64-windows/include" -DGMP_LIBRARIES="c:/Tools/vcpkg/installed/x64-windows/lib/mpir.lib" - CMAKE_MPFR_FLAGS: -DMPFR_INCLUDE_DIR="c:/Tools/vcpkg/installed/x64-windows/include" -DMPFR_LIBRARIES="c:/Tools/vcpkg/installed/x64-windows/lib/mpfr.lib" -DMPFR_LIBRARIES_DIR="c:/Tools/vcpkg/installed/x64-windows/lib/" + CMAKE_MPFR_FLAGS: -DMPFR_INCLUDE_DIR="c:/Tools/vcpkg/installed/x64-windows/include" -DMPFR_LIBRARIES="c:/Tools/vcpkg/installed/x64-windows/lib/mpfr.lib" CMAKE_VCPKG_FLAGS: -DCMAKE_TOOLCHAIN_FILE=c:/Tools/vcpkg/scripts/buildsystems/vcpkg.cmake matrix: diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt index 3b8198bd..c9f30bcf 100644 --- a/src/python/CMakeLists.txt +++ b/src/python/CMakeLists.txt @@ -177,6 +177,10 @@ if(PYTHONINTERP_FOUND) add_gudhi_debug_info("GMP_LIBRARIES = ${GMP_LIBRARIES}") set(GUDHI_PYTHON_EXTRA_COMPILE_ARGS "${GUDHI_PYTHON_EXTRA_COMPILE_ARGS}'-DCGAL_USE_GMP', ") add_GUDHI_PYTHON_lib("${GMP_LIBRARIES}") + if(NOT GMP_LIBRARIES_DIR) + get_filename_component(GMP_LIBRARIES_DIR ${GMP_LIBRARIES} PATH) + message("GMP_LIBRARIES_DIR from GMP_LIBRARIES set to ${GMP_LIBRARIES_DIR}") + endif(NOT GMP_LIBRARIES_DIR) add_GUDHI_PYTHON_lib_dir("${GMP_LIBRARIES_DIR}") message("** Add gmp ${GMP_LIBRARIES_DIR}") if(GMPXX_FOUND) @@ -190,15 +194,14 @@ if(PYTHONINTERP_FOUND) if(MPFR_FOUND) add_gudhi_debug_info("MPFR_LIBRARIES = ${MPFR_LIBRARIES}") set(GUDHI_PYTHON_EXTRA_COMPILE_ARGS "${GUDHI_PYTHON_EXTRA_COMPILE_ARGS}'-DCGAL_USE_MPFR', ") - foreach(MPFR_LIB ${MPFR_LIBRARIES}) - add_GUDHI_PYTHON_lib("${MPFR_LIB}") - endforeach() + add_GUDHI_PYTHON_lib("${MPFR_LIBRARIES}") # In case CGAL is not header only, all MPFR variables are set except MPFR_LIBRARIES_DIR - Just set it if(NOT MPFR_LIBRARIES_DIR) get_filename_component(MPFR_LIBRARIES_DIR ${MPFR_LIBRARIES} PATH) + message("MPFR_LIBRARIES_DIR from MPFR_LIBRARIES set to ${MPFR_LIBRARIES_DIR}") endif(NOT MPFR_LIBRARIES_DIR) add_GUDHI_PYTHON_lib_dir("${MPFR_LIBRARIES_DIR}") - message("** Add mpfr ${MPFR_LIBRARIES} - release ${MPFR_LIBRARIES_RELEASE} - debug ${MPFR_LIBRARIES_DEBUG}") + message("** Add mpfr ${MPFR_LIBRARIES_DIR} - release ${MPFR_LIBRARIES_DIR_RELEASE} - debug ${MPFR_LIBRARIES_DIR_DEBUG}") endif(MPFR_FOUND) endif(CGAL_FOUND) -- cgit v1.2.3 From 8116cae8a3cdd5d9c02725086733ae5a33f39634 Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Thu, 25 Jun 2020 08:54:00 +0200 Subject: Error messages --- src/python/CMakeLists.txt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/python/CMakeLists.txt') diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt index c9f30bcf..0182e4f5 100644 --- a/src/python/CMakeLists.txt +++ b/src/python/CMakeLists.txt @@ -16,9 +16,11 @@ endfunction( add_GUDHI_PYTHON_lib ) function( add_GUDHI_PYTHON_lib_dir THE_LIB_DIR ) # deals when it is not set - error on windows - if(EXISTS ${LIB_DIR}) - set(GUDHI_PYTHON_LIBRARY_DIRS "${GUDHI_PYTHON_LIBRARY_DIRS}'${LIB_DIR}', ") - endif(EXISTS ${LIB_DIR}) + if(EXISTS ${THE_LIB_DIR}) + set(GUDHI_PYTHON_LIBRARY_DIRS "${GUDHI_PYTHON_LIBRARY_DIRS}'${THE_LIB_DIR}', ") + else() + message("add_GUDHI_PYTHON_lib_dir - '${THE_LIB_DIR}' does not exist") + endif() endfunction( add_GUDHI_PYTHON_lib_dir ) # THE_TEST is the python test file name (without .py extension) containing tests functions @@ -201,7 +203,7 @@ if(PYTHONINTERP_FOUND) message("MPFR_LIBRARIES_DIR from MPFR_LIBRARIES set to ${MPFR_LIBRARIES_DIR}") endif(NOT MPFR_LIBRARIES_DIR) add_GUDHI_PYTHON_lib_dir("${MPFR_LIBRARIES_DIR}") - message("** Add mpfr ${MPFR_LIBRARIES_DIR} - release ${MPFR_LIBRARIES_DIR_RELEASE} - debug ${MPFR_LIBRARIES_DIR_DEBUG}") + message("** Add mpfr ${MPFR_LIBRARIES_DIR}") endif(MPFR_FOUND) endif(CGAL_FOUND) -- cgit v1.2.3 From 7f36ec1b83d3ebfbdd3294e136c385b04dafa23d Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Thu, 25 Jun 2020 10:31:34 +0200 Subject: Some debug traces --- src/python/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) (limited to 'src/python/CMakeLists.txt') diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt index 0182e4f5..80faf0f9 100644 --- a/src/python/CMakeLists.txt +++ b/src/python/CMakeLists.txt @@ -18,6 +18,7 @@ function( add_GUDHI_PYTHON_lib_dir THE_LIB_DIR ) # deals when it is not set - error on windows if(EXISTS ${THE_LIB_DIR}) set(GUDHI_PYTHON_LIBRARY_DIRS "${GUDHI_PYTHON_LIBRARY_DIRS}'${THE_LIB_DIR}', ") + message("add_GUDHI_PYTHON_lib_dir '${THE_LIB_DIR}'") else() message("add_GUDHI_PYTHON_lib_dir - '${THE_LIB_DIR}' does not exist") endif() -- cgit v1.2.3 From b12be95458023397cd8d6f5bc2bed2c007eeefbc Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Thu, 25 Jun 2020 12:19:33 +0200 Subject: parent_scope when setting variables in a function --- src/python/CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/python/CMakeLists.txt') diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt index 80faf0f9..4f26481e 100644 --- a/src/python/CMakeLists.txt +++ b/src/python/CMakeLists.txt @@ -17,8 +17,7 @@ endfunction( add_GUDHI_PYTHON_lib ) function( add_GUDHI_PYTHON_lib_dir THE_LIB_DIR ) # deals when it is not set - error on windows if(EXISTS ${THE_LIB_DIR}) - set(GUDHI_PYTHON_LIBRARY_DIRS "${GUDHI_PYTHON_LIBRARY_DIRS}'${THE_LIB_DIR}', ") - message("add_GUDHI_PYTHON_lib_dir '${THE_LIB_DIR}'") + set(GUDHI_PYTHON_LIBRARY_DIRS "${GUDHI_PYTHON_LIBRARY_DIRS}'${THE_LIB_DIR}', " PARENT_SCOPE) else() message("add_GUDHI_PYTHON_lib_dir - '${THE_LIB_DIR}' does not exist") endif() -- cgit v1.2.3