Skip to content

Commit e57ee2f

Browse files
committed
add support for macos arm targets
1 parent 107de3e commit e57ee2f

File tree

4 files changed

+27
-5
lines changed

4 files changed

+27
-5
lines changed

.github/workflows/wheels.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,13 @@ jobs:
1919
include:
2020
- os_name: linux
2121
runner: ubuntu-latest
22-
- os_name: macos
22+
rust_target: x86_64-unknown-linux-gnu
23+
- os_name: macos-intel
2324
runner: macos-15-intel
25+
rust_target: x86_64-apple-darwin
26+
- os_name: macos-arm64
27+
runner: macos-15
28+
rust_target: aarch64-apple-darwin
2429

2530
steps:
2631
- name: Check out repository
@@ -45,7 +50,7 @@ jobs:
4550
uses: Swatinem/rust-cache@v2
4651

4752
- name: Build wheels
48-
run: scripts/build-wheels.sh --out dist
53+
run: scripts/build-wheels.sh --out dist --target "${{ matrix.rust_target }}"
4954

5055
- name: Upload wheel artifacts
5156
uses: actions/upload-artifact@v4

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "maturin"
44

55
[project]
66
name = "rsloop"
7-
version = "0.1.1"
7+
version = "0.1.2"
88
description = "An event loop for asyncio written in Rust"
99
readme = "README.md"
1010
license = { file = "LICENSE" }

scripts/build-wheels.sh

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,24 @@ usage() {
1010
Build release wheels for rsloop with uv-managed Python interpreters.
1111
1212
Usage:
13-
scripts/build-wheels.sh [--out DIR] [--skip-python-install] [-- maturin args...]
13+
scripts/build-wheels.sh [--out DIR] [--target TRIPLE] [--skip-python-install] [-- maturin args...]
1414
1515
Options:
1616
-o, --out DIR Output directory for built wheels (default: dist/wheels)
17+
-t, --target TRIPLE Rust compilation target to pass to maturin
1718
--skip-python-install
1819
Reuse installed interpreters instead of running `uv python install`
1920
-h, --help Show this help
2021
2122
Environment:
2223
RSLOOP_PYTHON_VERSIONS Space-separated version list to override the defaults
2324
(default: 3.8 3.9 3.10 3.11 3.12 3.13 3.14 3.14t)
25+
RSLOOP_RUST_TARGET Rust compilation target to pass to maturin
2426
2527
Examples:
2628
scripts/build-wheels.sh
2729
scripts/build-wheels.sh --out wheelhouse
30+
scripts/build-wheels.sh --target aarch64-apple-darwin
2831
RSLOOP_PYTHON_VERSIONS="3.12 3.13 3.14t" scripts/build-wheels.sh -- --features profiler
2932
EOF
3033
}
@@ -40,6 +43,7 @@ resolve_path() {
4043

4144
OUTPUT_DIR="$DEFAULT_OUTPUT_DIR"
4245
INSTALL_PYTHONS=1
46+
RUST_TARGET="${RSLOOP_RUST_TARGET:-}"
4347
MATURIN_ARGS=()
4448

4549
while (($#)); do
@@ -52,6 +56,14 @@ while (($#)); do
5256
OUTPUT_DIR="$2"
5357
shift 2
5458
;;
59+
-t|--target)
60+
if (($# < 2)); then
61+
echo "missing value for $1" >&2
62+
exit 1
63+
fi
64+
RUST_TARGET="$2"
65+
shift 2
66+
;;
5567
--skip-python-install)
5668
INSTALL_PYTHONS=0
5769
shift
@@ -102,6 +114,11 @@ for version in "${PYTHON_VERSIONS[@]}"; do
102114
--interpreter "$interpreter"
103115
--out "$OUTPUT_DIR"
104116
)
117+
if [[ -n "$RUST_TARGET" ]]; then
118+
maturin_cmd+=(
119+
--target "$RUST_TARGET"
120+
)
121+
fi
105122
if ((${#MATURIN_ARGS[@]})); then
106123
maturin_cmd+=("${MATURIN_ARGS[@]}")
107124
fi

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)