diff --git a/.github/workflows/python_build_wheel.yaml b/.github/workflows/python_build_wheel.yaml index 2b8153f..7c750e2 100644 --- a/.github/workflows/python_build_wheel.yaml +++ b/.github/workflows/python_build_wheel.yaml @@ -12,7 +12,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest, macos-14] + os: [macos-14, windows-latest, ubuntu-latest] steps: - uses: actions/checkout@v4 @@ -24,7 +24,7 @@ jobs: platforms: all - name: Build wheels - uses: pypa/cibuildwheel@v2.17.0 + uses: pypa/cibuildwheel@v2.20 - uses: actions/upload-artifact@v4 with: diff --git a/include/torch_delaunay/triangle.h b/include/torch_delaunay/triangle.h index c43f395..fb60849 100644 --- a/include/torch_delaunay/triangle.h +++ b/include/torch_delaunay/triangle.h @@ -47,7 +47,6 @@ circumcircle2d_kernel( const at::TensorAccessor p2 ) { - const auto ax = p0[0], ay = p0[1]; const auto bx = p1[0] - p0[0], by = p1[1] - p0[1]; const auto cx = p2[0] - p0[0], cy = p2[1] - p0[1]; diff --git a/pyproject.toml b/pyproject.toml index 4e2b6f7..8464011 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,6 @@ [project] name = "torch-delaunay" dynamic = ["version"] -license = {file = "LICENSE"} description = "The Delaunay triangulation for PyTorch" authors = [ @@ -31,7 +30,10 @@ classifiers = [ "Operating System :: MacOS" ] -dependencies = ["shapely>=2.0.0", "torch >= 2.3.0, < 2.4.0"] +dependencies = [ + "torch >= 2.3.0, < 2.6.0; sys_platform == 'darwin' or sys_platform == 'linux'", + "torch >= 2.5.0, < 2.6.0; sys_platform == 'win32'", +] [project.urls] @@ -49,13 +51,18 @@ test = [ ] +[tool.setuptools] +include-package-data = false + [tool.setuptools.dynamic] version = {attr = "torch_delaunay.__version__"} - [tool.setuptools.packages.find] include = ["torch_delaunay*"] +[tool.setuptools.package-data] +torch_delaunay = ["*.cc"] + [build-system] build-backend = "setuptools.build_meta" @@ -66,8 +73,10 @@ requires = [ "numpy >= 1.4.0, < 2.0.0", "pybind11 >= 2.0.0, < 3.0.0", "setuptools ~= 70.0.0", - "torch >= 2.3.0, < 2.4.0; sys_platform == 'linux'", - "torch >= 2.3.0, < 2.4.0; sys_platform == 'darwin' or sys_platform == 'win'", + "torch >= 2.3.0, < 2.4.0; sys_platform == 'darwin' or sys_platform == 'linux'", + # Windows package build requires a fix with library import path, which is available + # only after 2.5.0. + "torch >= 2.5.0, < 2.6.0; sys_platform == 'win32'", "typing-extensions >= 4.8.0", "wheel >= 0.43.0" ] @@ -101,9 +110,10 @@ repair-wheel-command = "" PIP_INDEX_URL = "https://download.pytorch.org/whl/cpu" PIP_EXTRA_INDEX_URL = "https://pypi.python.org/simple" +[tool.cibuildwheel.windows] +archs = ["AMD64"] [tool.cibuildwheel.macos] archs = ["arm64"] - [tool.cibuildwheel.linux] archs = ["aarch64", "x86_64"] manylinux-x86_64-image = "manylinux2014" diff --git a/src/sweephull.cc b/src/sweephull.cc index f6b5cae..6f0f8e4 100644 --- a/src/sweephull.cc +++ b/src/sweephull.cc @@ -258,12 +258,13 @@ struct shull { inline void push_halfedge(int64_t a, int64_t b) { - TORCH_CHECK(a <= halfedges.size(), "shull2d: encountered wrong half-edge: ", a, " -> ", b); + int64_t halfedges_size = static_cast(halfedges.size()); + TORCH_CHECK(a <= halfedges_size, "shull2d: encountered wrong half-edge: ", a, " -> ", b); - if (a < halfedges.size()) { + if (a < halfedges_size) { halfedges[a] = b; } - if (a == halfedges.size()) { + if (a == halfedges_size) { halfedges.push_back(b); } } @@ -399,7 +400,7 @@ shull2d_seed_kernel(const torch::Tensor& points, std::optional eps) // For points p0 and p1, radii of circumscribed circle will be set to `nan`, therefore // at 0 index will be a point with the minimum radius. - std::size_t i = 0; + int64_t i = 0; for (; i < values.size(0); i++) { index2 = indices[i]; p2 = points.index({index2}).view({-1, 2}); diff --git a/torch_delaunay/__init__.py b/torch_delaunay/__init__.py index b814315..bc149ca 100644 --- a/torch_delaunay/__init__.py +++ b/torch_delaunay/__init__.py @@ -1,3 +1,3 @@ from typing import Final -__version__: Final[str] = "1.0.0rc3" +__version__: Final[str] = "1.0.0" diff --git a/torch_delaunay/functional.py b/torch_delaunay/functional.py index e00a1cd..31398d9 100644 --- a/torch_delaunay/functional.py +++ b/torch_delaunay/functional.py @@ -15,9 +15,10 @@ from typing import Optional -import torch_delaunay._C as _C from torch import Tensor +import torch_delaunay._C as _C + def shull2d(points: Tensor, eps: Optional[float] = None) -> Tensor: """Computes Delaunay tessellation for 2-dimensional coordinates.