Skip to content

Commit 7cf10b9

Browse files
committed
maint: build wheels for macos arm64 in Cirrus CI
1 parent e08d3df commit 7cf10b9

File tree

5 files changed

+67
-1
lines changed

5 files changed

+67
-1
lines changed

.cirrus.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#########################################################
2+
# Build arm64 wheels for OSX on Cirrus CI
3+
#########################################################
4+
5+
cirrus_wheels_macos_arm64_task:
6+
name: Build macOS arm64 wheels.
7+
macos_instance:
8+
image: ghcr.io/cirruslabs/macos-monterey-xcode:13.3.1
9+
env:
10+
PATH: /opt/homebrew/opt/[email protected]/bin:$PATH
11+
CIBW_ARCHS_MACOS: arm64
12+
install_pre_requirements_script:
13+
- brew install [email protected]
14+
- ln -s python3 /opt/homebrew/opt/[email protected]/bin/python
15+
- which python
16+
- python --version
17+
install_cibuildwheel_script:
18+
- python -m pip install cibuildwheel==2.11.4
19+
run_cibuildwheel_script:
20+
- bin/cibw.sh
21+
wheels_artifacts:
22+
path: "wheelhouse/*"

.github/workflows/buildwheel.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
4141
CIBW_MANYLINUX_I686_IMAGE: manylinux2014
4242
CIBW_BEFORE_ALL_LINUX: bin/cibw_before_all_linux.sh
43-
CIBW_BEFORE_ALL_MACOS: bin/cibw_before_all_macosx.sh
43+
CIBW_BEFORE_ALL_MACOS: bin/cibw_before_all_macosx_x86_64.sh
4444
CIBW_BEFORE_ALL_WINDOWS: msys2 -c bin/cibw_before_all_windows.sh
4545
CIBW_BEFORE_BUILD_WINDOWS: msys2 -c bin/cibw_before_build_windows.sh
4646
CIBW_BEFORE_BUILD: pip install numpy cython delvewheel

bin/cibw.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/usr/bin/env bash
2+
#
3+
# This script can be used to test cibuildwheel locally on OSX/Linux
4+
#
5+
# It is also worth commenting out the BEFORE_ALL line to build GMP etc after you have
6+
# built those once because that is by far the slowest step.
7+
#
8+
9+
rm -f wheelhouse/*
10+
11+
# bin/build_dependencies_unix.sh places headers and shared libraries under .local
12+
export CIBW_ENVIRONMENT='C_INCLUDE_PATH=$(pwd)/.local/include/ LIBRARY_PATH=$(pwd)/.local/lib/ LD_LIBRARY_PATH=$(pwd)/.local/lib:$LD_LIBRARY_PATH PYTHON_FLINT_MINGW64=true'
13+
14+
export CIBW_BUILD='cp39-* cp310-* cp311-*'
15+
# export CIBW_BUILD='cp311-*'
16+
export CIBW_SKIP='*-win32 *-manylinux_i686 *-musllinux_*'
17+
18+
# export CIBW_ARCHS_MACOS="x86_64"
19+
export CIBW_ARCHS_MACOS="arm64"
20+
21+
export CIBW_BEFORE_ALL_LINUX=bin/cibw_before_all_linux.sh
22+
# export CIBW_BEFORE_ALL_MACOS=bin/cibw_before_all_macosx_x86_64.sh
23+
export CIBW_BEFORE_ALL_MACOS=bin/cibw_before_all_macosx_arm64.sh
24+
export CIBW_BEFORE_ALL_WINDOWS='C:\\msys64\\usr\\bin\\bash bin/cibw_before_all_windows.sh'
25+
26+
export CIBW_BEFORE_BUILD='pip install numpy cython delvewheel'
27+
export CIBW_BEFORE_BUILD_WINDOWS='C:\\msys64\\usr\\bin\\bash bin/cibw_before_build_windows.sh'
28+
29+
export CIBW_REPAIR_WHEEL_COMMAND_WINDOWS='bin\cibw_repair_wheel_command_windows.bat {dest_dir} {wheel}'
30+
31+
# export CIBW_TEST_COMMAND="python -c 'import flint; print(str(flint.fmpz(2)))'"
32+
export CIBW_TEST_COMMAND="python {project}/test/test.py && python {project}/test/dtest.py"
33+
34+
# cibuildwheel --platform linux
35+
# cibuildwheel --platform windows
36+
cibuildwheel --platform macos
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
3+
export CPPFLAGS=" --target=arm64-apple-macos11"
4+
export LDFLAGS=" -arch arm64"
5+
6+
bin/build_dependencies_unix.sh\
7+
--gmp gmp\
8+
--host aarch64-apple-darwin
File renamed without changes.

0 commit comments

Comments
 (0)