potato-peeling 0.1.0a1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. potato_peeling-0.1.0a1/.clang-format +17 -0
  2. potato_peeling-0.1.0a1/.github/workflows/ci.yml +78 -0
  3. potato_peeling-0.1.0a1/.github/workflows/wheels.yml +153 -0
  4. potato_peeling-0.1.0a1/.gitignore +6 -0
  5. potato_peeling-0.1.0a1/CMakeLists.txt +175 -0
  6. potato_peeling-0.1.0a1/COPYING +674 -0
  7. potato_peeling-0.1.0a1/COPYING.LESSER +165 -0
  8. potato_peeling-0.1.0a1/LICENSES/Apache-2.0-WITH-LLVM-exception-CDT.txt +311 -0
  9. potato_peeling-0.1.0a1/LICENSES/BSD-3-Clause-CDT-predicates.txt +27 -0
  10. potato_peeling-0.1.0a1/LICENSES/BSD-3-Clause-nanobind.txt +26 -0
  11. potato_peeling-0.1.0a1/LICENSES/BSL-1.0.txt +23 -0
  12. potato_peeling-0.1.0a1/LICENSES/MIT-robin-map.txt +21 -0
  13. potato_peeling-0.1.0a1/LICENSES/MPL-2.0-CDT.txt +373 -0
  14. potato_peeling-0.1.0a1/PKG-INFO +182 -0
  15. potato_peeling-0.1.0a1/README.md +163 -0
  16. potato_peeling-0.1.0a1/THIRD-PARTY-NOTICES.txt +42 -0
  17. potato_peeling-0.1.0a1/bindings/python/module.cpp +326 -0
  18. potato_peeling-0.1.0a1/ci/check_version.py +34 -0
  19. potato_peeling-0.1.0a1/ci/install_deps.sh +104 -0
  20. potato_peeling-0.1.0a1/cmake/potato_peelingConfig.cmake.in +18 -0
  21. potato_peeling-0.1.0a1/include/potato_peeling/errors.hpp +30 -0
  22. potato_peeling-0.1.0a1/include/potato_peeling/options.hpp +80 -0
  23. potato_peeling-0.1.0a1/include/potato_peeling/potato_peeling.hpp +118 -0
  24. potato_peeling-0.1.0a1/include/potato_peeling/simple.hpp +57 -0
  25. potato_peeling-0.1.0a1/include/potato_peeling/types.hpp +47 -0
  26. potato_peeling-0.1.0a1/include/potato_peeling/utilities.hpp +39 -0
  27. potato_peeling-0.1.0a1/pyproject.toml +57 -0
  28. potato_peeling-0.1.0a1/python/potato_peeling/__init__.py +24 -0
  29. potato_peeling-0.1.0a1/python/potato_peeling/_api.py +207 -0
  30. potato_peeling-0.1.0a1/python/potato_peeling/py.typed +0 -0
  31. potato_peeling-0.1.0a1/src/internal/aronov/aronov.cpp +212 -0
  32. potato_peeling-0.1.0a1/src/internal/aronov/aronov.hpp +73 -0
  33. potato_peeling-0.1.0a1/src/internal/aronov/mesh.cpp +456 -0
  34. potato_peeling-0.1.0a1/src/internal/aronov/mesh.hpp +134 -0
  35. potato_peeling-0.1.0a1/src/internal/aronov/predicates.cpp +80 -0
  36. potato_peeling-0.1.0a1/src/internal/aronov/predicates.hpp +51 -0
  37. potato_peeling-0.1.0a1/src/internal/aronov/sweep.cpp +423 -0
  38. potato_peeling-0.1.0a1/src/internal/aronov/sweep.hpp +29 -0
  39. potato_peeling-0.1.0a1/src/internal/bounds/upper_bound.cpp +553 -0
  40. potato_peeling-0.1.0a1/src/internal/bounds/upper_bound.hpp +48 -0
  41. potato_peeling-0.1.0a1/src/internal/cabello/a_bound.cpp +50 -0
  42. potato_peeling-0.1.0a1/src/internal/cabello/a_bound.hpp +22 -0
  43. potato_peeling-0.1.0a1/src/internal/cabello/cabello.cpp +240 -0
  44. potato_peeling-0.1.0a1/src/internal/cabello/cabello.hpp +74 -0
  45. potato_peeling-0.1.0a1/src/internal/cabello/certify.cpp +133 -0
  46. potato_peeling-0.1.0a1/src/internal/cabello/certify.hpp +49 -0
  47. potato_peeling-0.1.0a1/src/internal/cabello/convex_clique.cpp +220 -0
  48. potato_peeling-0.1.0a1/src/internal/cabello/convex_clique.hpp +23 -0
  49. potato_peeling-0.1.0a1/src/internal/cabello/graph.hpp +65 -0
  50. potato_peeling-0.1.0a1/src/internal/cabello/kernel.cpp +12 -0
  51. potato_peeling-0.1.0a1/src/internal/cabello/kernel.hpp +46 -0
  52. potato_peeling-0.1.0a1/src/internal/cabello/rng.hpp +52 -0
  53. potato_peeling-0.1.0a1/src/internal/cabello/sampling.cpp +104 -0
  54. potato_peeling-0.1.0a1/src/internal/cabello/sampling.hpp +73 -0
  55. potato_peeling-0.1.0a1/src/internal/cabello/vertex_skull.cpp +45 -0
  56. potato_peeling-0.1.0a1/src/internal/cabello/vertex_skull.hpp +21 -0
  57. potato_peeling-0.1.0a1/src/internal/cabello/visibility.cpp +123 -0
  58. potato_peeling-0.1.0a1/src/internal/cabello/visibility.hpp +58 -0
  59. potato_peeling-0.1.0a1/src/internal/chang_and_yap/chang_and_yap.cpp +2037 -0
  60. potato_peeling-0.1.0a1/src/internal/chang_and_yap/chang_and_yap.hpp +420 -0
  61. potato_peeling-0.1.0a1/src/internal/common.hpp +42 -0
  62. potato_peeling-0.1.0a1/src/internal/geometry.cpp +267 -0
  63. potato_peeling-0.1.0a1/src/internal/geometry.hpp +76 -0
  64. potato_peeling-0.1.0a1/src/internal/longest_segment.cpp +68 -0
  65. potato_peeling-0.1.0a1/src/internal/longest_segment.hpp +22 -0
  66. potato_peeling-0.1.0a1/src/internal/refinement/refinement.cpp +389 -0
  67. potato_peeling-0.1.0a1/src/internal/refinement/refinement.hpp +75 -0
  68. potato_peeling-0.1.0a1/src/potato_peeling.cpp +123 -0
  69. potato_peeling-0.1.0a1/src/simple.cpp +68 -0
  70. potato_peeling-0.1.0a1/src/utilities.cpp +46 -0
  71. potato_peeling-0.1.0a1/tests/cpp/CMakeLists.txt +41 -0
  72. potato_peeling-0.1.0a1/tests/cpp/internal/longest_segment.cpp +106 -0
  73. potato_peeling-0.1.0a1/tests/cpp/internal/mesh.cpp +144 -0
  74. potato_peeling-0.1.0a1/tests/cpp/internal/vertex_skull.cpp +56 -0
  75. potato_peeling-0.1.0a1/tests/cpp/main.cpp +2 -0
  76. potato_peeling-0.1.0a1/tests/cpp/polygons.hpp +86 -0
  77. potato_peeling-0.1.0a1/tests/cpp/public/errors.cpp +77 -0
  78. potato_peeling-0.1.0a1/tests/cpp/public/kernels.cpp +105 -0
  79. potato_peeling-0.1.0a1/tests/cpp/public/simple.cpp +100 -0
  80. potato_peeling-0.1.0a1/tests/cpp/public/simple_no_cgal.cpp +14 -0
  81. potato_peeling-0.1.0a1/tests/cpp/public/stop.cpp +152 -0
  82. potato_peeling-0.1.0a1/tests/data/optima.json +7590 -0
  83. potato_peeling-0.1.0a1/tests/python/conftest.py +131 -0
  84. potato_peeling-0.1.0a1/tests/python/test_cancel.py +116 -0
  85. potato_peeling-0.1.0a1/tests/python/test_errors.py +121 -0
  86. potato_peeling-0.1.0a1/tests/python/test_exact.py +71 -0
  87. potato_peeling-0.1.0a1/tests/python/test_inputs.py +142 -0
  88. potato_peeling-0.1.0a1/tests/python/test_mesh.py +121 -0
  89. potato_peeling-0.1.0a1/tests/python/test_methods.py +228 -0
  90. potato_peeling-0.1.0a1/uv.lock +560 -0
