diff options
28 files changed, 289 insertions, 292 deletions
diff --git a/.appveyor.yml b/.appveyor.yml deleted file mode 100644 index 9ff8f157..00000000 --- a/.appveyor.yml +++ /dev/null @@ -1,67 +0,0 @@ -image: - - Visual Studio 2017 - -build: - parallel: true - verbosity: detailed - -configuration: - - Release - -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" - 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 - - - target: UnitaryTests - CMAKE_FLAGS: -DWITH_GUDHI_EXAMPLE=OFF -DWITH_GUDHI_TEST=ON -DWITH_GUDHI_UTILITIES=OFF -DWITH_GUDHI_PYTHON=OFF - - - target: Utilities - CMAKE_FLAGS: -DWITH_GUDHI_EXAMPLE=OFF -DWITH_GUDHI_TEST=OFF -DWITH_GUDHI_UTILITIES=ON -DWITH_GUDHI_PYTHON=OFF - - - target: Python - CMAKE_FLAGS: -DWITH_GUDHI_EXAMPLE=OFF -DWITH_GUDHI_TEST=OFF -DWITH_GUDHI_UTILITIES=OFF -DWITH_GUDHI_PYTHON=ON - - -cache: - - c:\Tools\vcpkg\installed - - '%LOCALAPPDATA%\pip\Cache' - -init: - - echo %target% - -# tbb:x64-windows -install: - - git submodule update --init - - vcpkg install boost-disjoint-sets:x64-windows boost-serialization:x64-windows boost-date-time:x64-windows boost-system:x64-windows boost-filesystem:x64-windows boost-units:x64-windows boost-thread:x64-windows boost-program-options:x64-windows eigen3:x64-windows mpfr:x64-windows mpir:x64-windows cgal:x64-windows - - SET PATH=c:\Tools\vcpkg\installed\x64-windows\bin;%PATH% - - SET PATH=%PYTHON%;%PYTHON%\Scripts;%PYTHON%\Library\bin;%PATH% - - SET PYTHONPATH=%PYTHON%\\Lib\\site-packages;%PYTHONPATH% - - CALL "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64 - - python --version - - pip --version - - python -m pip install --user --upgrade pip - - python -m pip install --user -r ext/gudhi-deploy/build-requirements.txt - # No PyKeOps on windows, let's workaround this one. - - for /F "tokens=*" %%A in (ext/gudhi-deploy/test-requirements.txt) do python -m pip install --user %%A - -build_script: - - mkdir build - - cd build - - 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 & - MSBuild Cython.sln /m /p:Configuration=Release /p:Platform=x64 & - ctest -j 1 --output-on-failure -C Release - ) else ( - MSBuild GUDHIdev.sln /m /p:Configuration=Release /p:Platform=x64 & - ctest -j 1 --output-on-failure -C Release -E diff_files - ) diff --git a/.github/for_maintainers/new_gudhi_version_creation.md b/.github/for_maintainers/new_gudhi_version_creation.md index 812758e3..19ef168e 100644 --- a/.github/for_maintainers/new_gudhi_version_creation.md +++ b/.github/for_maintainers/new_gudhi_version_creation.md @@ -26,7 +26,7 @@ md5sum gudhi.@GUDHI_VERSION@.tar.gz > md5sum.txt sha256sum gudhi.@GUDHI_VERSION@.tar.gz > sha256sum.txt sha512sum gudhi.@GUDHI_VERSION@.tar.gz > sha512sum.txt -make -j 4 all && ctest -j 4 --output-on-failure +make && ctest --output-on-failure ``` ***[Check there are no error]*** @@ -61,7 +61,7 @@ cd ../.. tar -czvf gudhi.doc.@GUDHI_VERSION@.tar.gz gudhi.doc.@GUDHI_VERSION@ cd gudhi.@GUDHI_VERSION@/build -make -j 4 all && ctest -j 4 --output-on-failure +make && ctest --output-on-failure ``` ***[Check there are no error]*** diff --git a/.github/for_maintainers/tests_strategy.md b/.github/for_maintainers/tests_strategy.md index 9c181740..c25acf9b 100644 --- a/.github/for_maintainers/tests_strategy.md +++ b/.github/for_maintainers/tests_strategy.md @@ -39,22 +39,24 @@ docker push gudhi/ci_for_gudhi_wo_cgal:latest ### Windows -The compilations has been seperated by categories to be parallelized, but I don't know why builds are not run in parallel: +The compilations are not parallelized, as installation time (about 30 minutes) is too much compare to +build and tests timings (about 30 minutes). Builds and tests include: * examples (C++) * tests (C++) * utils (C++) * python -Doxygen (C++) is not tested. -(cf. `.appveyor.yml`) +Doxygen (C++) is not generated. +(cf. `azure-pipelines.yml`) C++ third parties installation are done thanks to [vcpkg](https://github.com/microsoft/vcpkg/). In case of installation issue, check in [vcpkg issues](https://github.com/microsoft/vcpkg/issues). ### OSx -The compilations has been seperated by categories to be parallelized: +The compilations are not parallelized, but they should, as installation time (about 4 minutes) is +negligeable compare to build and tests timings (about 30 minutes). Builds and tests include: * examples (C++) * tests (C++) diff --git a/.github/next_release.md b/.github/next_release.md index 170c7494..0a8b2bbb 100644 --- a/.github/next_release.md +++ b/.github/next_release.md @@ -1,19 +1,19 @@ -We are pleased to announce the release 3.5.0 of the GUDHI library. +We are pleased to announce the release 3.X.X of the GUDHI library. As a major new feature, the GUDHI library now offers ... We are now using GitHub to develop the GUDHI library, do not hesitate to [fork the GUDHI project on GitHub](https://github.com/GUDHI/gudhi-devel). From a user point of view, we recommend to download GUDHI user version (gudhi.3.X.X.tar.gz). -Below is a list of changes made since GUDHI 3.4.0: +Below is a list of changes made since GUDHI 3.5.0: -- [Coxeter triangulation](https://gudhi.inria.fr/doc/latest/group__coxeter__triangulation.html) - - constructs a piecewise-linear approximation of an m-dimensional smooth manifold embedded in R^d using an ambient triangulation. +- [Module](link) + - ... - [Module](link) - ... - Miscellaneous - - The [list of bugs that were solved since GUDHI-3.4.0](https://github.com/GUDHI/gudhi-devel/issues?q=label%3A3.5.0+is%3Aclosed) is available on GitHub. + - The [list of bugs that were solved since GUDHI-3.5.0](https://github.com/GUDHI/gudhi-devel/issues?q=label%3A3.6.0+is%3Aclosed) is available on GitHub. All modules are distributed under the terms of the MIT license. However, there are still GPL dependencies for many modules. We invite you to check our [license dedicated web page](https://gudhi.inria.fr/licensing/) for further details. @@ -25,3 +25,4 @@ We provide [bibtex entries](https://gudhi.inria.fr/doc/latest/_citation.html) fo Feel free to [contact us](https://gudhi.inria.fr/contact/) in case you have any questions or remarks. For further information about downloading and installing the library ([C++](https://gudhi.inria.fr/doc/latest/installation.html) or [Python](https://gudhi.inria.fr/python/latest/installation.html)), please visit the [GUDHI web site](https://gudhi.inria.fr/). + diff --git a/.github/workflows/pip-build-linux.yml b/.github/workflows/pip-build-linux.yml index 12979a86..a2b4f085 100644 --- a/.github/workflows/pip-build-linux.yml +++ b/.github/workflows/pip-build-linux.yml @@ -12,15 +12,16 @@ jobs: - uses: actions/checkout@v1 with: submodules: true - - name: Build wheel for Python 3.9 + - name: Build wheel for Python 3.10 run: | - mkdir build_39 - cd build_39 - cmake -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=$PYTHON39/bin/python .. + mkdir build_310 + cd build_310 + cmake -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=$PYTHON310/bin/python .. cd src/python - $PYTHON39/bin/python setup.py bdist_wheel + $PYTHON310/bin/python setup.py bdist_wheel auditwheel repair dist/*.whl - - name: Install and test wheel for Python 3.9 + - name: Install and test wheel for Python 3.10 run: | - $PYTHON39/bin/python -m pip install --user pytest build_39/src/python/dist/*.whl - $PYTHON39/bin/python -m pytest src/python/test/test_alpha_complex.py + $PYTHON310/bin/python -m pip install --user pytest build_310/src/python/dist/*.whl + $PYTHON310/bin/python -c "import gudhi; print(gudhi.__version__)" + $PYTHON310/bin/python -m pytest src/python/test/test_alpha_complex.py diff --git a/.github/workflows/pip-build-osx.yml b/.github/workflows/pip-build-osx.yml index 1626bb77..99d515ff 100644 --- a/.github/workflows/pip-build-osx.yml +++ b/.github/workflows/pip-build-osx.yml @@ -8,7 +8,7 @@ jobs: strategy: max-parallel: 4 matrix: - python-version: ['3.9'] + python-version: ['3.10'] name: Build wheels for Python ${{ matrix.python-version }} steps: - uses: actions/checkout@v1 @@ -35,4 +35,5 @@ jobs: - name: Install and test python wheel run: | python -m pip install --user pytest build/src/python/dist/*.whl + python -c "import gudhi; print(gudhi.__version__)" python -m pytest src/python/test/test_alpha_complex.py diff --git a/.github/workflows/pip-build-windows.yml b/.github/workflows/pip-build-windows.yml index 0080f4d5..954b59d5 100644 --- a/.github/workflows/pip-build-windows.yml +++ b/.github/workflows/pip-build-windows.yml @@ -8,7 +8,7 @@ jobs: strategy: max-parallel: 4 matrix: - python-version: ['3.9'] + python-version: ['3.10'] name: Build wheels for Python ${{ matrix.python-version }} steps: - uses: actions/checkout@v1 @@ -20,36 +20,30 @@ jobs: architecture: x64 - name: Install dependencies run: | - cd c:/vcpkg - git fetch --all --tags - git checkout 2020.11-1 - bootstrap-vcpkg.bat set VCPKG_BUILD_TYPE=release - vcpkg install eigen3 mpfr boost-accumulators boost-algorithm boost-bimap boost-callable-traits boost-concept-check boost-container boost-core boost-detail boost-filesystem boost-functional boost-fusion boost-geometry boost-graph boost-heap boost-intrusive boost-iostreams boost-iterator boost-lambda boost-logic boost-math boost-mpl boost-multi-index boost-multiprecision boost-numeric-conversion boost-optional boost-parameter boost-pool boost-preprocessor boost-property-map boost-property-tree boost-ptr-container boost-random boost-range boost-serialization boost-spirit boost-thread boost-tuple boost-type-traits boost-units boost-utility boost-variant --triplet x64-windows + vcpkg install eigen3 cgal --triplet x64-windows vcpkg version - ls C:/vcpkg/installed/x64-windows/bin - Invoke-WebRequest https://github.com/CGAL/cgal/releases/download/v5.2.1/CGAL-5.2.1.zip -OutFile CGAL-5.2.1.zip - Expand-Archive -Path CGAL-5.2.1.zip -DestinationPath . - cd CGAL-5.2.1 - cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=c:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows -DGMP_INCLUDE_DIR=c:/vcpkg/installed/x64-windows/include -DGMP_LIBRARIES=c:/vcpkg/installed/x64-windows/bin/mpir.dll . - cd ${{ github.workspace }} - python -m pip install --user -r ext/gudhi-deploy/build-requirements.txt + ls "C:\vcpkg\installed\x64-windows\bin\" + python -m pip install --user -r .\ext\gudhi-deploy\build-requirements.txt python -m pip list - - name: Build python wheel + - name: Build python wheel and install it run: | mkdir build - cd build - cmake -DCGAL_DIR=c:/vcpkg/CGAL-5.2.1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=c:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows -DGMP_INCLUDE_DIR=c:/vcpkg/installed/x64-windows/include -DGMP_LIBRARIES=c:/vcpkg/installed/x64-windows/bin/mpir.dll .. - cd src/python - cp c:/vcpkg/installed/x64-windows/bin/mpfr.dll gudhi/ - cp c:/vcpkg/installed/x64-windows/bin/mpir.dll gudhi/ + cd ".\build\" + cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=c:\vcpkg\scripts\buildsystems\vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows .. + Get-Location + dir + cd ".\src\python\" + cp "C:\vcpkg\installed\x64-windows\bin\mpfr-6.dll" ".\gudhi\" + cp "C:\vcpkg\installed\x64-windows\bin\gmp.dll" ".\gudhi\" python setup.py bdist_wheel ls dist - - name: Install and test python wheel - run: | - cd ${{ github.workspace }} - cd build/src/python/dist/ + cd ".\dist\" Get-ChildItem *.whl | ForEach-Object{python -m pip install --user $_.Name} - cd ${{ github.workspace }} + - name: Test python wheel + run: | + Get-Location + dir python -m pip install --user pytest - python -m pytest src/python/test/test_alpha_complex.py + python -c "import gudhi; print(gudhi.__version__)" + python -m pytest ".\src\python\test\test_alpha_complex.py" diff --git a/.github/workflows/pip-packaging-linux.yml b/.github/workflows/pip-packaging-linux.yml index 6ce0ba89..98173ed3 100644 --- a/.github/workflows/pip-packaging-linux.yml +++ b/.github/workflows/pip-packaging-linux.yml @@ -25,6 +25,7 @@ jobs: - name: Install and test wheel for Python 3.6 run: | $PYTHON36/bin/python -m pip install --user pytest build_36/src/python/dist/*.whl + $PYTHON36/bin/python -c "import gudhi; print(gudhi.__version__)" $PYTHON36/bin/python -m pytest src/python/test/test_alpha_complex.py - name: Build wheel for Python 3.7 run: | @@ -37,6 +38,7 @@ jobs: - name: Install and test wheel for Python 3.7 run: | $PYTHON37/bin/python -m pip install --user pytest build_37/src/python/dist/*.whl + $PYTHON37/bin/python -c "import gudhi; print(gudhi.__version__)" $PYTHON37/bin/python -m pytest src/python/test/test_alpha_complex.py - name: Build wheel for Python 3.8 run: | @@ -49,6 +51,7 @@ jobs: - name: Install and test wheel for Python 3.8 run: | $PYTHON38/bin/python -m pip install --user pytest build_38/src/python/dist/*.whl + $PYTHON38/bin/python -c "import gudhi; print(gudhi.__version__)" $PYTHON38/bin/python -m pytest src/python/test/test_alpha_complex.py - name: Build wheel for Python 3.9 run: | @@ -61,6 +64,7 @@ jobs: - name: Install and test wheel for Python 3.9 run: | $PYTHON39/bin/python -m pip install --user pytest build_39/src/python/dist/*.whl + $PYTHON39/bin/python -c "import gudhi; print(gudhi.__version__)" $PYTHON39/bin/python -m pytest src/python/test/test_alpha_complex.py - name: Build wheel for Python 3.10 run: | @@ -73,6 +77,7 @@ jobs: - name: Install and test wheel for Python 3.10 run: | $PYTHON310/bin/python -m pip install --user pytest build_310/src/python/dist/*.whl + $PYTHON310/bin/python -c "import gudhi; print(gudhi.__version__)" $PYTHON310/bin/python -m pytest src/python/test/test_alpha_complex.py - name: Publish on PyPi env: diff --git a/.github/workflows/pip-packaging-osx.yml b/.github/workflows/pip-packaging-osx.yml index 120c15b6..7417300a 100644 --- a/.github/workflows/pip-packaging-osx.yml +++ b/.github/workflows/pip-packaging-osx.yml @@ -10,7 +10,7 @@ jobs: strategy: max-parallel: 4 matrix: - python-version: ['3.5', '3.6', '3.7', '3.8', '3.9'] + python-version: ['3.7', '3.8', '3.9', '3.10'] name: Build wheels for Python ${{ matrix.python-version }} steps: - uses: actions/checkout@v1 @@ -37,6 +37,7 @@ jobs: - name: Install and test python wheel run: | python -m pip install --user pytest build/src/python/dist/*.whl + python -c "import gudhi; print(gudhi.__version__)" python -m pytest src/python/test/test_alpha_complex.py - name: Publish on PyPi env: diff --git a/.github/workflows/pip-packaging-windows.yml b/.github/workflows/pip-packaging-windows.yml index f387c5ff..962ae68a 100644 --- a/.github/workflows/pip-packaging-windows.yml +++ b/.github/workflows/pip-packaging-windows.yml @@ -10,7 +10,7 @@ jobs: strategy: max-parallel: 4 matrix: - python-version: ['3.5', '3.6', '3.7', '3.8', '3.9'] + python-version: ['3.6', '3.7', '3.8', '3.9', '3.10'] name: Build wheels for Python ${{ matrix.python-version }} steps: - uses: actions/checkout@v1 @@ -22,40 +22,32 @@ jobs: architecture: x64 - name: Install dependencies run: | - cd c:/vcpkg - git fetch --all --tags - git checkout 2020.11-1 - bootstrap-vcpkg.bat set VCPKG_BUILD_TYPE=release - vcpkg install eigen3 mpfr boost-accumulators boost-algorithm boost-bimap boost-callable-traits boost-concept-check boost-container boost-core boost-detail boost-filesystem boost-functional boost-fusion boost-geometry boost-graph boost-heap boost-intrusive boost-iostreams boost-iterator boost-lambda boost-logic boost-math boost-mpl boost-multi-index boost-multiprecision boost-numeric-conversion boost-optional boost-parameter boost-pool boost-preprocessor boost-property-map boost-property-tree boost-ptr-container boost-random boost-range boost-serialization boost-spirit boost-thread boost-tuple boost-type-traits boost-units boost-utility boost-variant --triplet x64-windows + vcpkg install eigen3 cgal --triplet x64-windows vcpkg version - ls C:/vcpkg/installed/x64-windows/bin - Invoke-WebRequest https://github.com/CGAL/cgal/releases/download/v5.2.1/CGAL-5.2.1.zip -OutFile CGAL-5.2.1.zip - Expand-Archive -Path CGAL-5.2.1.zip -DestinationPath . - cd CGAL-5.2.1 - cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=c:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows -DGMP_INCLUDE_DIR=c:/vcpkg/installed/x64-windows/include -DGMP_LIBRARIES=c:/vcpkg/installed/x64-windows/bin/mpir.dll . - cd ${{ github.workspace }} - python -m pip install --user -r ext/gudhi-deploy/build-requirements.txt + ls "C:\vcpkg\installed\x64-windows\bin\" + python -m pip install --user -r .\ext\gudhi-deploy\build-requirements.txt python -m pip install --user twine python -m pip list - - name: Build python wheel + - name: Build python wheel and install it run: | mkdir build - cd build - cmake -DCGAL_DIR=c:/vcpkg/CGAL-5.2.1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=c:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows -DGMP_INCLUDE_DIR=c:/vcpkg/installed/x64-windows/include -DGMP_LIBRARIES=c:/vcpkg/installed/x64-windows/bin/mpir.dll .. - cd src/python - cp c:/vcpkg/installed/x64-windows/bin/mpfr.dll gudhi/ - cp c:/vcpkg/installed/x64-windows/bin/mpir.dll gudhi/ + cd ".\build\" + cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=c:\vcpkg\scripts\buildsystems\vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows .. + Get-Location + dir + cd ".\src\python\" + cp "C:\vcpkg\installed\x64-windows\bin\mpfr-6.dll" ".\gudhi\" + cp "C:\vcpkg\installed\x64-windows\bin\gmp.dll" ".\gudhi\" python setup.py bdist_wheel ls dist - - name: Install and test python wheel - run: | - cd ${{ github.workspace }} - cd build/src/python/dist/ + cd ".\dist\" Get-ChildItem *.whl | ForEach-Object{python -m pip install --user $_.Name} - cd ${{ github.workspace }} + - name: Test python wheel + run: | python -m pip install --user pytest - python -m pytest src/python/test/test_alpha_complex.py + python -c "import gudhi; print(gudhi.__version__)" + python -m pytest ".\src\python\test\test_alpha_complex.py" - name: Publish on PyPi env: TWINE_USERNAME: __token__ diff --git a/CMakeGUDHIVersion.txt b/CMakeGUDHIVersion.txt index db9b243b..b7f93799 100644 --- a/CMakeGUDHIVersion.txt +++ b/CMakeGUDHIVersion.txt @@ -1,8 +1,8 @@ # Must be conform to pep440 - https://www.python.org/dev/peps/pep-0440/#pre-releases set (GUDHI_MAJOR_VERSION 3) -set (GUDHI_MINOR_VERSION 5) +set (GUDHI_MINOR_VERSION 6) # GUDHI_PATCH_VERSION can be 'ZaN' for Alpha release, 'ZbN' for Beta release, 'ZrcN' for release candidate or 'Z' for a final release. -set (GUDHI_PATCH_VERSION 0rc1) +set (GUDHI_PATCH_VERSION 0a0) set(GUDHI_VERSION ${GUDHI_MAJOR_VERSION}.${GUDHI_MINOR_VERSION}.${GUDHI_PATCH_VERSION}) message(STATUS "GUDHI version : ${GUDHI_VERSION}") diff --git a/CMakeLists.txt b/CMakeLists.txt index d0cf6a25..ac877eea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,9 +2,9 @@ cmake_minimum_required(VERSION 3.5) project(GUDHIdev) -include(CMakeGUDHIVersion.txt) - list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/src/cmake/modules/") +include(CMakeGUDHIVersion.txt) +include(GUDHI_options) # Reset cache set(GUDHI_MODULES "" CACHE INTERNAL "GUDHI_MODULES") diff --git a/azure-pipelines.yml b/azure-pipelines.yml index a96323fd..21664244 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,26 +1,26 @@ jobs: - - job: 'Test' - displayName: "Build and test" + - job: 'OSx' + displayName: "Build and test OSx" timeoutInMinutes: 0 cancelTimeoutInMinutes: 60 pool: vmImage: macOS-10.15 variables: - pythonVersion: '3.6' + pythonVersion: '3.7' cmakeBuildType: Release steps: - - bash: echo "##vso[task.prependpath]$CONDA/bin" - displayName: Add conda to PATH - - - bash: sudo conda create --yes --quiet --name gudhi_build_env - displayName: Create Anaconda environment - + # Use a specific Python version + - task: UsePythonVersion@0 + displayName: Use Python $(pythonVersion) + inputs: + versionSpec: $(pythonVersion) + addToPath: true + architecture: 'x64' + - bash: | - source activate gudhi_build_env git submodule update --init - sudo conda install --yes --quiet --name gudhi_build_env python=$(pythonVersion) python -m pip install --user -r ext/gudhi-deploy/build-requirements.txt python -m pip install --user -r ext/gudhi-deploy/test-requirements.txt python -m pip uninstall -y pykeops @@ -28,11 +28,56 @@ jobs: brew install graphviz doxygen boost eigen gmp mpfr tbb cgal || true displayName: 'Install build dependencies' - bash: | - source activate gudhi_build_env mkdir build cd build - cmake -DCMAKE_BUILD_TYPE:STRING=$(cmakeBuildType) -DWITH_GUDHI_TEST=ON -DWITH_GUDHI_UTILITIES=ON -DWITH_GUDHI_PYTHON=ON -DPython_ADDITIONAL_VERSIONS=3 .. - make -j 4 + cmake -DCMAKE_BUILD_TYPE:STRING=$(cmakeBuildType) -DWITH_GUDHI_TEST=ON -DWITH_GUDHI_UTILITIES=ON -DWITH_GUDHI_PYTHON=ON .. + make make doxygen - ctest -j 4 --output-on-failure # -E sphinx remove sphinx build as it fails + ctest --output-on-failure displayName: 'Build, test and documentation generation' + + - job: 'Windows' + displayName: "Build and test Windows" + timeoutInMinutes: 0 + cancelTimeoutInMinutes: 60 + pool: + vmImage: windows-latest + variables: + pythonVersion: '3.7' + cmakeVcpkgFlags: -DVCPKG_TARGET_TRIPLET=x64-windows -DCMAKE_TOOLCHAIN_FILE=c:\vcpkg\scripts\buildsystems\vcpkg.cmake + cmakeFlags: -DWITH_GUDHI_EXAMPLE=ON -DWITH_GUDHI_TEST=ON -DWITH_GUDHI_UTILITIES=ON -DWITH_GUDHI_PYTHON=OFF + + steps: + # Use a specific Python version + - task: UsePythonVersion@0 + displayName: Use Python $(pythonVersion) + inputs: + versionSpec: $(pythonVersion) + addToPath: true + architecture: 'x64' + + - script: | + git submodule update --init + python -m pip install --user -r ext/gudhi-deploy/build-requirements.txt + # No PyKeOps on windows, let's workaround this one. + for /F "tokens=*" %%A in (ext\gudhi-deploy\test-requirements.txt) do python -m pip install %%A + vcpkg install boost-filesystem:x64-windows boost-test:x64-windows boost-program-options:x64-windows tbb:x64-windows eigen3:x64-windows cgal:x64-windows + displayName: 'Install build dependencies' + - script: | + call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64 + mkdir build + cd build + cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_BUILD_TYPE=Release $(cmakeVcpkgFlags) $(cmakeFlags) .. + MSBuild GUDHIdev.sln /m /p:Configuration=Release /p:Platform=x64 + ctest --output-on-failure -C Release -E diff_files + cmake -DWITH_GUDHI_PYTHON=ON . + cd src\python + copy "C:\vcpkg\installed\x64-windows\bin\mpfr-6.dll" ".\gudhi\" + copy "C:\vcpkg\installed\x64-windows\bin\gmp.dll" ".\gudhi\" + copy "C:\vcpkg\installed\x64-windows\bin\tbb.dll" ".\gudhi\" + copy "C:\vcpkg\installed\x64-windows\bin\tbbmalloc.dll" ".\gudhi\" + python setup.py build_ext --inplace + SET PYTHONPATH=%CD%;%PYTHONPATH% + echo %PYTHONPATH% + ctest --output-on-failure -C Release + displayName: 'Build and test' diff --git a/ext/gudhi-deploy b/ext/gudhi-deploy -Subproject 975d1bffb317f3b84bf1a3d576cdfdbf7b45861 +Subproject 290ade1086bedbc96a35df886cadecabbf4072e diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8f6a1ccc..8023e04c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -2,9 +2,9 @@ cmake_minimum_required(VERSION 3.5) project(GUDHI) -include(CMakeGUDHIVersion.txt) - list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules/") +include(CMakeGUDHIVersion.txt) +include(GUDHI_options) set(GUDHI_MODULES "" CACHE INTERNAL "GUDHI_MODULES") set(GUDHI_MISSING_MODULES "" CACHE INTERNAL "GUDHI_MISSING_MODULES") diff --git a/src/Cech_complex/benchmark/cech_complex_benchmark.cpp b/src/Cech_complex/benchmark/cech_complex_benchmark.cpp index e489e8a4..2e4adce4 100644 --- a/src/Cech_complex/benchmark/cech_complex_benchmark.cpp +++ b/src/Cech_complex/benchmark/cech_complex_benchmark.cpp @@ -49,7 +49,7 @@ class Minimal_enclosing_ball_radius { point_cloud.push_back(p1); point_cloud.push_back(p2); - GUDHI_CHECK((p1.end() - p1.begin()) != (p2.end() - p2.begin()), "inconsistent point dimensions"); + GUDHI_CHECK((p1.end() - p1.begin()) == (p2.end() - p2.begin()), "inconsistent point dimensions"); Min_sphere min_sphere(p1.end() - p1.begin(), point_cloud.begin(), point_cloud.end()); return std::sqrt(min_sphere.squared_radius()); diff --git a/src/Persistent_cohomology/include/gudhi/Persistent_cohomology/Field_Zp.h b/src/Persistent_cohomology/include/gudhi/Persistent_cohomology/Field_Zp.h index 8ec89e41..f442b632 100644 --- a/src/Persistent_cohomology/include/gudhi/Persistent_cohomology/Field_Zp.h +++ b/src/Persistent_cohomology/include/gudhi/Persistent_cohomology/Field_Zp.h @@ -34,8 +34,6 @@ class Field_Zp { } void init(int charac) { - assert(charac > 0); // division by zero + non negative values - Prime = charac; // Check that the provided prime is less than the maximum allowed as int, calculation below, and 'plus_times_equal' function : 46337 ; i.e (max_prime-1)*max_prime <= INT_MAX diff --git a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker.h b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker.h index 653a63fd..0fd56c67 100644 --- a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker.h +++ b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker.h @@ -52,8 +52,7 @@ when \f$ \tau \neq \sigma\f$ we say that \f$ \tau\f$ is a proper-face of \f$ \si An abstract simplicial complex is a set of simplices that contains all the faces of its simplices. The 1-skeleton of a simplicial complex (or its graph) consists of its elements of dimension lower than 2. - *\image html "ds_representation.png" "Skeleton-blocker representation" width=20cm - +\image html "ds_representation.png" "Skeleton-blocker representation" To encode, a simplicial complex, one can encodes all its simplices. In case when this number gets too large, @@ -73,11 +72,7 @@ For instance, the numbers of blockers is depicted for random 3-dimensional spher in next figure. Storing the graph and blockers of such simplicial complexes is much compact in this case than storing their simplices. - - *\image html "blockers_curve.png" "Number of blockers of random triangulations of 3-spheres" width=10cm - - - +\image html "blockers_curve.png" "Number of blockers of random triangulations of 3-spheres" \section API diff --git a/src/Toplex_map/benchmark/CMakeLists.txt b/src/Toplex_map/benchmark/CMakeLists.txt index 2d58a156..6703d9d0 100644 --- a/src/Toplex_map/benchmark/CMakeLists.txt +++ b/src/Toplex_map/benchmark/CMakeLists.txt @@ -1,3 +1,7 @@ project(Toplex_map_benchmark) add_executable(Toplex_map_benchmark benchmark_tm.cpp) + +if (TBB_FOUND) + target_link_libraries(Toplex_map_benchmark ${TBB_LIBRARIES}) +endif() diff --git a/src/cmake/modules/GUDHI_modules.cmake b/src/cmake/modules/GUDHI_modules.cmake index ccaf1ac5..13248f7e 100644 --- a/src/cmake/modules/GUDHI_modules.cmake +++ b/src/cmake/modules/GUDHI_modules.cmake @@ -17,12 +17,6 @@ function(add_gudhi_module file_path) endfunction(add_gudhi_module) -option(WITH_GUDHI_BENCHMARK "Activate/desactivate benchmark compilation" OFF) -option(WITH_GUDHI_EXAMPLE "Activate/desactivate examples compilation and installation" OFF) -option(WITH_GUDHI_PYTHON "Activate/desactivate python module compilation and installation" ON) -option(WITH_GUDHI_TEST "Activate/desactivate examples compilation and installation" ON) -option(WITH_GUDHI_UTILITIES "Activate/desactivate utilities compilation and installation" ON) - if (WITH_GUDHI_BENCHMARK) set(GUDHI_SUB_DIRECTORIES "${GUDHI_SUB_DIRECTORIES};benchmark") endif() diff --git a/src/cmake/modules/GUDHI_options.cmake b/src/cmake/modules/GUDHI_options.cmake new file mode 100644 index 00000000..3cd0a489 --- /dev/null +++ b/src/cmake/modules/GUDHI_options.cmake @@ -0,0 +1,5 @@ +option(WITH_GUDHI_BENCHMARK "Activate/desactivate benchmark compilation" OFF) +option(WITH_GUDHI_EXAMPLE "Activate/desactivate examples compilation and installation" OFF) +option(WITH_GUDHI_PYTHON "Activate/desactivate python module compilation and installation" ON) +option(WITH_GUDHI_TEST "Activate/desactivate examples compilation and installation" ON) +option(WITH_GUDHI_UTILITIES "Activate/desactivate utilities compilation and installation" ON) diff --git a/src/cmake/modules/GUDHI_third_party_libraries.cmake b/src/cmake/modules/GUDHI_third_party_libraries.cmake index 023061f1..b316740d 100644 --- a/src/cmake/modules/GUDHI_third_party_libraries.cmake +++ b/src/cmake/modules/GUDHI_third_party_libraries.cmake @@ -6,6 +6,7 @@ find_package(Boost 1.56.0 QUIET OPTIONAL_COMPONENTS filesystem unit_test_framewo if(NOT Boost_VERSION) message(FATAL_ERROR "NOTICE: This program requires Boost and will not be compiled.") endif(NOT Boost_VERSION) +include_directories(${Boost_INCLUDE_DIRS}) find_package(GMP) if(GMP_FOUND) @@ -92,91 +93,92 @@ add_definitions( -DBOOST_SYSTEM_NO_DEPRECATED ) message(STATUS "boost include dirs:" ${Boost_INCLUDE_DIRS}) message(STATUS "boost library dirs:" ${Boost_LIBRARY_DIRS}) -# Find the correct Python interpreter. -# Can be set with -DPYTHON_EXECUTABLE=/usr/bin/python3 or -DPython_ADDITIONAL_VERSIONS=3 for instance. -find_package( PythonInterp ) - -# find_python_module tries to import module in Python interpreter and to retrieve its version number -# returns ${PYTHON_MODULE_NAME_UP}_VERSION and ${PYTHON_MODULE_NAME_UP}_FOUND -function( find_python_module PYTHON_MODULE_NAME ) - string(TOUPPER ${PYTHON_MODULE_NAME} PYTHON_MODULE_NAME_UP) - execute_process( - COMMAND ${PYTHON_EXECUTABLE} -c "import ${PYTHON_MODULE_NAME}; print(${PYTHON_MODULE_NAME}.__version__)" - RESULT_VARIABLE PYTHON_MODULE_RESULT - OUTPUT_VARIABLE PYTHON_MODULE_VERSION - ERROR_VARIABLE PYTHON_MODULE_ERROR) - if(PYTHON_MODULE_RESULT EQUAL 0) - # Remove all carriage returns as it can be multiline - string(REGEX REPLACE "\n" " " PYTHON_MODULE_VERSION "${PYTHON_MODULE_VERSION}") - message ("++ Python module ${PYTHON_MODULE_NAME} - Version ${PYTHON_MODULE_VERSION} found") - - set(${PYTHON_MODULE_NAME_UP}_VERSION ${PYTHON_MODULE_VERSION} PARENT_SCOPE) - set(${PYTHON_MODULE_NAME_UP}_FOUND TRUE PARENT_SCOPE) - else() - message ("PYTHON_MODULE_NAME = ${PYTHON_MODULE_NAME} - - PYTHON_MODULE_RESULT = ${PYTHON_MODULE_RESULT} - - PYTHON_MODULE_VERSION = ${PYTHON_MODULE_VERSION} - - PYTHON_MODULE_ERROR = ${PYTHON_MODULE_ERROR}") - unset(${PYTHON_MODULE_NAME_UP}_VERSION PARENT_SCOPE) - set(${PYTHON_MODULE_NAME_UP}_FOUND FALSE PARENT_SCOPE) - endif() -endfunction( find_python_module ) - -# For modules that do not define module.__version__ -function( find_python_module_no_version PYTHON_MODULE_NAME ) - string(TOUPPER ${PYTHON_MODULE_NAME} PYTHON_MODULE_NAME_UP) - execute_process( - COMMAND ${PYTHON_EXECUTABLE} -c "import ${PYTHON_MODULE_NAME}" - RESULT_VARIABLE PYTHON_MODULE_RESULT - ERROR_VARIABLE PYTHON_MODULE_ERROR) - if(PYTHON_MODULE_RESULT EQUAL 0) - # Remove carriage return - message ("++ Python module ${PYTHON_MODULE_NAME} found") - set(${PYTHON_MODULE_NAME_UP}_FOUND TRUE PARENT_SCOPE) - else() - message ("PYTHON_MODULE_NAME = ${PYTHON_MODULE_NAME} - - PYTHON_MODULE_RESULT = ${PYTHON_MODULE_RESULT} - - PYTHON_MODULE_ERROR = ${PYTHON_MODULE_ERROR}") - set(${PYTHON_MODULE_NAME_UP}_FOUND FALSE PARENT_SCOPE) +if (WITH_GUDHI_PYTHON) + # Find the correct Python interpreter. + # Can be set with -DPYTHON_EXECUTABLE=/usr/bin/python3 or -DPython_ADDITIONAL_VERSIONS=3 for instance. + find_package( PythonInterp ) + + # find_python_module tries to import module in Python interpreter and to retrieve its version number + # returns ${PYTHON_MODULE_NAME_UP}_VERSION and ${PYTHON_MODULE_NAME_UP}_FOUND + function( find_python_module PYTHON_MODULE_NAME ) + string(TOUPPER ${PYTHON_MODULE_NAME} PYTHON_MODULE_NAME_UP) + execute_process( + COMMAND ${PYTHON_EXECUTABLE} -c "import ${PYTHON_MODULE_NAME}; print(${PYTHON_MODULE_NAME}.__version__)" + RESULT_VARIABLE PYTHON_MODULE_RESULT + OUTPUT_VARIABLE PYTHON_MODULE_VERSION + ERROR_VARIABLE PYTHON_MODULE_ERROR) + if(PYTHON_MODULE_RESULT EQUAL 0) + # Remove all carriage returns as it can be multiline + string(REGEX REPLACE "\n" " " PYTHON_MODULE_VERSION "${PYTHON_MODULE_VERSION}") + message ("++ Python module ${PYTHON_MODULE_NAME} - Version ${PYTHON_MODULE_VERSION} found") + + set(${PYTHON_MODULE_NAME_UP}_VERSION ${PYTHON_MODULE_VERSION} PARENT_SCOPE) + set(${PYTHON_MODULE_NAME_UP}_FOUND TRUE PARENT_SCOPE) + else() + message ("PYTHON_MODULE_NAME = ${PYTHON_MODULE_NAME} + - PYTHON_MODULE_RESULT = ${PYTHON_MODULE_RESULT} + - PYTHON_MODULE_VERSION = ${PYTHON_MODULE_VERSION} + - PYTHON_MODULE_ERROR = ${PYTHON_MODULE_ERROR}") + unset(${PYTHON_MODULE_NAME_UP}_VERSION PARENT_SCOPE) + set(${PYTHON_MODULE_NAME_UP}_FOUND FALSE PARENT_SCOPE) + endif() + endfunction( find_python_module ) + + # For modules that do not define module.__version__ + function( find_python_module_no_version PYTHON_MODULE_NAME ) + string(TOUPPER ${PYTHON_MODULE_NAME} PYTHON_MODULE_NAME_UP) + execute_process( + COMMAND ${PYTHON_EXECUTABLE} -c "import ${PYTHON_MODULE_NAME}" + RESULT_VARIABLE PYTHON_MODULE_RESULT + ERROR_VARIABLE PYTHON_MODULE_ERROR) + if(PYTHON_MODULE_RESULT EQUAL 0) + # Remove carriage return + message ("++ Python module ${PYTHON_MODULE_NAME} found") + set(${PYTHON_MODULE_NAME_UP}_FOUND TRUE PARENT_SCOPE) + else() + message ("PYTHON_MODULE_NAME = ${PYTHON_MODULE_NAME} + - PYTHON_MODULE_RESULT = ${PYTHON_MODULE_RESULT} + - PYTHON_MODULE_ERROR = ${PYTHON_MODULE_ERROR}") + set(${PYTHON_MODULE_NAME_UP}_FOUND FALSE PARENT_SCOPE) + endif() + endfunction( find_python_module_no_version ) + + if( PYTHONINTERP_FOUND ) + find_python_module("cython") + find_python_module("pytest") + find_python_module("matplotlib") + find_python_module("numpy") + find_python_module("scipy") + find_python_module("sphinx") + find_python_module("sklearn") + find_python_module("ot") + find_python_module("pybind11") + find_python_module("torch") + find_python_module("pykeops") + find_python_module("eagerpy") + find_python_module_no_version("hnswlib") + find_python_module("tensorflow") + find_python_module("sphinx_paramlinks") + find_python_module_no_version("python_docs_theme") endif() -endfunction( find_python_module_no_version ) - -if( PYTHONINTERP_FOUND ) - find_python_module("cython") - find_python_module("pytest") - find_python_module("matplotlib") - find_python_module("numpy") - find_python_module("scipy") - find_python_module("sphinx") - find_python_module("sklearn") - find_python_module("ot") - find_python_module("pybind11") - find_python_module("torch") - find_python_module("pykeops") - find_python_module("eagerpy") - find_python_module_no_version("hnswlib") - find_python_module("tensorflow") - find_python_module("sphinx_paramlinks") - find_python_module_no_version("python_docs_theme") -endif() - -if(NOT GUDHI_PYTHON_PATH) - message(FATAL_ERROR "ERROR: GUDHI_PYTHON_PATH is not valid.") -endif(NOT GUDHI_PYTHON_PATH) - -option(WITH_GUDHI_PYTHON_RUNTIME_LIBRARY_DIRS "Build with setting runtime_library_dirs. Usefull when setting rpath is not allowed" ON) - -if(PYTHONINTERP_FOUND AND CYTHON_FOUND) - if(SPHINX_FOUND) - # Documentation generation is available through sphinx - find_program( SPHINX_PATH sphinx-build ) - - if(NOT SPHINX_PATH) - if(PYTHON_VERSION_MAJOR EQUAL 3) - # In Python3, just hack sphinx-build if it does not exist - set(SPHINX_PATH "${PYTHON_EXECUTABLE}" "-m" "sphinx.cmd.build") - endif(PYTHON_VERSION_MAJOR EQUAL 3) - endif(NOT SPHINX_PATH) - endif(SPHINX_FOUND) -endif(PYTHONINTERP_FOUND AND CYTHON_FOUND) - + + if(NOT GUDHI_PYTHON_PATH) + message(FATAL_ERROR "ERROR: GUDHI_PYTHON_PATH is not valid.") + endif(NOT GUDHI_PYTHON_PATH) + + option(WITH_GUDHI_PYTHON_RUNTIME_LIBRARY_DIRS "Build with setting runtime_library_dirs. Usefull when setting rpath is not allowed" ON) + + if(PYTHONINTERP_FOUND AND CYTHON_FOUND) + if(SPHINX_FOUND) + # Documentation generation is available through sphinx + find_program( SPHINX_PATH sphinx-build ) + + if(NOT SPHINX_PATH) + if(PYTHON_VERSION_MAJOR EQUAL 3) + # In Python3, just hack sphinx-build if it does not exist + set(SPHINX_PATH "${PYTHON_EXECUTABLE}" "-m" "sphinx.cmd.build") + endif(PYTHON_VERSION_MAJOR EQUAL 3) + endif(NOT SPHINX_PATH) + endif(SPHINX_FOUND) + endif(PYTHONINTERP_FOUND AND CYTHON_FOUND) +endif (WITH_GUDHI_PYTHON)
\ No newline at end of file diff --git a/src/common/benchmark/CMakeLists.txt b/src/common/benchmark/CMakeLists.txt index a3787d6e..26e4e6af 100644 --- a/src/common/benchmark/CMakeLists.txt +++ b/src/common/benchmark/CMakeLists.txt @@ -1,3 +1,7 @@ project(common_benchmark) add_executable(Graph_simplicial_complex_benchmark Graph_simplicial_complex_benchmark.cpp) + +if (TBB_FOUND) + target_link_libraries(Graph_simplicial_complex_benchmark ${TBB_LIBRARIES}) +endif() diff --git a/src/common/include/gudhi/reader_utils.h b/src/common/include/gudhi/reader_utils.h index 0938f5c1..a1b104e2 100644 --- a/src/common/include/gudhi/reader_utils.h +++ b/src/common/include/gudhi/reader_utils.h @@ -14,7 +14,11 @@ #include <gudhi/graph_simplicial_complex.h> #include <gudhi/Debug_utils.h> -#include <boost/function_output_iterator.hpp> +#if BOOST_VERSION < 106600 +# include <boost/function_output_iterator.hpp> +#else +# include <boost/iterator/function_output_iterator.hpp> +#endif #include <boost/graph/adjacency_list.hpp> #include <iostream> diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt index 2a5b961b..a507d34c 100644 --- a/src/python/CMakeLists.txt +++ b/src/python/CMakeLists.txt @@ -14,13 +14,16 @@ 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}', " PARENT_SCOPE) - else() - message("add_GUDHI_PYTHON_lib_dir - '${THE_LIB_DIR}' does not exist") - endif() +function( add_GUDHI_PYTHON_lib_dir) + # Argument may be a list (specifically on windows with release/debug paths) + foreach(THE_LIB_DIR IN LISTS ARGN) + # 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}', " PARENT_SCOPE) + else() + message("add_GUDHI_PYTHON_lib_dir - '${THE_LIB_DIR}' does not exist") + endif() + endforeach() endfunction( add_GUDHI_PYTHON_lib_dir ) # THE_TEST is the python test file name (without .py extension) containing tests functions @@ -176,6 +179,10 @@ if(PYTHONINTERP_FOUND) endif () if(CGAL_FOUND) + if(NOT CGAL_VERSION VERSION_LESS 5.3.0) + # CGAL_HEADER_ONLY has been dropped for CGAL >= 5.3. Only the header-only version is supported. + set(CGAL_HEADER_ONLY True) + endif(NOT CGAL_VERSION VERSION_LESS 5.3.0) # Add CGAL compilation args if(CGAL_HEADER_ONLY) add_gudhi_debug_info("CGAL header only version ${CGAL_VERSION}") @@ -183,7 +190,7 @@ if(PYTHONINTERP_FOUND) else(CGAL_HEADER_ONLY) add_gudhi_debug_info("CGAL version ${CGAL_VERSION}") add_GUDHI_PYTHON_lib("${CGAL_LIBRARY}") - add_GUDHI_PYTHON_lib_dir("${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) @@ -191,7 +198,7 @@ if(PYTHONINTERP_FOUND) else() add_GUDHI_PYTHON_lib("${Boost_SYSTEM_LIBRARY_RELEASE}") endif() - add_GUDHI_PYTHON_lib_dir("${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. @@ -203,13 +210,13 @@ if(PYTHONINTERP_FOUND) 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}") + 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}") - add_GUDHI_PYTHON_lib_dir("${GMPXX_LIBRARIES_DIR}") + add_GUDHI_PYTHON_lib_dir(${GMPXX_LIBRARIES_DIR}) message("** Add gmpxx ${GMPXX_LIBRARIES_DIR}") endif(GMPXX_FOUND) endif(GMP_FOUND) @@ -222,7 +229,7 @@ if(PYTHONINTERP_FOUND) 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}") + add_GUDHI_PYTHON_lib_dir(${MPFR_LIBRARIES_DIR}) message("** Add mpfr ${MPFR_LIBRARIES_DIR}") endif(MPFR_FOUND) endif(CGAL_FOUND) @@ -243,14 +250,14 @@ if(PYTHONINTERP_FOUND) if (TBB_FOUND AND WITH_GUDHI_USE_TBB) add_gudhi_debug_info("TBB version ${TBB_INTERFACE_VERSION} found and used") set(GUDHI_PYTHON_EXTRA_COMPILE_ARGS "${GUDHI_PYTHON_EXTRA_COMPILE_ARGS}'-DGUDHI_USE_TBB', ") - if(CMAKE_BUILD_TYPE MATCHES Debug) + if((CMAKE_BUILD_TYPE MATCHES Debug) AND TBB_DEBUG_LIBRARY) add_GUDHI_PYTHON_lib("${TBB_DEBUG_LIBRARY}") add_GUDHI_PYTHON_lib("${TBB_MALLOC_DEBUG_LIBRARY}") else() add_GUDHI_PYTHON_lib("${TBB_RELEASE_LIBRARY}") add_GUDHI_PYTHON_lib("${TBB_MALLOC_RELEASE_LIBRARY}") endif() - add_GUDHI_PYTHON_lib_dir("${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() @@ -290,7 +297,12 @@ if(PYTHONINTERP_FOUND) add_custom_target(python ALL DEPENDS gudhi.so COMMENT "Do not forget to add ${CMAKE_CURRENT_BINARY_DIR}/ to your PYTHONPATH before using examples or tests") - set(GUDHI_PYTHON_PATH_ENV "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}:$ENV{PYTHONPATH}") + # Path separator management for windows + if (WIN32) + set(GUDHI_PYTHON_PATH_ENV "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR};$ENV{PYTHONPATH}") + else(WIN32) + set(GUDHI_PYTHON_PATH_ENV "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}:$ENV{PYTHONPATH}") + endif(WIN32) # Documentation generation is available through sphinx - requires all modules # Make it first as sphinx test is by far the longest test which is nice when testing in parallel if(SPHINX_PATH) diff --git a/src/python/doc/datasets_generators.rst b/src/python/doc/datasets_generators.rst index 6f36bce1..260c3882 100644 --- a/src/python/doc/datasets_generators.rst +++ b/src/python/doc/datasets_generators.rst @@ -42,7 +42,7 @@ Example .. autofunction:: gudhi.datasets.generators.points.sphere Points on a flat torus -^^^^^^^^^^^^^^^^ +^^^^^^^^^^^^^^^^^^^^^^ You can also generate points on a torus. diff --git a/src/python/gudhi/datasets/generators/_points.cc b/src/python/gudhi/datasets/generators/_points.cc index 70ce4925..82fea25b 100644 --- a/src/python/gudhi/datasets/generators/_points.cc +++ b/src/python/gudhi/datasets/generators/_points.cc @@ -96,7 +96,6 @@ PYBIND11_MODULE(_points, m) { :type radius: float :param sample: The sample type. Default and only available value is `"random"`. :type sample: string - :rtype: numpy array of float :returns: the generated points on a sphere. )pbdoc"); @@ -111,10 +110,12 @@ PYBIND11_MODULE(_points, m) { :type dim: integer :param sample: The sample type. Available values are: `"random"` and `"grid"`. Default value is `"random"`. :type sample: string - :rtype: numpy array of float. - The shape of returned numpy array is : - if sample is 'random' : (n_samples, 2*dim). - if sample is 'grid' : (⌊n_samples**(1./dim)⌋**dim, 2*dim), where shape[0] is rounded down to the closest perfect 'dim'th power. :returns: the generated points on a torus. + + The shape of returned numpy array is: + + If sample is 'random': (n_samples, 2*dim). + + If sample is 'grid': (⌊n_samples**(1./dim)⌋**dim, 2*dim), where shape[0] is rounded down to the closest perfect 'dim'th power. )pbdoc"); } diff --git a/src/python/gudhi/datasets/generators/points.py b/src/python/gudhi/datasets/generators/points.py index cf97777d..9bb2799d 100644 --- a/src/python/gudhi/datasets/generators/points.py +++ b/src/python/gudhi/datasets/generators/points.py @@ -19,15 +19,15 @@ def _generate_random_points_on_torus(n_samples, dim): # Based on angles, construct points of size n_samples*dim on a circle and reshape the result in a n_samples*2*dim array array_points = np.column_stack([np.cos(alpha), np.sin(alpha)]).reshape(-1, 2*dim) - + return array_points def _generate_grid_points_on_torus(n_samples, dim): - + # Generate points on a dim-torus as a grid n_samples_grid = int((n_samples+.5)**(1./dim)) # add .5 to avoid rounding down with numerical approximations alpha = np.linspace(0, 2*np.pi, n_samples_grid, endpoint=False) - + array_points = np.column_stack([np.cos(alpha), np.sin(alpha)]) array_points_idx = np.empty([n_samples_grid]*dim + [dim], dtype=int) for i, x in enumerate(np.ix_(*([np.arange(n_samples_grid)]*dim))): @@ -35,16 +35,19 @@ def _generate_grid_points_on_torus(n_samples, dim): return array_points[array_points_idx].reshape(-1, 2*dim) def torus(n_samples, dim, sample='random'): - """ + """ Generate points on a flat dim-torus in R^2dim either randomly or on a grid - + :param n_samples: The number of points to be generated. :param dim: The dimension of the torus on which points would be generated in R^2*dim. :param sample: The sample type of the generated points. Can be 'random' or 'grid'. :returns: numpy array containing the generated points on a torus. - The shape of returned numpy array is: - if sample is 'random' : (n_samples, 2*dim). - if sample is 'grid' : (⌊n_samples**(1./dim)⌋**dim, 2*dim), where shape[0] is rounded down to the closest perfect 'dim'th power. + + The shape of returned numpy array is: + + If sample is 'random': (n_samples, 2*dim). + + If sample is 'grid': (⌊n_samples**(1./dim)⌋**dim, 2*dim), where shape[0] is rounded down to the closest perfect 'dim'th power. """ if sample == 'random': # Generate points randomly |