Skip to content

Commit

Permalink
build mac arm wheels
Browse files Browse the repository at this point in the history
  • Loading branch information
minrk committed Feb 12, 2021
1 parent 7a0fdc6 commit 3197d92
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 11 deletions.
30 changes: 19 additions & 11 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:

env:
cython: "0.29.21"
cibuildwheel: "1.8.0"
cibuildwheel: "1.9.0"
TWINE_NONINTERACTIVE: "1"

jobs:
Expand Down Expand Up @@ -59,8 +59,8 @@ jobs:
env:
MACOSX_DEPLOYMENT_TARGET: "10.9"
CIBW_BUILD_VERBOSITY: "1"
CIBW_BEFORE_ALL_MACOS: 'bash tools/install_libzmq.sh'
CIBW_BEFORE_ALL_LINUX: 'bash tools/install_libzmq.sh'
CIBW_BEFORE_ALL_MACOS: "bash tools/install_libzmq.sh"
CIBW_BEFORE_ALL_LINUX: "bash tools/install_libzmq.sh"

CIBW_ENVIRONMENT_MACOS: "ZMQ_PREFIX=/usr/local"
CIBW_ENVIRONMENT_LINUX: >-
Expand All @@ -78,12 +78,12 @@ jobs:
CIBW_TEST_REQUIRES: "pytest"
CIBW_TEST_COMMAND: "pytest -vsx {package}/tools/test_wheel.py"
CIBW_SKIP: "cp2* cp35* pp2*"
CIBW_BUILD: "${{ matrix.cibw.build || '*' }}"
CIBW_MANYLINUX_X86_64_IMAGE: "${{ matrix.cibw.manylinux_image }}"
CIBW_MANYLINUX_I686_IMAGE: "${{ matrix.cibw.manylinux_image }}"
CIBW_MANYLINUX_AARCH64_IMAGE: "${{ matrix.cibw.manylinux_image }}"
CIBW_ARCHS_LINUX: "${{ matrix.cibw.arch || 'auto' }}"
CIBW_ARCHS_MACOS: "${{ matrix.cibw.arch || 'auto' }}"

strategy:
fail-fast: false
Expand All @@ -92,6 +92,12 @@ jobs:
- os: macos-10.15
name: mac

- os: macos-10.15
name: mac-arm
cibw:
arch: universal2
build: "cp39*"

- os: ubuntu-20.04
name: manylinux1
cibw:
Expand Down Expand Up @@ -166,8 +172,8 @@ jobs:
# doesn't bundle dlls (requires separate vcredist install, as pypy itself seems to)
# bundling external libzmq doesn't seem to work
run: |
echo 'CIBW_REPAIR_WHEEL_COMMAND_WINDOWS=' >> "$GITHUB_ENV"
echo 'CIBW_ENVIRONMENT_WINDOWS=' >> "$GITHUB_ENV"
echo 'CIBW_REPAIR_WHEEL_COMMAND_WINDOWS=' >> "$GITHUB_ENV"
echo 'CIBW_ENVIRONMENT_WINDOWS=' >> "$GITHUB_ENV"
- name: register qemu
if: contains(matrix.cibw.arch, 'aarch64')
Expand All @@ -182,6 +188,13 @@ jobs:
run: |
echo 'CIBW_BEFORE_ALL_LINUX=yum -y install epel-release && yum -y install zeromq-devel' >> "$GITHUB_ENV"
- name: customize mac-arm-64
if: contains(matrix.os, 'macos') && matrix.cibw.arch
run: |
sudo xcode-select -switch /Applications/Xcode_12.2.app
echo 'SDKROOT=/Applications/Xcode_12.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.0.sdk' >> "$GITHUB_ENV"
echo 'MACOSX_DEPLOYMENT_TARGET=11.0' >> "$GITHUB_ENV"
- name: install dependencies
run: |
pip install --upgrade setuptools pip wheel
Expand All @@ -208,11 +221,6 @@ jobs:
run: |
pip freeze
- name: show vcvars
if: startsWith(matrix.os, 'win')
run: |
python tools/showvcvars.py
- name: list target wheels
run: |
python -m cibuildwheel . --print-build-identifiers
Expand Down
27 changes: 27 additions & 0 deletions tools/install_libzmq.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,33 @@ LIBSODIUM_VERSION="1.0.18"

LIBZMQ_VERSION="$(python3 -m buildutils.bundle)"

if [[ "$(uname)" == "Darwin" ]]; then
ARCHS="x86_64"
case "${CIBW_ARCHS_MACOS:-auto}" in
"universal2")
ARCHS="x86_64 arm64"
;;
"arm64")
ARCHS="arm64"
;;
"x86_64")
ARCHS="x86_64"
;;
"auto")
;;
*)
echo "Unexpected arch: ${CIBW_ARCHS_MACOS}"
exit 1
;;
esac
echo "building libzmq for mac ${ARCHS}"
for arch in ${ARCHS}; do
export CFLAGS="-arch ${arch} ${CFLAGS:-}"
export CXXFLAGS="-arch ${arch} ${CXXFLAGS:-}"
export LDFLAGS="-arch ${arch} ${LDFLAGS:-}"
done
fi

PREFIX="${PREFIX:-/usr/local}"

curl -L -O "https://download.libsodium.org/libsodium/releases/libsodium-${LIBSODIUM_VERSION}.tar.gz"
Expand Down

0 comments on commit 3197d92

Please sign in to comment.