@@ -0,0 +1,17 @@
1
+ BasedOnStyle: LLVM
2
+ IndentWidth: 4
3
+ ColumnLimit: 100
4
+ BreakBeforeBraces: Attach
5
+ NamespaceIndentation: All
6
+ PointerAlignment: Right
7
+ ReferenceAlignment: Right
8
+ AccessModifierOffset: -4
9
+ AllowShortFunctionsOnASingleLine: Inline
10
+ AllowShortIfStatementsOnASingleLine: WithoutElse
11
+ AllowShortLoopsOnASingleLine: true
12
+ AllowShortBlocksOnASingleLine: Empty
13
+ FixNamespaceComments: true
14
+ SortIncludes: Never
15
+ ReflowComments: false
16
+ SpacesBeforeTrailingComments: 2
17
+ BreakBeforeBinaryOperators: All
@@ -0,0 +1,78 @@
1
+ # Build and test on every push and pull request: the default C++ and Python test
2
+ # sets against system packages (wheels use pinned dependencies, see wheels.yml).
3
+ name: CI
4
+
5
+ on:
6
+ push:
7
+ pull_request:
8
+ workflow_dispatch:
9
+
10
+ permissions:
11
+ contents: read
12
+
13
+ env:
14
+ # uv's own Python, which has the headers the extension builds against
15
+ UV_PYTHON_PREFERENCE: only-managed
16
+
17
+ concurrency:
18
+ group: ${{ github.workflow }}-${{ github.ref }}
19
+ cancel-in-progress: true
20
+
21
+ jobs:
22
+ version:
23
+ runs-on: ubuntu-latest
24
+ steps:
25
+ - uses: actions/checkout@v7
26
+ - run: python3 ci/check_version.py
27
+
28
+ linux:
29
+ name: ${{ matrix.name }}
30
+ runs-on: ${{ matrix.os }}
31
+ strategy:
32
+ fail-fast: false
33
+ matrix:
34
+ include:
35
+ - name: Ubuntu (latest)
36
+ os: ubuntu-latest
37
+ python: true
38
+ # The oldest supported setup: CGAL 5.4, Boost 1.74, CMake 3.22. C++ only.
39
+ - name: Ubuntu 22.04 (minimum versions)
40
+ os: ubuntu-22.04
41
+ python: false
42
+ steps:
43
+ - uses: actions/checkout@v7
44
+ - name: Dependencies
45
+ run: |
46
+ sudo apt-get update
47
+ sudo apt-get install -y --no-install-recommends \
48
+ g++ cmake libcgal-dev libboost-dev libgmp-dev libmpfr-dev
49
+ - name: C++ build and tests
50
+ run: |
51
+ cmake -S . -B build/ci -DCMAKE_BUILD_TYPE=Release
52
+ cmake --build build/ci -j "$(nproc)"
53
+ ctest --test-dir build/ci -LE slow --output-on-failure
54
+ - if: matrix.python
55
+ uses: astral-sh/setup-uv@v10.3.3
56
+ - if: matrix.python
57
+ name: Python tests
58
+ run: |
59
+ uv sync
60
+ uv run pytest
61
+
62
+ macos:
63
+ name: macOS (arm64)
64
+ runs-on: macos-15
65
+ steps:
66
+ - uses: actions/checkout@v7
67
+ - name: Dependencies
68
+ run: brew install cgal boost gmp mpfr
69
+ - name: C++ build and tests
70
+ run: |
71
+ cmake -S . -B build/ci -DCMAKE_BUILD_TYPE=Release
72
+ cmake --build build/ci -j "$(sysctl -n hw.ncpu)"
73
+ ctest --test-dir build/ci -LE slow --output-on-failure
74
+ - uses: astral-sh/setup-uv@v10.3.3
75
+ - name: Python tests
76
+ run: |
77
+ uv sync
78
+ uv run pytest
@@ -0,0 +1,153 @@
1
+ # The sdist and wheels, each wheel tested with the default Python test set.
2
+ # - pull requests touching packaging, and manual runs: build and test only;
3
+ # - manual run with "publish" ticked: also upload to TestPyPI;
4
+ # - a v* tag (matching the version): also upload to PyPI.
5
+ # Uploads use trusted publishing (environments testpypi and pypi).
6
+ name: Wheels
7
+
8
+ on:
9
+ workflow_dispatch:
10
+ inputs:
11
+ publish:
12
+ description: Upload to TestPyPI
13
+ type: boolean
14
+ default: false
15
+ push:
16
+ tags: ["v*"]
17
+ pull_request:
18
+ paths:
19
+ - pyproject.toml
20
+ - CMakeLists.txt
21
+ - ci/**
22
+ - .github/workflows/wheels.yml
23
+
24
+ permissions:
25
+ contents: read
26
+
27
+ jobs:
28
+ sdist:
29
+ runs-on: ubuntu-latest
30
+ steps:
31
+ - uses: actions/checkout@v7
32
+ - name: Version
33
+ run: |
34
+ if [ "${{ github.ref_type }}" = tag ]; then
35
+ python3 ci/check_version.py --tag "${{ github.ref_name }}"
36
+ else
37
+ python3 ci/check_version.py
38
+ fi
39
+ - uses: astral-sh/setup-uv@v10.3.3
40
+ - run: uv build --sdist
41
+ - uses: actions/upload-artifact@v7
42
+ with:
43
+ name: sdist
44
+ path: dist/*.tar.gz
45
+
46
+ wheels:
47
+ name: Wheels (${{ matrix.os }})
48
+ needs: sdist
49
+ runs-on: ${{ matrix.os }}
50
+ # a hang (a stalled download, a stuck test) fails here instead of after 6 hours
51
+ timeout-minutes: 90
52
+ strategy:
53
+ fail-fast: false
54
+ matrix:
55
+ os: [ubuntu-latest, ubuntu-24.04-arm, macos-15, macos-15-intel]
56
+ steps:
57
+ - uses: actions/download-artifact@v8
58
+ with:
59
+ name: sdist
60
+ path: sdist
61
+ # Built from the sdist, so a broken sdist fails here.
62
+ - name: Locate the sdist
63
+ id: sdist
64
+ run: echo "path=$(ls sdist/*.tar.gz)" >> "$GITHUB_OUTPUT"
65
+ # macOS builds GMP and MPFR from source (minutes); keep the installed prefix
66
+ # until ci/install_deps.sh changes. The script skips a prefix it filled.
67
+ - if: runner.os == 'macOS'
68
+ uses: actions/checkout@v7
69
+ with:
70
+ sparse-checkout: ci
71
+ path: src
72
+ - if: runner.os == 'macOS'
73
+ uses: actions/cache@v6
74
+ with:
75
+ path: /tmp/potato-peeling-deps
76
+ key: deps-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('src/ci/install_deps.sh') }}
77
+ - uses: pypa/cibuildwheel@v4.3.5
78
+ with:
79
+ package-dir: ${{ steps.sdist.outputs.path }}
80
+ output-dir: wheelhouse
81
+ - uses: actions/upload-artifact@v7
82
+ with:
83
+ name: wheels-${{ matrix.os }}
84
+ path: wheelhouse/*.whl
85
+
86
+ # cibuildwheel tests the abi3 wheel on 3.12 only. Check it statically for
87
+ # anything outside the stable ABI, and test it on the newest Python; with 3.12
88
+ # passing too, the versions between are covered.
89
+ abi3:
90
+ name: abi3 wheel on ${{ matrix.python }} (${{ matrix.os }})
91
+ needs: wheels
92
+ runs-on: ${{ matrix.os }}
93
+ timeout-minutes: 30
94
+ strategy:
95
+ fail-fast: false
96
+ matrix:
97
+ os: [ubuntu-latest, ubuntu-24.04-arm, macos-15, macos-15-intel]
98
+ python: ["3.15"]
99
+ steps:
100
+ - uses: actions/checkout@v7
101
+ with:
102
+ sparse-checkout: |
103
+ tests
104
+ pyproject.toml
105
+ sparse-checkout-cone-mode: false
106
+ - uses: actions/setup-python@v7
107
+ with:
108
+ python-version: ${{ matrix.python }}
109
+ - uses: actions/download-artifact@v8
110
+ with:
111
+ name: wheels-${{ matrix.os }}
112
+ path: wheelhouse
113
+ - name: Stable ABI
114
+ run: |
115
+ python -m pip install abi3audit
116
+ abi3audit --strict --summary wheelhouse/*-abi3-*.whl
117
+ - name: Install and test
118
+ run: |
119
+ python -m pip install pytest
120
+ # optional test dependencies: their tests skip if no wheel exists yet
121
+ python -m pip install --only-binary :all: numpy shapely || true
122
+ python -m pip install --no-index --find-links wheelhouse potato-peeling
123
+ python -m pytest tests/python
124
+
125
+ testpypi:
126
+ if: github.event_name == 'workflow_dispatch' && inputs.publish
127
+ needs: [sdist, wheels, abi3]
128
+ runs-on: ubuntu-latest
129
+ environment: testpypi
130
+ permissions:
131
+ id-token: write
132
+ steps:
133
+ - uses: actions/download-artifact@v8
134
+ with:
135
+ path: dist
136
+ merge-multiple: true
137
+ - uses: pypa/gh-action-pypi-publish@v1.14.3
138
+ with:
139
+ repository-url: https://test.pypi.org/legacy/
140
+
141
+ pypi:
142
+ if: github.ref_type == 'tag' && startsWith(github.ref_name, 'v')
143
+ needs: [sdist, wheels, abi3]
144
+ runs-on: ubuntu-latest
145
+ environment: pypi
146
+ permissions:
147
+ id-token: write
148
+ steps:
149
+ - uses: actions/download-artifact@v8
150
+ with:
151
+ path: dist
152
+ merge-multiple: true
153
+ - uses: pypa/gh-action-pypi-publish@v1.14.3
@@ -0,0 +1,6 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ .venv/
4
+ /build/
5
+ /dist/
6
+ .idea/
@@ -0,0 +1,175 @@
1
+ cmake_minimum_required(VERSION 3.20)
2
+ project(potato_peeling VERSION 0.1.0 LANGUAGES CXX)
3
+
4
+ foreach (policy CMP0135 CMP0167)
5
+ if (POLICY ${policy})
6
+ cmake_policy(SET ${policy} NEW)
7
+ endif ()
8
+ endforeach ()
9
+
10
+ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
11
+ set(CMAKE_CXX_VISIBILITY_PRESET hidden)
12
+ set(CMAKE_VISIBILITY_INLINES_HIDDEN ON)
13
+
14
+ if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
15
+ set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
16
+ endif ()
17
+
18
+ # Shared by default, so LGPL users can relink against a modified library.
19
+ option(BUILD_SHARED_LIBS "Build potato_peeling as a shared library" ON)
20
+
21
+ include(GNUInstallDirs)
22
+ include(GenerateExportHeader)
23
+ include(CMakePackageConfigHelpers)
24
+
25
+ # CGAL's exact rational, and so FT, is GMP's mpq_class when GMP's C++ interface
26
+ # is linked and Boost.Multiprecision's GMP rational otherwise. FT is part of the
27
+ # API, and refine's double-steered search can differ between the two in the last
28
+ # bits, so every build uses the second (and nothing links libgmpxx).
29
+ set(CGAL_WITH_GMPXX OFF CACHE BOOL "Use GMP's C++ classes in CGAL; must be OFF for potato_peeling" FORCE)
30
+ find_package(CGAL 5.4 REQUIRED)
31
+ find_package(Boost 1.74 CONFIG REQUIRED)
32
+
33
+ # CDT (MPL-2.0), header-only and private to the build: an installed package if
34
+ # there is one, else this pinned release. The release is only unpacked (its
35
+ # CMake project, with its install rules, is not added).
36
+ find_package(CDT CONFIG QUIET)
37
+ if (NOT TARGET CDT::CDT)
38
+ include(FetchContent)
39
+ FetchContent_Declare(CDT
40
+ URL https://github.com/artem-ogre/CDT/archive/refs/tags/2.0.1.tar.gz
41
+ URL_HASH SHA256=5e3c45715e55b5f2d4390082c8c1ac026f635ddee233516fdcf94b197954367d
42
+ SOURCE_SUBDIR no-cmake-project)
43
+ FetchContent_MakeAvailable(CDT)
44
+ add_library(potato_peeling_cdt INTERFACE)
45
+ target_include_directories(potato_peeling_cdt SYSTEM INTERFACE ${cdt_SOURCE_DIR}/CDT/include)
46
+ add_library(CDT::CDT ALIAS potato_peeling_cdt)
47
+ endif ()
48
+
49
+ # ── C++ core, compiled once ───────────────────────────────────────────────────
50
+ # The library, the Python module and the tests all link these objects.
51
+ add_library(potato_peeling_core OBJECT
52
+ src/internal/geometry.cpp
53
+ src/internal/longest_segment.cpp
54
+ src/potato_peeling.cpp
55
+ src/utilities.cpp
56
+ src/simple.cpp
57
+ src/internal/chang_and_yap/chang_and_yap.cpp
58
+ src/internal/aronov/mesh.cpp
59
+ src/internal/aronov/predicates.cpp
60
+ src/internal/aronov/sweep.cpp
61
+ src/internal/aronov/aronov.cpp
62
+ src/internal/cabello/kernel.cpp
63
+ src/internal/cabello/certify.cpp
64
+ src/internal/cabello/sampling.cpp
65
+ src/internal/cabello/visibility.cpp
66
+ src/internal/cabello/convex_clique.cpp
67
+ src/internal/cabello/a_bound.cpp
68
+ src/internal/cabello/cabello.cpp
69
+ src/internal/cabello/vertex_skull.cpp
70
+ src/internal/refinement/refinement.cpp
71
+ src/internal/bounds/upper_bound.cpp
72
+ )
73
+ target_include_directories(potato_peeling_core
74
+ PUBLIC
75
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
76
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
77
+ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
78
+ target_compile_features(potato_peeling_core PUBLIC cxx_std_17)
79
+ target_link_libraries(potato_peeling_core PUBLIC CGAL::CGAL PRIVATE Boost::headers CDT::CDT)
80
+ # The upper bound's double-precision search must round the same everywhere.
81
+ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
82
+ set_source_files_properties(src/internal/bounds/upper_bound.cpp
83
+ PROPERTIES COMPILE_OPTIONS "-ffp-contract=off")
84
+ endif ()
85
+ target_compile_definitions(potato_peeling_core PRIVATE
86
+ # Fail the build if any GPL-licensed CGAL package is included.
87
+ CGAL_LICENSE_ERROR
88
+ CDT_ENSURE_PRECISE_MATH_IN_CONSTRUCTIONS)
89
+
90
+ # The objects are compiled for the library, so they export under its name.
91
+ set_target_properties(potato_peeling_core PROPERTIES DEFINE_SYMBOL potato_peeling_EXPORTS)
92
+ generate_export_header(potato_peeling_core
93
+ BASE_NAME potato_peeling
94
+ EXPORT_FILE_NAME ${CMAKE_CURRENT_BINARY_DIR}/include/potato_peeling/export.hpp
95
+ STATIC_DEFINE POTATO_PEELING_STATIC_DEFINE)
96
+
97
+ set(POTATO_PEELING_SHARED OFF)
98
+ if (BUILD_SHARED_LIBS AND NOT SKBUILD)
99
+ set(POTATO_PEELING_SHARED ON)
100
+ endif ()
101
+ if (POTATO_PEELING_SHARED)
102
+ target_compile_definitions(potato_peeling_core PRIVATE potato_peeling_EXPORTS)
103
+ else ()
104
+ target_compile_definitions(potato_peeling_core PUBLIC POTATO_PEELING_STATIC_DEFINE)
105
+ endif ()
106
+
107
+ # ── The C++ library: potato_peeling::potato_peeling ───────────────────────────
108
+ if (NOT SKBUILD)
109
+ add_library(potato_peeling $<TARGET_OBJECTS:potato_peeling_core>)
110
+ add_library(potato_peeling::potato_peeling ALIAS potato_peeling)
111
+ target_include_directories(potato_peeling PUBLIC
112
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
113
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
114
+ $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
115
+ target_compile_features(potato_peeling PUBLIC cxx_std_17)
116
+ target_link_libraries(potato_peeling PUBLIC CGAL::CGAL)
117
+ if (NOT POTATO_PEELING_SHARED)
118
+ target_compile_definitions(potato_peeling PUBLIC POTATO_PEELING_STATIC_DEFINE)
119
+ endif ()
120
+ # The ABI may change with every minor release while the version is 0.x.
121
+ set_target_properties(potato_peeling PROPERTIES
122
+ VERSION ${PROJECT_VERSION}
123
+ SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR})
124
+
125
+ install(TARGETS potato_peeling EXPORT potato_peelingTargets
126
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT runtime
127
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT runtime
128
+ NAMELINK_COMPONENT development
129
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT development)
130
+ install(DIRECTORY include/potato_peeling ${CMAKE_CURRENT_BINARY_DIR}/include/potato_peeling
131
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT development)
132
+
133
+ set(config_dir ${CMAKE_INSTALL_LIBDIR}/cmake/potato_peeling)
134
+ install(EXPORT potato_peelingTargets NAMESPACE potato_peeling::
135
+ DESTINATION ${config_dir} COMPONENT development)
136
+ configure_package_config_file(cmake/potato_peelingConfig.cmake.in
137
+ ${CMAKE_CURRENT_BINARY_DIR}/potato_peelingConfig.cmake
138
+ INSTALL_DESTINATION ${config_dir})
139
+ write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/potato_peelingConfigVersion.cmake
140
+ COMPATIBILITY SameMinorVersion)
141
+ install(FILES
142
+ ${CMAKE_CURRENT_BINARY_DIR}/potato_peelingConfig.cmake
143
+ ${CMAKE_CURRENT_BINARY_DIR}/potato_peelingConfigVersion.cmake
144
+ DESTINATION ${config_dir} COMPONENT development)
145
+ endif ()
146
+
147
+ # ── C++ tests (ctest) ─────────────────────────────────────────────────────────
148
+ if (CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR AND NOT SKBUILD)
149
+ set(POTATO_PEELING_TESTS_DEFAULT ON)
150
+ else ()
151
+ set(POTATO_PEELING_TESTS_DEFAULT OFF)
152
+ endif ()
153
+ option(POTATO_PEELING_BUILD_TESTS "Build the C++ tests" ${POTATO_PEELING_TESTS_DEFAULT})
154
+ if (POTATO_PEELING_BUILD_TESTS AND NOT SKBUILD)
155
+ enable_testing()
156
+ add_subdirectory(tests/cpp)
157
+ endif ()
158
+
159
+ # ── Python bindings: potato_peeling._core ─────────────────────────────────────
160
+ if (SKBUILD)
161
+ find_package(Python COMPONENTS Interpreter Development.Module Development.SABIModule REQUIRED)
162
+ execute_process(
163
+ COMMAND "${Python_EXECUTABLE}" -m nanobind --cmake_dir
164
+ OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE nanobind_ROOT)
165
+ find_package(nanobind 3.0 CONFIG REQUIRED)
166
+
167
+ nanobind_add_module(_core
168
+ STABLE_ABI
169
+ NB_STATIC
170
+ bindings/python/module.cpp
171
+ )
172
+ target_link_libraries(_core PRIVATE potato_peeling_core)
173
+ target_compile_definitions(_core PRIVATE CGAL_LICENSE_ERROR)
174
+ install(TARGETS _core DESTINATION potato_peeling COMPONENT python)
175
+ endif ()