Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 0 additions & 98 deletions .github/workflows/windows-arm.yml

This file was deleted.

42 changes: 35 additions & 7 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,33 @@ jobs:
build:
strategy:
matrix:
plat: ['x64', 'x86']
INTERFACE64: ['1', '0']
os: [windows-latest]
exclude:
- plat: x86
INTERFACE64: '1'
include:
- { os: windows-latest, PLAT: x86, INTERFACE64: '0'}
- { os: windows-latest, PLAT: x64, INTERFACE64: '0'}
- { os: windows-latest, PLAT: x64, INTERFACE64: '1'}
- { os: windows-11-arm, PLAT: arm64, INTERFACE64: '0'}
- { os: windows-11-arm, PLAT: arm64, INTERFACE64: '1'}
fail-fast: false
runs-on: ${{ matrix.os }}

timeout-minutes: 90
steps:
- uses: actions/checkout@v4.1.1

- name: install-rtools
if: matrix.os == 'windows-latest'
run: |
# rtools 42+ does not support 32 bits builds.
choco install -y rtools --no-progress --force --version=4.0.0.20220206

- name: Download and install LLVM installer
if: matrix.os == 'windows-11-arm'
run: |
Invoke-WebRequest https://github.com/llvm/llvm-project/releases/download/llvmorg-20.1.8/LLVM-20.1.8-woa64.exe -UseBasicParsing -OutFile LLVM-woa64.exe
Start-Process -FilePath ".\LLVM-woa64.exe" -ArgumentList "/S" -Wait
echo "C:\Program Files\LLVM\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append


- name: Set env variables
run: |
echo "START_DIR=$PWD" >> $env:GITHUB_ENV
Expand All @@ -56,6 +66,9 @@ jobs:
echo "LDFLAGS=-lucrt -static -static-libgcc -Wl,--defsym,quadmath_snprintf=snprintf" >> $env:GITHUB_ENV
echo "BUILD_BITS=64" >> $env:GITHUB_ENV
}
if ( "${{ matrix.plat }}" -eq "arm64") {
echo "PLAT=arm64" >> $env:GITHUB_ENV
}
if ( ${{ matrix.INTERFACE64 }} -eq "1" ) {
echo "INTERFACE64=1" >> $env:GITHUB_ENV
}
Expand All @@ -68,9 +81,16 @@ jobs:
echo CIBW_ENVIRONMENT_WINDOWS=$env:CIBW_ENVIRONMENT_WINDOWS

- name: Build
shell: cmd
run: |
if "${{ matrix.plat }}" == "arm64" (
echo Setting up ARM64 Developer Command Prompt
CALL "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsarm64.bat"
if errorlevel 1 exit /b 1
PATH=C:\Program Files\LLVM\bin;%PATH%
)
git submodule update --init --recursive
& $env:BASH_PATH -lc tools/build_steps_windows.sh
%BASH_PATH% -lc tools/build_steps_windows.sh

- name: Test
run: |
Expand Down Expand Up @@ -115,6 +135,7 @@ jobs:
fi
sed -e "s/bin/lib/" -i local/scipy_openblas64/lib/cmake/openblas/OpenBLASConfig.cmake
sed -e "s/dll/lib/" -i local/scipy_openblas64/lib/cmake/openblas/OpenBLASConfig.cmake
mkdir local/scipy_openblas64/lib/pkgconfig
if [[ "${INTERFACE64}" != "1" ]]; then
mv local/scipy_openblas64 local/scipy_openblas32
# rewrite the name of the project to scipy-openblas32
Expand All @@ -125,6 +146,9 @@ jobs:
sed -e "s/cflags =.*/cflags = '-DBLAS_SYMBOL_PREFIX=scipy_'/" -i local/scipy_openblas32/__init__.py
sed -e "s/openblas64/openblas32/" -i local/scipy_openblas32/__init__.py
sed -e "s/openblas64/openblas32/" -i local/scipy_openblas32/__main__.py
PYTHONPATH=$PWD/local python -c "import scipy_openblas32 as s; print(s.get_pkg_config(use_prefix=True))" > local/scipy_openblas32/lib/pkgconfig/scipy-openblas.pc
else
PYTHONPATH=$PWD/local python -c "import scipy_openblas64 as s; print(s.get_pkg_config(use_prefix=True))" > local/scipy_openblas64/lib/pkgconfig/scipy-openblas.pc
fi
echo "" >> LICENSE.txt
echo "----" >> LICENSE.txt
Expand Down Expand Up @@ -153,13 +177,17 @@ jobs:
python -m pip install --no-index --find-links dist scipy_openblas64
python -m scipy_openblas64
python -c "import scipy_openblas64; print(scipy_openblas64.get_pkg_config())"
python -m pip install pkgconf
python -m pkgconf scipy-openblas --cflags

- name: Test 32-bit interface wheel
if: matrix.INTERFACE64 != '1'
run: |
python -m pip install --no-index --find-links dist scipy_openblas32
python -m scipy_openblas32
python -c "import scipy_openblas32; print(scipy_openblas32.get_pkg_config())"
python -m pip install pkgconf
python -m pkgconf scipy-openblas --cflags

- uses: conda-incubator/setup-miniconda@v3.1.1
with:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ First, tarballs are built using `build_lib` in `tools/build_steps.sh` (on
posix in a docker and drectly on macos) or `tools/build_steps_windows.sh` on windows.

