diff --git a/.github/for_maintainers/new_gudhi_version_creation.md b/.github/for_maintainers/new_gudhi_version_creation.md index 1bb6382bba..d094615bdd 100644 --- a/.github/for_maintainers/new_gudhi_version_creation.md +++ b/.github/for_maintainers/new_gudhi_version_creation.md @@ -25,7 +25,7 @@ nor [unlabelled closed PRs](https://github.com/GUDHI/gudhi-devel/pulls?q=is%3Apr **Edit the file CMakeGUDHIVersion.txt**, and increment major, minor, or patch version number, in function of the version new delivery. ```bash # cf. .gitignore - ignore this if it is a fresh clone version -rm -rf data/points/COIL_database/lucky_cat.off_dist data/points/COIL_database/lucky_cat.off_sc.dot data/points/KleinBottle5D.off_dist data/points/KleinBottle5D.off_sc.dot data/points/human.off_dist data/points/human.off_sc.off data/points/human.off_sc.txt src/python/test/__pycache__ src/python/gudhi/*.cpp +rm -rf data/points/COIL_database/lucky_cat.off_dist data/points/COIL_database/lucky_cat.off_sc.dot data/points/KleinBottle5D.off_dist data/points/KleinBottle5D.off_sc.dot data/points/human.off_dist data/points/human.off_sc.off data/points/human.off_sc.txt src/python/test/__pycache__ ``` Checkin the modifications, build and test the version: @@ -154,4 +154,4 @@ Send version mail to the following lists : **Edit the file CMakeGUDHIVersion.txt**, and increment major, minor, or patch version number, in function of the future version (something like `3.X+1.0a0`). -Reset [.github/next_release.md](.github/next_release.md) with [.github/for_maintainers/next_release_template.md](.github/for_maintainers/next_release_template.md). \ No newline at end of file +Reset [.github/next_release.md](.github/next_release.md) with [.github/for_maintainers/next_release_template.md](.github/for_maintainers/next_release_template.md). diff --git a/.github/workflows/pip-packaging-linux.yml b/.github/workflows/pip-packaging-linux.yml index bec8e4a62b..f93d4fbf85 100644 --- a/.github/workflows/pip-packaging-linux.yml +++ b/.github/workflows/pip-packaging-linux.yml @@ -19,7 +19,6 @@ jobs: # numpy~=1.21.4 means any numpy=1.21.*, but also numpy>=1.21.4 (numpy~=1.21 do not work as it means any numpy==1.*) - name: Build wheel for Python 3.8 run: | - rm -rf src/python/gudhi/*.cpp mkdir build_38 cd build_38 cmake -DCMAKE_BUILD_TYPE=Release -DPython_EXECUTABLE=$PYTHON38/bin/python .. @@ -38,7 +37,6 @@ jobs: $PYTHON38/bin/python -m pytest -v src/python/test/test_rips_complex.py - name: Build wheel for Python 3.9 run: | - rm -rf src/python/gudhi/*.cpp mkdir build_39 cd build_39 cmake -DCMAKE_BUILD_TYPE=Release -DPython_EXECUTABLE=$PYTHON39/bin/python .. @@ -61,7 +59,6 @@ jobs: $PYTHON39/bin/python -m pytest -v src/python/test/test_rips_complex.py - name: Build wheel for Python 3.10 run: | - rm -rf src/python/gudhi/*.cpp mkdir build_310 cd build_310 cmake -DCMAKE_BUILD_TYPE=Release -DPython_EXECUTABLE=$PYTHON310/bin/python .. @@ -80,7 +77,6 @@ jobs: $PYTHON310/bin/python -m pytest -v src/python/test/test_rips_complex.py - name: Build wheel for Python 3.11 run: | - rm -rf src/python/gudhi/*.cpp mkdir build_311 cd build_311 cmake -DCMAKE_BUILD_TYPE=Release -DPython_EXECUTABLE=$PYTHON311/bin/python .. @@ -99,7 +95,6 @@ jobs: $PYTHON311/bin/python -m pytest -v src/python/test/test_rips_complex.py - name: Build wheel for Python 3.12 run: | - rm -rf src/python/gudhi/*.cpp mkdir build_312 cd build_312 cmake -DCMAKE_BUILD_TYPE=Release -DPython_EXECUTABLE=$PYTHON312/bin/python .. diff --git a/.gitignore b/.gitignore index 14e4a62e89..bcf839cb8b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,6 @@ # Classical CMake build directory /*build* -# Generated by Cython -src/python/gudhi/*.cpp - # Generated by tests data/points/COIL_database/lucky_cat.off_dist data/points/COIL_database/lucky_cat.off_sc.dot diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt index c60f7b9460..cce1ea77de 100644 --- a/src/python/CMakeLists.txt +++ b/src/python/CMakeLists.txt @@ -56,6 +56,17 @@ function( add_gudhi_py_test THE_TEST ) endif() endfunction( add_gudhi_py_test ) +function( add_gudhi_symbolic_links GLOBBING_EXPRESSION ) + # No symbolic links if build in sources (aka. 'cmake .' in sources) + if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR) + return() + endif() + file(GLOB GUDHI_GLOB_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${GLOBBING_EXPRESSION}) + foreach(GUDHI_GLOB_FILENAME ${GUDHI_GLOB_FILES}) + file(CREATE_LINK "${CMAKE_CURRENT_SOURCE_DIR}/${GUDHI_GLOB_FILENAME}" "${CMAKE_CURRENT_BINARY_DIR}/${GUDHI_GLOB_FILENAME}" SYMBOLIC) + endforeach() +endfunction( add_gudhi_symbolic_links ) + # Set gudhi.__debug_info__ # WARNING : to be done before setup.py.in configure_file function( add_gudhi_debug_info DEBUG_INFO ) @@ -382,6 +393,14 @@ file(COPY "gudhi/flag_filtration" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/gudhi # Some files for pip package file(COPY "pyproject.toml" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/") +# Symbolic links to cython and Pybind11 sources to be built. "MAKE_DIRECTORY gudhi" must be done before +add_gudhi_symbolic_links("gudhi/*.pxd") +add_gudhi_symbolic_links("gudhi/*.pyx") +add_gudhi_symbolic_links("gudhi/*.cc") +add_gudhi_symbolic_links("gudhi/clustering/_tomato.cc") +add_gudhi_symbolic_links("gudhi/hera/*.cc") +add_gudhi_symbolic_links("gudhi/datasets/generators/_points.cc") + add_custom_command( OUTPUT gudhi.so WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} @@ -438,7 +457,7 @@ add_test(NAME random_cubical_complex_persistence_example_py_test add_gudhi_py_test(test_cubical_complex) -# Datasets are fetched for these tests +# Datasets are fetched for these tests if(SKLEARN_FOUND AND WITH_GUDHI_REMOTE_TEST) add_gudhi_py_test(test_sklearn_cubical_persistence) @@ -574,7 +593,7 @@ if(SKLEARN_FOUND) add_gudhi_py_test(test_sklearn_rips_persistence) endif() - # Datasets are fetched for these tests + # Datasets are fetched for these tests if(WITH_GUDHI_REMOTE_TEST) add_test(NAME rips_complex_sklearn_itf_py_test WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} @@ -690,4 +709,4 @@ if(MATPLOTLIB_FOUND) endif() # Set missing or not modules -set(GUDHI_MODULES ${GUDHI_MODULES} "python" CACHE INTERNAL "GUDHI_MODULES") \ No newline at end of file +set(GUDHI_MODULES ${GUDHI_MODULES} "python" CACHE INTERNAL "GUDHI_MODULES") diff --git a/src/python/setup.py.in b/src/python/setup.py.in index 0746536e12..3bc8d0805e 100644 --- a/src/python/setup.py.in +++ b/src/python/setup.py.in @@ -17,7 +17,7 @@ import pybind11 cython_modules = [@GUDHI_CYTHON_MODULES@] pybind11_modules = [@GUDHI_PYBIND11_MODULES@] -source_dir='@CMAKE_CURRENT_SOURCE_DIR@/gudhi/' +source_dir='gudhi/' extra_compile_args=[@GUDHI_PYTHON_EXTRA_COMPILE_ARGS@] extra_link_args=[@GUDHI_PYTHON_EXTRA_LINK_ARGS@] libraries=[@GUDHI_PYTHON_LIBRARIES@]