Skip to content

Commit 20b2018

Browse files
authored
Merge pull request #24 from mworchel/build-system
Use `scikit-build-core` as build system
2 parents 8420a2b + 1d36f6b commit 20b2018

8 files changed

Lines changed: 64 additions & 166 deletions

File tree

.github/workflows/install-and-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ jobs:
1010
build:
1111
strategy:
1212
matrix:
13-
python-version: [3.8, 3.9, '3.10', '3.11', '3.12']
14-
platform: [windows-latest, macos-latest, ubuntu-22.04]
13+
python-version: [3.8, 3.9, '3.10', '3.11', '3.12', '3.13']
14+
platform: [ubuntu-latest, windows-latest, macos-latest, macos-13]
1515

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

.github/workflows/wheels.yml

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@ jobs:
1212
name: Build wheels on ${{ matrix.os }}
1313
runs-on: ${{ matrix.os }}
1414
strategy:
15+
fail-fast: false
1516
matrix:
1617
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
1718

1819
steps:
19-
- uses: actions/checkout@v3
20+
- uses: actions/checkout@v4
2021
with:
2122
submodules: true
2223

@@ -25,31 +26,32 @@ jobs:
2526
with:
2627
output-dir: wheelhouse
2728

29+
- name: Verify clean directory
30+
run: git diff --exit-code
31+
shell: bash
32+
2833
- uses: actions/upload-artifact@v4
2934
with:
30-
path: ./wheelhouse/*.whl
35+
name: cibw-wheels-${{ matrix.os }}
36+
path: wheelhouse/*.whl
3137

3238
build_sdist:
3339
name: Build SDist
3440
runs-on: ubuntu-latest
3541
steps:
36-
- uses: actions/checkout@v3
42+
- uses: actions/checkout@v4
3743
with:
3844
submodules: true
3945

40-
- uses: actions/setup-python@v4
41-
42-
- name: Install deps
43-
run: python -m pip install twine build
44-
4546
- name: Build SDist
46-
run: python -m build -s
47+
run: pipx run build --sdist
4748

4849
- name: Check metadata
49-
run: twine check dist/*
50+
run: pipx run twine check dist/*
5051

5152
- uses: actions/upload-artifact@v4
5253
with:
54+
name: cibw-sdist
5355
path: dist/*.tar.gz
5456

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

6163
steps:
62-
- uses: actions/setup-python@v4
64+
- uses: actions/setup-python@v5
65+
with:
66+
python-version: "3.x"
6367

64-
- uses: actions/download-artifact@v2
68+
- uses: actions/download-artifact@v4
6569
with:
66-
name: artifact
70+
pattern: cibw-*
71+
merge-multiple: true
6772
path: dist
6873

69-
- uses: pypa/gh-action-pypi-publish@v1.4.2
74+
- uses: pypa/gh-action-pypi-publish@release/v1
7075
with:
7176
user: __token__
7277
password: ${{ secrets.PYPI_TOKEN }}

CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
cmake_minimum_required(VERSION 3.12)
1+
cmake_minimum_required(VERSION 3.15...3.27)
22

3-
project(xatlas-python LANGUAGES CXX)
3+
project(xatlas-python LANGUAGES CXX
4+
VERSION ${SKBUILD_PROJECT_VERSION})
45

56
set(CMAKE_CXX_STANDARD 17)
67
set(CMAKE_CXX_STANDARD_REQUIRED true)

extern/pybind11

Submodule pybind11 updated 200 files

pyproject.toml

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
[build-system]
2-
requires = [
3-
"setuptools>=42",
4-
"wheel",
5-
"ninja; sys_platform != 'win32'",
6-
"cmake>=3.12",
7-
]
8-
build-backend = "setuptools.build_meta"
2+
requires = ["scikit-build-core>=0.10"]
3+
build-backend = "scikit_build_core.build"
94

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

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

2418
[project.optional-dependencies]
25-
test = ["trimesh",
19+
test = ["numpy",
2620
"pytest",
27-
"scipy"]
21+
"scipy",
22+
"trimesh"]
23+
24+
[tool.scikit-build]
25+
wheel.expand-macos-universal-tags = true
26+
# Protect the configuration against future changes in scikit-build-core
27+
minimum-version = "build-system.requires"
28+
# Setuptools-style build caching in a local directory
29+
build-dir = "build/{wheel_tag}"
2830

2931
[tool.cibuildwheel]
3032
# Run the package tests on every wheel using `pytest`
3133
test-command = "pytest {package}/tests"
3234
# will install pytest and other packages in the `test` extra
3335
test-extras = ["test"]
34-
# Skip PyPy on Windows as it doesn't appear to have numpy wheels
35-
skip = ["pp*-win*", "*musllinux_i686"]
36+
# Skip testing of PyPy and 32-bit wheels
37+
test-skip = ["pp*", "*win32", "*i686", "*-musllinux*"]
38+
39+
# Needed for full C++17 support
40+
[tool.cibuildwheel.macos.environment]
41+
MACOSX_DEPLOYMENT_TARGET = "10.14"
42+
43+
# Install OpenBLAS on linux (required for scipy in tests)
44+
[tool.cibuildwheel.linux]
45+
before-all = "yum install -y openblas-devel"
3646

37-
[tool.setuptools]
38-
license-files = []
47+
# Skip OpenBLAS installation on untested variants
48+
[[tool.cibuildwheel.overrides]]
49+
select = ["*i686", "*-musllinux*"]
50+
before-all = ""

setup.py

Lines changed: 0 additions & 132 deletions
This file was deleted.

src/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,7 @@ pybind11_add_module(xatlas module.cpp
55

66
target_link_libraries(xatlas PRIVATE xatlas-cpp)
77

8-
target_compile_definitions(xatlas PRIVATE VERSION_INFO=${VERSION_INFO})
8+
target_compile_definitions(xatlas PRIVATE VERSION_INFO=${PROJECT_VERSION})
9+
10+
# The install directory is the output (wheel) directory
11+
install(TARGETS xatlas DESTINATION .)

src/module.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@
4141

4242
namespace py = pybind11;
4343

44+
#define STRINGIFY(x) #x
45+
#define MACRO_STRINGIFY(x) STRINGIFY(x)
46+
4447
auto parametrize(ContiguousArray<float> const& positions,
4548
ContiguousArray<std::uint32_t> const& indices,
4649
std::optional<ContiguousArray<float>> normals = std::nullopt,
@@ -146,4 +149,10 @@ PYBIND11_MODULE(xatlas, m)
146149

147150
// I/O functions
148151
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);
152+
153+
#ifdef VERSION_INFO
154+
m.attr("__version__") = MACRO_STRINGIFY(VERSION_INFO);
155+
#else
156+
m.attr("__version__") = "dev";
157+
#endif
149158
}

0 commit comments

Comments
 (0)