Then the shared object and header files from the tarball are used to build the
wheel via `tools/build_wheel.sh`, and the wheels uploaded to
wheel via `tools/build_prepare_wheel.sh` and `pip build wheel`, and the wheels uploaded to
https://anaconda.org/scientific=python-nightly-wheels/scipy_openblas32 and
https://anaconda.org/scientific=python-nightly-wheels/scipy_openblas64 via
`tools/upload_to_anaconda_staging.sh`. For a release, the wheels are uploaded
Expand Down
2 changes: 1 addition & 1 deletion ci-before-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,4 @@ unset -f popd
source build-openblas.sh

# Build wheel
source tools/build_prepare.sh
source tools/build_prepare_wheel.sh
3 changes: 3 additions & 0 deletions ci-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ else
# $PYTHON -m pip install --no-index --find-links /tmp/cibuildwheel/repaired_wheel scipy_openblas64
$PYTHON -m scipy_openblas64
fi

$PYTHON -m pip install pkgconf
$PYTHON -m pkgconf scipy-openblas --cflags
18 changes: 14 additions & 4 deletions local/scipy_openblas64/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,20 @@ def get_library(fullname=False):
# remove the leading lib from libscipy_openblas*
return os.path.splitext(libs[0])[0][3:]

def get_pkg_config(use_preloading=False):
def get_pkg_config(use_preloading=False, use_prefix=False):
"""Return a multi-line string that, when saved to a file, can be used with
pkg-config for build systems like meson

If use_preloading is True then on posix the ``Libs:`` directive will not add
``f"-L{get_library()}" so that at runtime this module must be imported before
the target module

If use_prefix is True, then `pcfiledir` will be used and the file should be
stored in `dirname(__file__)/lib/pkgconfig` for use with pkgconf-pypi
"""
machine = platform.machine().lower()
extralib = ""
if sys.platform == "win32":
machine = platform.machine().lower()
if machine != "arm64":
extralib = "-defaultlib:advapi32 -lgfortran -lquadmath"
libs_flags = f"-L${{libdir}} -l{get_library()}"
Expand All @@ -81,9 +84,16 @@ def get_pkg_config(use_preloading=False):
else:
libs_flags = f"${{libdir}}/{get_library(fullname=True)} -Wl,-rpath,${{libdir}}"
cflags = "-DBLAS_SYMBOL_PREFIX=scipy_ -DBLAS_SYMBOL_SUFFIX=64_ -DHAVE_BLAS_ILP64 -DOPENBLAS_ILP64_NAMING_SCHEME"
if use_prefix:
libdir = "${pcfiledir}/../../lib"
incdir = "${pcfiledir}/../../include"
else:
# Don't use `$prefix` since the file may be located outside the package tree
libdir = get_lib_dir()
incdir = get_include_dir()
return dedent(f"""\
libdir={get_lib_dir()}
includedir={get_include_dir()}
libdir={libdir}
includedir={incdir}
openblas_config= {get_openblas_config()}
version={get_openblas_config().split(" ")[1]}
extralib={extralib}
Expand Down
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "scipy-openblas64"
# v0.3.30-359-g29fab2b9
version = "0.3.30.359.1"
version = "0.3.30.359.2"
requires-python = ">=3.7"
description = "Provides OpenBLAS for python packaging"
readme = "README.md"
Expand Down Expand Up @@ -57,3 +57,6 @@ environment-pass = [
]
[tool.cibuildwheel.linux]
environment = { CC = "/opt/clang/bin/clang", CXX = "/opt/clang/bin/clang++", LDFLAGS = "-fuse-ld=lld" }

[project.entry-points.pkg_config]
scipy-openblas = 'scipy_openblas64.lib.pkgconfig'
10 changes: 9 additions & 1 deletion tools/build_prepare.sh → tools/build_prepare_wheel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ PYTHON=${PYTHON:-python3.9}

mkdir -p local/openblas
mkdir -p dist
$PYTHON -m pip install wheel auditwheel

tar -C local/scipy_openblas64 --strip-components=2 -xf libs/openblas.tar.gz

Expand Down Expand Up @@ -40,6 +39,7 @@ if [ $(uname) == "Darwin" ]; then
fi

rm -rf local/scipy_openblas64/lib/pkgconfig
mkdir local/scipy_openblas64/lib/pkgconfig
echo "" >> LICENSE.txt
echo "----" >> LICENSE.txt
echo "" >> LICENSE.txt
Expand All @@ -49,6 +49,11 @@ else
cat tools/LICENSE_linux.txt >> LICENSE.txt
fi

if [ "$(uname)" == "Darwin" -a "${PLAT}" == "x86_64" ]; then
PYTHON="arch -x86_64 python3"
else
PYTHON=python3
fi
if [ "${INTERFACE64}" != "1" ]; then
# rewrite the name of the project to scipy-openblas32
# this is a hack, but apparently there is no other way to change the name
Expand All @@ -63,6 +68,9 @@ if [ "${INTERFACE64}" != "1" ]; then
sed -e "s/openblas64/openblas32/" -i.bak local/scipy_openblas32/__main__.py
sed -e "s/openblas64/openblas32/" -i.bak local/scipy_openblas32/__init__.py
rm local/scipy_openblas32/*.bak
PYTHONPATH=$PWD/local $PYTHON -c "import scipy_openblas32 as s; print(s.get_pkg_config(use_prefix=True))" > local/scipy_openblas32/lib/pkgconfig/scipy-openblas.pc
else
PYTHONPATH=$PWD/local $PYTHON -c "import scipy_openblas64 as s; print(s.get_pkg_config(use_prefix=True))" > local/scipy_openblas64/lib/pkgconfig/scipy-openblas.pc
fi

rm -rf dist/*
Expand Down
Loading
Loading