Skip to content

Commit 6b1c886

Browse files
committed
feat: add support for automatically building win arm wheels
1 parent 0eb24d2 commit 6b1c886

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

Diff for: .github/workflows/wheel.yml

+3
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ jobs:
4545
cmake --build ${{github.workspace}}/build_win32 --config Release --target install --parallel 8
4646
cmake -A x64 -B ${{github.workspace}}/build_amd64 -DSPM_ENABLE_SHARED=OFF -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/build/root_amd64
4747
cmake --build ${{github.workspace}}/build_amd64 --config Release --target install --parallel 8
48+
cmake -A arm64 -B ${{github.workspace}}/build_arm64 -DSPM_ENABLE_SHARED=OFF -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/build/root_arm64
49+
cmake --build ${{github.workspace}}/build_arm64 --config Release --target install --parallel 8
4850
4951
- name: Build for Mac
5052
if: runner.os == 'macOS'
@@ -66,6 +68,7 @@ jobs:
6668
env:
6769
CIBW_ARCHS_LINUX: auto aarch64
6870
CIBW_ARCHS_MACOS: x86_64 universal2 arm64
71+
CIBW_ARCHS_WINDOWS: auto ARM64
6972
CIBW_SKIP: "pp* *-musllinux_*"
7073
CIBW_BUILD_VERBOSITY: 1
7174

Diff for: python/setup.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,21 @@ def build_extension(self, ext):
104104
_build_ext.build_extension(self, ext)
105105

106106

107-
if os.name == 'nt':
108-
# Must pre-install sentencepice into build directory.
107+
def get_win_arch():
109108
arch = 'win32'
110109
if sys.maxsize > 2**32:
111110
arch = 'amd64'
112111
if 'arm' in platform.machine().lower():
113112
arch = 'arm64'
113+
if os.getenv('PYTHON_ARCH', '') == 'ARM64':
114+
# Special check for arm64 under ciwheelbuild, see https://github.com/pypa/cibuildwheel/issues/1942
115+
arch = 'arm64'
116+
return arch
117+
118+
119+
if os.name == 'nt':
120+
# Must pre-install sentencepice into build directory.
121+
arch = get_win_arch()
114122
if os.path.exists('..\\build\\root_{}\\lib'.format(arch)):
115123
cflags = ['/std:c++17', '/I..\\build\\root_{}\\include'.format(arch)]
116124
libs = [

0 commit comments

Comments
 (0)