Skip to content

Commit 9eb5694

Browse files
authored
build: wheels for arm64 Windows (#246)
1 parent ed3d982 commit 9eb5694

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

.github/workflows/wheel.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ jobs:
104104
arch:
105105
- 'x86'
106106
- 'x64'
107+
- 'arm64'
108+
exclude:
109+
- py: '3.8'
110+
arch: 'arm64'
107111
runs-on: 'windows-2022'
108112
env:
109113
ZSTD_WARNINGS_AS_ERRORS: '1'
@@ -112,14 +116,25 @@ jobs:
112116
uses: actions/setup-python@v5
113117
with:
114118
python-version: ${{ matrix.py }}
115-
architecture: ${{ matrix.arch }}
119+
architecture: ${{ matrix.arch == 'arm64' && 'x64' || matrix.arch }}
116120

117121
- uses: actions/checkout@v4
118122

119123
- name: Build Wheel
124+
if: matrix.arch != 'arm64'
120125
run: |
121126
python -m pip wheel -w dist .
122127
128+
- name: Build Wheel
129+
if: matrix.arch == 'arm64'
130+
shell: bash
131+
run: |
132+
python -m pip install cibuildwheel
133+
export CIBW_ARCHS=ARM64
134+
export CIBW_BUILD=cp$(echo ${{ matrix.py }} | tr -d .)-*
135+
export CIBW_BUILD_VERBOSITY=1
136+
cibuildwheel --output-dir dist --arch ARM64
137+
123138
- name: Upload Wheel
124139
uses: actions/upload-artifact@v4
125140
with:

setup.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,27 @@
3434
if sys.version_info[0:2] >= (3, 13):
3535
MINIMUM_CFFI_VERSION = "1.17"
3636

37+
ext_suffix = os.environ.get("SETUPTOOLS_EXT_SUFFIX")
38+
if ext_suffix:
39+
import sysconfig
40+
# setuptools._distutils.command.build_ext doesn't use
41+
# SETUPTOOLS_EXT_SUFFIX like setuptools.command.build_ext does.
42+
# Work around the issue so that cross-compilation can work
43+
# properly.
44+
sysconfig.get_config_vars()["EXT_SUFFIX"] = ext_suffix
45+
try:
46+
# Older versions of python didn't have EXT_SUFFIX, and setuptools
47+
# sets its own value, but since we've already set one, we don't
48+
# want setuptools to overwrite it.
49+
import setuptools._distutils.compat.py39 as py39compat
50+
except ImportError:
51+
try:
52+
import setuptools._distutils.py39compat as py39compat
53+
except ImportError:
54+
pass
55+
if py39compat:
56+
py39compat.add_ext_suffix = lambda vars: None
57+
3758
try:
3859
import cffi
3960

0 commit comments

Comments
 (0)