Skip to content

Commit d7090bf

Browse files
authored
Merge pull request #277 from skirpichev/win-arm
Enable tests and build wheels on windows-11-arm
2 parents 873c776 + a4007f9 commit d7090bf

4 files changed

Lines changed: 79 additions & 30 deletions

File tree

.github/workflows/os.yml

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,23 @@ jobs:
88
matrix:
99
os: [ubuntu-24.04, ubuntu-24.04-arm, macos-15-intel, macos-15]
1010
shell: [bash]
11+
msystem: [ucrt64]
12+
menv: [ucrt-x86_64]
1113
include:
1214
- os: windows-2022
1315
shell: 'msys2 {0}'
16+
msystem: ucrt64
17+
menv: ucrt-x86_64
18+
- os: windows-11-arm
19+
shell: 'msys2 {0}'
20+
msystem: clangarm64
21+
menv: clang-aarch64
1422
defaults:
1523
run:
1624
shell: ${{ matrix.shell }}
1725
env:
1826
PYTEST_ADDOPTS: --verbose --hypothesis-profile=default
19-
CFLAGS: -Wall -Wpedantic -Werror -std=c17 -Wconversion
27+
# CFLAGS: -Wall -Wpedantic -Werror -std=c17 -Wconversion
2028
MACOSX_DEPLOYMENT_TARGET: 10.15 # for 3.14
2129
steps:
2230
- uses: actions/checkout@v6
@@ -28,13 +36,16 @@ jobs:
2836
- uses: msys2/setup-msys2@v2.29.0
2937
with:
3038
install: >-
31-
mingw-w64-ucrt-x86_64-pkg-config
32-
mingw-w64-ucrt-x86_64-gcc
39+
mingw-w64-${{ matrix.menv }}-binutils
40+
mingw-w64-${{ matrix.menv }}-gcc
41+
mingw-w64-${{ matrix.menv }}-pkg-config
42+
mingw-w64-${{ matrix.menv }}-tools
3343
diffutils
3444
m4
3545
make
3646
patch
37-
msystem: ucrt64
47+
autotools
48+
msystem: ${{ matrix.msystem }}
3849
path-type: inherit
3950
if: ${{ startsWith(matrix.os, 'windows') }}
4051
- name: Cache GNU GMP builds
@@ -43,19 +54,15 @@ jobs:
4354
with:
4455
path: .local
4556
key: ${{ matrix.os }}-${{ hashFiles('scripts/*') }}
46-
- run: bash scripts/cibw_before_all.sh
57+
- run: sh scripts/cibw_before_all.sh
4758
if: steps.cache-gmp.outputs.cache-hit != 'true'
48-
- run: python -m pip install --upgrade pip
4959
- run: |
50-
# XXX: this is for M$ Windows, see msys2/setup-msys2#171
51-
PKG_CONFIG_PATH=${PKG_CONFIG_PATH}:$(pwd)/.local/lib/pkgconfig
52-
pip --verbose wheel . -Csetup-args=-Dbuildtype=debug
60+
export PKG_CONFIG_PATH=$(pwd)/.local/lib/pkgconfig
61+
pip --verbose wheel . -Csetup-args=-Dbuildtype=debug -Csetup-args=--vsenv
62+
# https://mesonbuild.com/meson-python/how-to-guides/shared-libraries
5363
- run: |
54-
# XXX: this is too, see
55-
# https://mesonbuild.com/meson-python/how-to-guides/shared-libraries
56-
PATH="$PATH:$(pwd)/.local/bin"
5764
pip install delvewheel
58-
delvewheel repair *.whl
65+
delvewheel repair *.whl --add-path .local/bin
5966
mv wheelhouse/*.whl .
6067
if: ${{ startsWith(matrix.os, 'windows') }}
6168
- run: |

.github/workflows/wheels.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ jobs:
88
matrix:
99
os: [ubuntu-24.04, ubuntu-24.04-arm, macos-15-intel, macos-15,
1010
windows-2022]
11+
msystem: [ucrt64]
12+
menv: [ucrt-x86_64]
13+
include:
14+
- os: windows-11-arm
15+
msystem: clangarm64
16+
menv: clang-aarch64
1117
steps:
1218
- uses: actions/checkout@v6
1319
with:
@@ -16,12 +22,15 @@ jobs:
1622
name: Setup msys2
1723
with:
1824
install: >-
19-
mingw-w64-ucrt-x86_64-gcc
25+
mingw-w64-${{ matrix.menv }}-binutils
26+
mingw-w64-${{ matrix.menv }}-gcc
27+
mingw-w64-${{ matrix.menv }}-tools
2028
diffutils
2129
m4
2230
make
2331
patch
24-
msystem: ucrt64
32+
autotools
33+
msystem: ${{ matrix.msystem }}
2534
if: ${{ startsWith(matrix.os, 'windows') }}
2635
# Install pkgconfig on Windows from choco rather than from msys and
2736
# avoid using the Strawberry one.
@@ -30,7 +39,7 @@ jobs:
3039
# We have to set this here rather than in the cibuildwheel config
3140
# This is probably something to do with \ vs / in paths...
3241
- run: echo "PKG_CONFIG_PATH=${{ github.workspace }}/.local/lib/pkgconfig" >> $env:GITHUB_ENV
33-
if: ${{ startsWith( matrix.os , 'windows' ) }}
42+
if: ${{ startsWith(matrix.os, 'windows') }}
3443
- name: Build wheels
3544
uses: pypa/cibuildwheel@v3.3.0
3645
- uses: actions/upload-artifact@v5

pyproject.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ line-length = 79
6565
select = ["E", "F", "I", "PT", "W", "Q", "SIM"]
6666

6767
[tool.cibuildwheel]
68-
build-frontend = {name="build", args=["--verbose"]}
68+
build-frontend = {name="build", args=["--verbose", "-Csetup-args=--vsenv"]}
6969
enable = "pypy cpython-prerelease cpython-freethreading graalpy"
7070
skip = """*-win32 gp311_242* *-manylinux_i686 *-musllinux_* \
7171
*-manylinux_armv7l pp*aarch64* gp3*win*"""
@@ -86,5 +86,4 @@ repair-wheel-command = """delvewheel repair -w {dest_dir} {wheel} \
8686
--add-path .local/bin"""
8787

8888
[tool.cibuildwheel.windows.environment]
89-
PYTEST_ADDOPTS = "--verbose"
90-
CFLAGS = "-Wall -Wpedantic -Werror -std=c17 -Wconversion"
89+
CFLAGS = ""

scripts/cibw_before_all.sh

Lines changed: 45 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ GMP_DIR=gmp-${GMP_VERSION}
77
GMP_URL=https://ftp.gnu.org/gnu/gmp/${GMP_DIR}.tar.xz
88
PREFIX="$(pwd)/.local/"
99
CFLAGS=
10+
CURL_OPTS="--location --retry 3 --connect-timeout 30"
1011

11-
curl --retry 3 --silent --remote-name ${GMP_URL}
12+
curl ${CURL_OPTS} --remote-name ${GMP_URL}
1213
tar --extract --file ${GMP_DIR}.tar.xz
1314
cd ${GMP_DIR}
1415

@@ -17,18 +18,26 @@ do
1718
patch --strip 1 < $f
1819
done
1920

21+
CONFIG_ARGS="--enable-shared --disable-static --with-pic --disable-alloca --prefix=$PREFIX"
22+
if [ "$OSTYPE" = "cygwin" ]
23+
then
24+
if [ "${RUNNER_ARCH}" = "ARM64" ]
25+
then
26+
autoreconf -fi
27+
CONFIG_ARGS="${CONFIG_ARGS} --disable-assembly"
28+
else
29+
CONFIG_ARGS="${CONFIG_ARGS} --enable-fat"
30+
fi
31+
else
32+
CONFIG_ARGS="${CONFIG_ARGS} --enable-fat"
33+
fi
34+
2035
# config.guess uses microarchitecture and configfsf.guess doesn't
2136
# We replace config.guess with configfsf.guess to avoid microarchitecture
2237
# specific code in common code.
2338
rm config.guess && mv configfsf.guess config.guess && chmod +x config.guess
2439

25-
./configure --enable-fat \
26-
--enable-shared \
27-
--disable-static \
28-
--with-pic \
29-
--disable-alloca \
30-
--prefix=$PREFIX \
31-
--quiet
40+
./configure ${CONFIG_ARGS}
3241

3342
make --silent all install
3443

@@ -38,15 +47,40 @@ ZZ_VERSION=0.6.1
3847
ZZ_DIR=zz-${ZZ_VERSION}
3948
ZZ_URL=https://github.com/diofant/zz/releases/download/v${ZZ_VERSION}/${ZZ_DIR}.tar.gz
4049

41-
curl --location --retry 3 --silent --remote-name ${ZZ_URL}
50+
curl ${CURL_OPTS} --remote-name ${ZZ_URL}
4251
tar --extract --file ${ZZ_DIR}.tar.gz
4352
cd ${ZZ_DIR}
4453

45-
./configure --quiet \
46-
--enable-shared \
54+
if [ "$OSTYPE" = "cygwin" ] && [ "${RUNNER_ARCH}" = "ARM64" ]
55+
then
56+
autoreconf -if
57+
fi
58+
59+
./configure --enable-shared \
4760
--disable-static \
4861
--with-pic \
4962
--with-gmp=$PREFIX \
5063
--prefix=$PREFIX
5164

5265
make --silent all install
66+
67+
cd ../
68+
69+
# -- generate *.lib files from *.dll on M$ Windows --
70+
if [ "$OSTYPE" = "cygwin" ]
71+
then
72+
cd .local/bin
73+
for dll_file in libgmp-10.dll libzz-0.dll
74+
do
75+
lib_name=$(basename -s .dll ${dll_file})
76+
name=$(echo ${lib_name}|sed 's/^lib//;s/-[0-9]\+//')
77+
78+
gendef ${dll_file}
79+
dlltool -d ${lib_name}.def -l ${name}.lib
80+
81+
cp ${name}.lib ../lib/
82+
cp ${dll_file} ../lib/
83+
done
84+
fi
85+
86+
cd ../..

0 commit comments

Comments
 (0)