From 36b1a69a716c0f628c460f3690d7e93aaaf85bec Mon Sep 17 00:00:00 2001 From: odidev Date: Wed, 6 Oct 2021 07:50:02 +0530 Subject: [PATCH] Add linux aarch64 wheel build support Signed-off-by: odidev --- .github/workflows/wheel.yaml | 19 ++++++++++++++++++- setup.py | 3 +++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/.github/workflows/wheel.yaml b/.github/workflows/wheel.yaml index 4ef4672f..ffa46832 100644 --- a/.github/workflows/wheel.yaml +++ b/.github/workflows/wheel.yaml @@ -4,13 +4,18 @@ on: [push, pull_request] jobs: build_wheels: - name: Build wheel on ${{ matrix.os }} + name: Build wheel on ${{matrix.arch}} for ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-latest] + arch: [auto] + include: + - os: ubuntu-latest + arch: aarch64 env: + CIBW_ARCHS_LINUX: ${{matrix.arch}} CIBW_TEST_COMMAND: pytest --pyargs numcodecs CIBW_TEST_REQUIRES: pytest CIBW_SKIP: "*27* pp* *35*" @@ -27,11 +32,23 @@ jobs: with: python-version: '3.9' + - uses: docker/setup-qemu-action@v1 + if: ${{ matrix.arch == 'aarch64' }} + name: Set up QEMU + - name: Install cibuildwheel run: | python -m pip install cibuildwheel==1.8.0 wheel + - name: Build wheel for aarch64 + if: ${{ matrix.arch == 'aarch64' }} + env: + CIBW_ENVIRONMENT: 'DISABLE_NUMCODECS_AVX2=1 DISABLE_NUMCODECS_SSE2=1' + run: | + python -m cibuildwheel --output-dir wheelhouse + - name: Build wheel + if: ${{ matrix.arch != 'aarch64' }} run: | python -m cibuildwheel --output-dir wheelhouse - uses: actions/upload-artifact@v1 diff --git a/setup.py b/setup.py index c8622fd6..eea475a3 100644 --- a/setup.py +++ b/setup.py @@ -2,6 +2,7 @@ import os from setuptools import setup, Extension import cpuinfo +import platform import sys from distutils.command.build_ext import build_ext from distutils.errors import CCompilerError, DistutilsExecError, \ @@ -28,6 +29,8 @@ if have_cflags: # respect compiler options set by user pass +elif platform.machine() == 'aarch64': + pass elif os.name == 'posix': if disable_sse2: base_compile_args.append('-mno-sse2')