diff options
-rw-r--r-- | .github/workflows/wheels.yml | 26 | ||||
-rw-r--r-- | tools/wheels/cibw_before_build.sh | 5 |
2 files changed, 19 insertions, 12 deletions
diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 006bcc239..afebe7f93 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -50,10 +50,11 @@ jobs: matrix: # Github Actions doesn't support pairing matrix values together, let's improvise # https://github.com/github/feedback/discussions/7835#discussioncomment-1769026 - buildplat: + buildplat: - [ubuntu-20.04, manylinux_x86_64] - [macos-10.15, macosx_*] - [windows-2019, win_amd64] + - [windows-2019, win32] python: ["cp38", "cp39", "cp310"] include: # manylinux pypy builds @@ -63,13 +64,14 @@ jobs: # MacOS PyPy builds # Disabled for now because of a PyPy bug # that prevents successful compilation - #- buildplat: [macos-10.15, macosx_x86_64] + #- buildplat: [macos-10.15, macosx_x86_64] # python: "pp38" # Windows PyPy builds - buildplat: [windows-2019, win_amd64] python: "pp38" - + env: + IS_32_BIT: ${{ matrix.buildplat[1] == 'win32' }} steps: - name: Checkout numpy uses: actions/checkout@v2 @@ -80,11 +82,18 @@ jobs: # A shallow clone can work when the following issue is resolved: # https://github.com/actions/checkout/issues/338 fetch-depth: 0 - + - name: Configure mingw for 32-bit builds + run: | + # Force 32-bit mingw + choco uninstall mingw + choco install -y mingw --forcex86 --force --version=7.3.0 + echo "C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw32\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + refreshenv + if: ${{ env.IS_32_BIT == 'true' }} - name: Build wheels uses: pypa/cibuildwheel@v2.3.0 env: - NPY_USE_BLAS_ILP64: 1 + NPY_USE_BLAS_ILP64: ${{ env.IS_32_BIT == 'true' && '0' || '1' }} CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }} CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 CIBW_ENVIRONMENT_LINUX: CFLAGS='-std=c99 -fno-strict-aliasing' @@ -96,6 +105,10 @@ jobs: OPENBLAS64_=/usr/local CC=clang CXX=clang++ + CIBW_ENVIRONMENT_WINDOWS: OPENBLAS64_=${{ env.IS_32_BIT == 'false' && 'openblas' || '' }} + OPENBLAS=${{ env.IS_32_BIT == 'true' && 'openblas' || '' }} + CFLAGS='${{ env.IS_32_BIT == 'true' && '-m32' || '' }}' + LDFLAGS='${{ env.IS_32_BIT == 'true' && '-m32' || '' }}' # TODO: Add universal2 wheels, we need to fuse them manually # instead of going through cibuildwheel # This is because cibuildwheel tries to make a fat wheel @@ -103,9 +116,6 @@ jobs: # for more info CIBW_ARCHS_MACOS: x86_64 arm64 CIBW_TEST_SKIP: "*_arm64 *_universal2:arm64" - # Hardcode for now,blas stuff needs changes for 32-bit - CIBW_ENVIRONMENT_WINDOWS: NPY_USE_BLAS_ILP64=1 - OPENBLAS64_=openblas CIBW_BUILD_VERBOSITY: 3 CIBW_BEFORE_BUILD: bash {project}/tools/wheels/cibw_before_build.sh {project} CIBW_BEFORE_TEST: pip install -r {project}/test_requirements.txt diff --git a/tools/wheels/cibw_before_build.sh b/tools/wheels/cibw_before_build.sh index d77a52731..5cf7d8088 100644 --- a/tools/wheels/cibw_before_build.sh +++ b/tools/wheels/cibw_before_build.sh @@ -17,8 +17,6 @@ if [[ $RUNNER_OS == "Linux" || $RUNNER_OS == "macOS" ]] ; then basedir=$(python tools/openblas_support.py) cp -r $basedir/lib/* /usr/local/lib cp $basedir/include/* /usr/local/include - # TODO: don't copy directories if not arm64, - # but we need a way to know if cibuildwheel is cross-compiling arm64 to do this if [[ $RUNNER_OS == "macOS" && $PLATFORM == "macosx-arm64" ]]; then sudo mkdir -p /opt/arm64-builds/lib /opt/arm64-builds/include sudo chown -R $USER /opt/arm64-builds @@ -46,9 +44,8 @@ if [[ $RUNNER_OS == "macOS" ]]; then hdiutil attach -mountpoint /Volumes/gfortran gfortran.dmg sudo installer -pkg /Volumes/gfortran/gfortran.pkg -target / otool -L /usr/local/gfortran/lib/libgfortran.3.dylib - + # arm64 stuff from gfortran_utils - # TODO: figure out a way not to do this on x86_64, see above comment for openblas if [[ $PLATFORM == "macosx-arm64" ]]; then source $PROJECT_DIR/tools/wheels/gfortran_utils.sh install_arm64_cross_gfortran |