diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index c9e3ed7..d755dc1 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -22,34 +22,16 @@ jobs: with: python-version: "3.11" - - name: Install dependencies (macOS) - if: runner.os == 'macOS' - run: | - brew install uv + - name: Install cibuildwheel and build dependencies + run: | + python -m pip install --upgrade pip + # Install these on the host so cibuildwheel can resolve the paths + python -m pip install cibuildwheel scipy-openblas delvewheel - - name: Cache vcpkg - if: runner.os == 'Windows' - uses: actions/cache@v4 - with: - path: C:\\vcpkg\\installed - key: vcpkg-openblas-${{ runner.os }} - - - name: Install cibuildwheel - run: python -m pip install --upgrade pip cibuildwheel + - name: Build wheels + run: python -m cibuildwheel --output-dir wheelhouse - name: Build wheels - env: - CIBW_ENVIRONMENT_MACOS: EASYSBA_USE_ACCELERATE=1 EASYSBA_LAPACK_LIBS= - # Use the pre-installed vcpkg location for speed and reliability - CIBW_BEFORE_ALL_WINDOWS: >- - vcpkg install openblas:x64-windows - - CIBW_ENVIRONMENT_WINDOWS: >- - EASYSBA_LAPACK_LIBS="libopenblas" - EASYSBA_INCLUDE_DIRS="C:/vcpkg/installed/x64-windows/include" - EASYSBA_LIBRARY_DIRS="C:/vcpkg/installed/x64-windows/lib" - INCLUDE="C:/vcpkg/installed/x64-windows/include;$INCLUDE" - LIB="C:/vcpkg/installed/x64-windows/lib;$LIB" run: python -m cibuildwheel --output-dir wheelhouse - name: Upload wheels diff --git a/pyproject.toml b/pyproject.toml index a6b1a04..f87603b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,6 +14,8 @@ dependencies = ["numpy>=1.20"] build-frontend = "build" skip = "*-musllinux* *-win32" test-skip = "*" + +# Default environment for Linux environment = { EASYSBA_LAPACK_LIBS = "openblas" } [tool.cibuildwheel.linux] @@ -22,14 +24,17 @@ before-all = "yum -y install openblas-devel lapack-devel" [tool.cibuildwheel.macos] environment = { EASYSBA_USE_ACCELERATE = "1", EASYSBA_LAPACK_LIBS = "" } -# [tool.cibuildwheel.windows] -# environment = { EASYSBA_LAPACK_LIBS = "openblas" } - [tool.cibuildwheel.windows] -# Install delvewheel to bundle the DLL into the wheel -before-build = "pip install delvewheel" -repair-wheel-command = "delvewheel repair --add-path C:\\vcpkg\\installed\\x64-windows\\bin -w {dest_dir} {wheel}" +# We already installed these on the host, but we install them in the +# build venv as well to be safe for the repair step. +before-build = "pip install scipy-openblas delvewheel" [tool.cibuildwheel.windows.environment] -# Match the filename vcpkg actually produces: libopenblas -EASYSBA_LAPACK_LIBS = "libopenblas" +EASYSBA_LAPACK_LIBS = "openblas" +# These $(...) commands will now work because scipy-openblas is on the host +INCLUDE = "$(python -c \"import scipy_openblas; print(scipy_openblas.get_include_dir())\");$INCLUDE" +LIB = "$(python -c \"import scipy_openblas; print(scipy_openblas.get_lib_dir())\");$LIB" + +[tool.cibuildwheel.windows.repair-wheel-command] +# Use the repair-wheel-command to bundle the DLL +repair-wheel-command = "python -c \"import scipy_openblas, subprocess, sys; subprocess.check_call(['delvewheel', 'repair', '--add-path', scipy_openblas.get_lib_dir(), '-w', sys.argv[1], sys.argv[2]])\" {dest_dir} {wheel}"