Skip to content

Commit 47bdfaf

Browse files
committed
do not rename dll, start work on windows
1 parent 94cf415 commit 47bdfaf

File tree

4 files changed

+38
-10
lines changed

4 files changed

+38
-10
lines changed

.github/workflows/posix.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,11 @@ jobs:
111111
- name: Build and test wheel
112112
run: |
113113
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
114-
brew install patchelf
115114
source travis-ci/build_wheel.sh
116115
else
117116
libc=${MB_ML_LIBC:-manylinux}
118117
docker_image=quay.io/pypa/${libc}${MB_ML_VER}_${PLAT}
119-
docker run --rm -v $(pwd):/openblas docker_image /bin/bash -xe /openblas/travis-ci/build_wheel.sh
118+
docker run --rm -v $(pwd):/openblas $docker_image /bin/bash -xe /openblas/travis-ci/build_wheel.sh
120119
fi
121120
122121
- uses: actions/upload-artifact@v3

.github/workflows/windows.yml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ jobs:
1717
build:
1818
strategy:
1919
matrix:
20-
BUILD_BITS: [64, 32]
20+
plat: ['x64', 'x86']
2121
INTERFACE64: ['1', '0']
2222
os: [windows-latest]
2323
exclude:
24-
- BUILD_BITS: 32
24+
- plat: x86
2525
INTERFACE64: 1
2626
fail-fast: false
2727
runs-on: ${{ matrix.os }}
@@ -36,18 +36,18 @@ jobs:
3636
- name: Set env variables
3737
run: |
3838
echo "START_DIR=$PWD" >> $env:GITHUB_ENV
39-
$BITS = ${{ matrix.BUILD_BITS }}
40-
echo "BUILD_BITS=$BITS" >> $env:GITHUB_ENV
4139
# For interpretation of MSYSTEM, see:
4240
# https://sourceforge.net/p/msys2/discussion/general/thread/b7dfdac8/#3939
43-
if ($BITS -eq 32) {
41+
if ( ${{ matrix.plat }} -eq x86) {
4442
echo "PLAT=i686" >> $env:GITHUB_ENV
4543
echo "MSYSTEM=MINGW32" >> $env:GITHUB_ENV
4644
echo "LDFLAGS=-static -static-libgcc" >> $env:GITHUB_ENV
45+
echo "BUILD_BITS=32" >> $env:GITHUB_ENV
4746
} else {
4847
echo "PLAT=x86_64" >> $env:GITHUB_ENV
4948
echo "MSYSTEM=UCRT64" >> $env:GITHUB_ENV
5049
echo "LDFLAGS=-lucrt -static -static-libgcc" >> $env:GITHUB_ENV
50+
echo "BUILD_BITS=64" >> $env:GITHUB_ENV
5151
}
5252
if ( ${{ matrix.INTERFACE64 }} -eq 1 ) {
5353
echo "INTERFACE64=1" >> $env:GITHUB_ENV
@@ -70,10 +70,16 @@ jobs:
7070
run: |
7171
cp for_test\test*.exe builds
7272
73-
- name: Set up Python 3.8
73+
- name: Set up Python
7474
uses: actions/setup-python@v4
7575
with:
76-
python-version: 3.8
76+
python-version: 3.7
77+
architecture: ${{ matrix.plat }}
78+
79+
80+
- name: Build wheel
81+
run: |
82+
& $env:BASH_PATH -lc tools/build_wheel_winbash.sh
7783
7884
- uses: actions/upload-artifact@v3
7985
with:

setup.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,17 @@ def get_tag(self):
2828
cmdclass = {}
2929
py_limited_api = {}
3030

31+
library_dir=os.path.join(mydir, 'local', 'openblas', 'lib')
32+
if sys.platform == "win32":
33+
libnames = [x for x in os.listdir(library_dir) if x.endswith(".lib")]
34+
else:
35+
libnames = [x for x in os.listdir(library_dir) if x.startswith("libopenblas")]
3136
setup(
3237
cmdclass=cmdclass,
3338
ext_modules=[Extension(
3439
"openblas._init_openblas", ["src/_init_openblas.c"],
3540
libraries=["openblas_python"],
36-
library_dirs=[os.path.join(mydir, 'local', 'openblas', 'lib'),],
41+
library_dirs=[library_dir],
3742
extra_link_args=["-Wl,-rpath,$ORIGIN/lib"],
3843
define_macros=macros,
3944
**py_limited_api

tools/build_wheel_winbash.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# This will fail if there is more than one file in libs
2+
unzip -d local/openblas libs/openblas*.zip
3+
if [ -d local/openblas/64 ]; then
4+
mv local/openblas/64/* local/openblas
5+
rm -rf local/openblas/64
6+
else
7+
mv local/openblas/32/* local/openblas
8+
rm -rf local/openblas/32
9+
fi
10+
11+
rm local/openblas/lib/*.a
12+
rm local/openblas/lib/*.exp
13+
rm local/openblas/lib/*.def
14+
mv local/openblas/bin/* local/openblas/lib
15+
16+
python3.7 -m pip install wheel auditwheel
17+
python3.7 -m pip wheel -w /tmp/wheelhouse -vv .
18+
auditwheel repair -w dist/ /tmp/wheelhouse/openblas-*.whl

0 commit comments

Comments
 (0)