Skip to content

Use scikit-build-core as build system #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/install-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ jobs:
build:
strategy:
matrix:
python-version: [3.8, 3.9, '3.10', '3.11', '3.12']
platform: [windows-latest, macos-latest, ubuntu-22.04]
python-version: [3.8, 3.9, '3.10', '3.11', '3.12', '3.13']
platform: [ubuntu-latest, windows-latest, macos-latest, macos-13]

runs-on: ${{ matrix.platform }}

Expand Down
33 changes: 19 additions & 14 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ jobs:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true

Expand All @@ -25,31 +26,32 @@ jobs:
with:
output-dir: wheelhouse

- name: Verify clean directory
run: git diff --exit-code
shell: bash

- uses: actions/upload-artifact@v4
with:
path: ./wheelhouse/*.whl
name: cibw-wheels-${{ matrix.os }}
path: wheelhouse/*.whl

build_sdist:
name: Build SDist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true

- uses: actions/setup-python@v4

- name: Install deps
run: python -m pip install twine build

- name: Build SDist
run: python -m build -s
run: pipx run build --sdist

- name: Check metadata
run: twine check dist/*
run: pipx run twine check dist/*

- uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz

upload_all:
Expand All @@ -59,14 +61,17 @@ jobs:
if: github.event_name == 'release' && github.event.action == 'published'

steps:
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: "3.x"

- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v4
with:
name: artifact
pattern: cibw-*
merge-multiple: true
path: dist

- uses: pypa/gh-action-pypi-publish@v1.4.2
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
cmake_minimum_required(VERSION 3.12)
cmake_minimum_required(VERSION 3.15...3.27)

project(xatlas-python LANGUAGES CXX)
project(xatlas-python LANGUAGES CXX
VERSION ${SKBUILD_PROJECT_VERSION})

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED true)
Expand Down
2 changes: 1 addition & 1 deletion extern/pybind11
Submodule pybind11 updated 200 files
40 changes: 26 additions & 14 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
[build-system]
requires = [
"setuptools>=42",
"wheel",
"ninja; sys_platform != 'win32'",
"cmake>=3.12",
]
build-backend = "setuptools.build_meta"
requires = ["scikit-build-core>=0.10"]
build-backend = "scikit_build_core.build"

[project]
name = "xatlas"
Expand All @@ -15,24 +10,41 @@ authors = [{name = "Markus Worchel", email = "m.worchel@campus.tu-berlin.de"}]
license = {file = "LICENSE"}
description = "Python bindings for xatlas"
urls = {Homepage = "https://github.com/mworchel/xatlas-python"}
dependencies = ["numpy"]

[project.readme]
file = "README.md"
content-type = "text/markdown"

[project.optional-dependencies]
test = ["trimesh",
test = ["numpy",
"pytest",
"scipy"]
"scipy",
"trimesh"]

[tool.scikit-build]
wheel.expand-macos-universal-tags = true
# Protect the configuration against future changes in scikit-build-core
minimum-version = "build-system.requires"
# Setuptools-style build caching in a local directory
build-dir = "build/{wheel_tag}"

[tool.cibuildwheel]
# Run the package tests on every wheel using `pytest`
test-command = "pytest {package}/tests"
# will install pytest and other packages in the `test` extra
test-extras = ["test"]
# Skip PyPy on Windows as it doesn't appear to have numpy wheels
skip = ["pp*-win*", "*musllinux_i686"]
# Skip testing of PyPy and 32-bit wheels
test-skip = ["pp*", "*win32", "*i686", "*-musllinux*"]

# Needed for full C++17 support
[tool.cibuildwheel.macos.environment]
MACOSX_DEPLOYMENT_TARGET = "10.14"

# Install OpenBLAS on linux (required for scipy in tests)
[tool.cibuildwheel.linux]
before-all = "yum install -y openblas-devel"

[tool.setuptools]
license-files = []
# Skip OpenBLAS installation on untested variants
[[tool.cibuildwheel.overrides]]
select = ["*i686", "*-musllinux*"]
before-all = ""
132 changes: 0 additions & 132 deletions setup.py

This file was deleted.

5 changes: 4 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@ pybind11_add_module(xatlas module.cpp

target_link_libraries(xatlas PRIVATE xatlas-cpp)

target_compile_definitions(xatlas PRIVATE VERSION_INFO=${VERSION_INFO})
target_compile_definitions(xatlas PRIVATE VERSION_INFO=${PROJECT_VERSION})

# The install directory is the output (wheel) directory
install(TARGETS xatlas DESTINATION .)
9 changes: 9 additions & 0 deletions src/module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@

namespace py = pybind11;

#define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(x)

auto parametrize(ContiguousArray<float> const& positions,
ContiguousArray<std::uint32_t> const& indices,
std::optional<ContiguousArray<float>> normals = std::nullopt,
Expand Down Expand Up @@ -146,4 +149,10 @@ PYBIND11_MODULE(xatlas, m)

// I/O functions
m.def("export", &exportObj, py::arg("path"), py::arg("positions"), py::arg("indices") = std::nullopt, py::arg("uvs") = std::nullopt, py::arg("normals") = std::nullopt);

#ifdef VERSION_INFO
m.attr("__version__") = MACRO_STRINGIFY(VERSION_INFO);
#else
m.attr("__version__") = "dev";
#endif
}
Loading