Skip to content

Commit 2b1dbff

Browse files
committed
BLD: build wheels for 32-bit Python on Windows, using MSVC
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 6cab441 commit 2b1dbff

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
@@ -76,6 +76,7 @@ jobs:
7676
- [ubuntu-20.04, musllinux_x86_64]
7777
- [macos-12, macosx_x86_64]
7878
- [windows-2019, win_amd64]
79+
- [windows-2019, win32]
7980
python: ["cp39", "cp310", "cp311", "cp312"] # "pp39"
8081
exclude:
8182
# Don't build PyPy 32-bit windows
@@ -98,6 +99,12 @@ jobs:
9899
# https://github.com/actions/checkout/issues/338
99100
fetch-depth: 0
100101

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

pyproject.toml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ tracker = "https://github.com/numpy/numpy/issues"
150150
# Note: the below skip command doesn't do much currently, the platforms to
151151
# build wheels for in CI are controlled in `.github/workflows/wheels.yml` and
152152
# `tools/ci/cirrus_wheels.yml`.
153-
skip = "cp36-* cp37-* cp-38* pp37-* *-manylinux_i686 *_ppc64le *_s390x *-musllinux_aarch64 *-win32"
153+
skip = "cp36-* cp37-* cp-38* pp37-* *-manylinux_i686 *_ppc64le *_s390x *-musllinux_aarch64"
154154
build-verbosity = "3"
155155
before-build = "bash {project}/tools/wheels/cibw_before_build.sh {project}"
156156
# meson has a hard dependency on ninja, and we need meson to build
@@ -179,17 +179,15 @@ test-skip = "*_universal2:arm64"
179179
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"}
180180

181181
[tool.cibuildwheel.windows]
182-
archs = ['AMD64']
183182
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"}
184183
config-settings = "setup-args=--vsenv"
185184
repair-wheel-command = "bash ./tools/wheels/repair_windows.sh {wheel} {dest_dir}"
186185

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

194192
[tool.spin]
195193
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 [ IS_32_BIT ] ; 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)