Skip to content

Commit d4555f1

Browse files
rgommerscharris
authored andcommitted
BLD: build wheels for 32-bit Python on Windows, using MSVC [wheel build]
This doesn't include OpenBLAS, I haven't tried that - too much effort right now and it doesn't seem critical. Easier to revisit once OpenBLAS is more easily installable as a wheel. xref numpygh-23717 [skip circle] [skip cirrus] [skip azp]
1 parent 2fd8384 commit d4555f1

File tree

4 files changed

+18
-9
lines changed

4 files changed

+18
-9
lines changed

.github/workflows/wheels.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ jobs:
7878
- [ubuntu-20.04, musllinux_x86_64]
7979
- [macos-12, macosx_x86_64]
8080
- [windows-2019, win_amd64]
81+
- [windows-2019, win32]
8182
python: ["cp39", "cp310", "cp311", "cp312", "pp39"]
8283
exclude:
8384
# Don't build PyPy 32-bit windows
@@ -100,6 +101,12 @@ jobs:
100101
# https://github.com/actions/checkout/issues/338
101102
fetch-depth: 0
102103

104+
- name: Setup MSVC (32-bit)
105+
if: ${{ matrix.buildplat[1] == 'win32' }}
106+
uses: bus1/cabuild/action/msdevshell@e22aba57d6e74891d059d66501b6b5aed8123c4d # v1
107+
with:
108+
architecture: 'x86'
109+
103110
- name: pkg-config-for-win
104111
run: |
105112
choco install -y --checksum 6004DF17818F5A6DBF19CB335CC92702 pkgconfiglite

pyproject.toml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ tracker = "https://github.com/numpy/numpy/issues"
149149
# Note: the below skip command doesn't do much currently, the platforms to
150150
# build wheels for in CI are controlled in `.github/workflows/wheels.yml` and
151151
# `tools/ci/cirrus_wheels.yml`.
152-
skip = "cp36-* cp37-* cp-38* pp37-* pp38-* *-manylinux_i686 *_ppc64le *_s390x *-musllinux_aarch64 *-win32"
152+
skip = "cp36-* cp37-* cp-38* pp37-* pp38-* *-manylinux_i686 *_ppc64le *_s390x *-musllinux_aarch64"
153153
build-verbosity = "3"
154154
before-build = "bash {project}/tools/wheels/cibw_before_build.sh {project}"
155155
# meson has a hard dependency on ninja, and we need meson to build
@@ -178,17 +178,15 @@ test-skip = "*_universal2:arm64"
178178
environment = {CFLAGS="-fno-strict-aliasing -DBLAS_SYMBOL_SUFFIX=64_ -DHAVE_BLAS_ILP64", CXXFLAGS="-DBLAS_SYMBOL_SUFFIX=64_ -DHAVE_BLAS_ILP64", NPY_USE_BLAS_ILP64="1", CC="clang", CXX = "clang++", RUNNER_OS="macOS"}
179179

180180
[tool.cibuildwheel.windows]
181-
archs = ['AMD64']
182181
environment = {NPY_USE_BLAS_ILP64="1", CFLAGS="-DBLAS_SYMBOL_SUFFIX=64_ -DHAVE_BLAS_ILP64", CXXFLAGS="-DBLAS_SYMBOL_SUFFIX=64_ -DHAVE_BLAS_ILP64", LDFLAGS="", PKG_CONFIG_PATH="C:/opt/64/lib/pkgconfig"}
183182
config-settings = "setup-args=--vsenv"
184183
repair-wheel-command = "bash ./tools/wheels/repair_windows.sh {wheel} {dest_dir}"
185184

186-
#[[tool.cibuildwheel.overrides]]
187-
# Note: 32-bit Python wheel builds are skipped right now; probably needs
188-
# --native-file to build due to `arch != pyarch` check in Meson's `python` dependency
189-
# Note: uses 32-bit rather than 64-bit OpenBLAS
190-
#select = "*-win32"
191-
#environment = CFLAGS="-m32", LDFLAGS="-m32", PKG_CONFIG_PATH="/opt/32/lib/pkgconfig"}
185+
[[tool.cibuildwheel.overrides]]
186+
select = "*-win32"
187+
environment = {PKG_CONFIG_PATH="/opt/32/lib/pkgconfig"}
188+
config-settings = "setup-args=--vsenv setup-args=-Dallow-noblas=true"
189+
repair-wheel-command = ""
192190

193191
[tool.spin]
194192
package = 'numpy'

tools/wheels/cibw_test_command.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ if [[ $RUNNER_OS == "macOS" && $RUNNER_ARCH == "X64" ]]; then
1818
# Needed so gfortran (not clang) can find system libraries like libm (-lm)
1919
# in f2py tests
2020
export LIBRARY_PATH="$LIBRARY_PATH:/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib"
21+
elif [[ $RUNNER_OS == "Windows" && $IS_32_BIT == true ]] ; then
22+
echo "Skip OpenBLAS version check for 32-bit Windows, no OpenBLAS used"
23+
# Avoid this in GHA: "ERROR: Found GNU link.exe instead of MSVC link.exe"
24+
rm /c/Program\ Files/Git/usr/bin/link.EXE
2125
else
2226
# For some reason the macos-x86_64 runner does not work with threadpoolctl
2327
# Skip this check there

tools/wheels/repair_windows.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pushd numpy*
1717
# building with mingw.
1818
# We therefore find each PYD in the directory structure and strip them.
1919

20-
for f in $(find ./scipy* -name '*.pyd'); do strip $f; done
20+
for f in $(find ./numpy* -name '*.pyd'); do strip $f; done
2121

2222

2323
# now repack the wheel and overwrite the original

0 commit comments

Comments
 (0)