Skip to content

Commit

Permalink
Add wheels for macOS arm64 (#118)
Browse files Browse the repository at this point in the history
  • Loading branch information
letmaik committed Feb 9, 2024
1 parent 894352e commit 0534258
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 7 deletions.
6 changes: 3 additions & 3 deletions .github/scripts/build-macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ pip freeze
# By default, wheels are tagged with the architecture of the Python
# installation, which would produce universal2 even if only building
# for x86_64. The following line overrides that behavior.
export _PYTHON_HOST_PLATFORM="macosx-${MACOS_MIN_VERSION}-x86_64"
export _PYTHON_HOST_PLATFORM="macosx-${MACOS_MIN_VERSION}-$ARCH"

export CC=clang
export CXX=clang++
export CFLAGS="-arch x86_64"
export CFLAGS="-arch $ARCH"
export CXXFLAGS=$CFLAGS
export LDFLAGS=$CFLAGS
export ARCHFLAGS=$CFLAGS
Expand All @@ -54,7 +54,7 @@ python setup.py bdist_wheel
# no shared library dependencies that have to be bundled.

delocate-listdeps --all --depending dist/*.whl # lists library dependencies
delocate-wheel --verbose --require-archs=x86_64 dist/*.whl # copies library dependencies into wheel
delocate-wheel --verbose --require-archs=$ARCH dist/*.whl # copies library dependencies into wheel
delocate-listdeps --all --depending dist/*.whl # verify

# Dump target versions of dependend libraries.
Expand Down
10 changes: 8 additions & 2 deletions .github/scripts/install-macos-obs-virtual-cam.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@ set -e -x

VERSION="28.0.2"

DMG_FILENAME="obs-studio-${VERSION}-macos-x86_64.dmg"
if [[ "$ARCH" == "arm64" ]]; then
ARCH_MOUNT="Apple"
else
ARCH_MOUNT="Intel"
fi

DMG_FILENAME="obs-studio-${VERSION}-macos-${ARCH}.dmg"
DMG_URL="https://cdn-fastly.obsproject.com/downloads/${DMG_FILENAME}"
MOUNT_PATH="/Volumes/OBS-${VERSION}-macOS-Intel"
MOUNT_PATH="/Volumes/OBS-${VERSION}-macOS-${ARCH_MOUNT}"
INSTALL_PATH="/Library/CoreMediaIO/Plug-Ins/DAL"

sudo mkdir -p "${INSTALL_PATH}"
Expand Down
2 changes: 1 addition & 1 deletion .github/scripts/test-macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ python -m venv env/$VENV
source env/$VENV/bin/activate

# Install pyvirtualcam
pip install dist/pyvirtualcam*cp${PYVER}*macosx*.whl
pip install dist/pyvirtualcam*cp${PYVER}*macosx*${ARCH}*.whl

# Test installed pyvirtualcam
pip install -r dev-requirements.txt
Expand Down
50 changes: 50 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,30 +65,54 @@ jobs:

- os-image: macos-11
os-name: mac
arch: x86_64
macos-min-version: '10.9'
python-version: '3.8'
numpy-version: '1.17.*'
- os-image: macos-11
os-name: mac
arch: x86_64
macos-min-version: '10.9'
python-version: '3.9'
numpy-version: '1.19.*'
- os-image: macos-11
os-name: mac
arch: x86_64
macos-min-version: '10.9'
python-version: '3.10'
numpy-version: '1.21.*'
- os-image: macos-11
os-name: mac
arch: x86_64
macos-min-version: '10.9'
python-version: '3.11'
numpy-version: '1.23.*'
- os-image: macos-11
os-name: mac
arch: x86_64
macos-min-version: '10.9'
python-version: '3.12'
numpy-version: '1.26.*'

- os-image: macos-14 # M1
os-name: mac
arch: arm64
macos-min-version: '11.0'
python-version: '3.10'
numpy-version: '1.21.*'
- os-image: macos-14 # M1
os-name: mac
arch: arm64
macos-min-version: '11.0'
python-version: '3.11'
numpy-version: '1.23.*'
- os-image: macos-14 # M1
os-name: mac
arch: arm64
macos-min-version: '11.0'
python-version: '3.12'
numpy-version: '1.26.*'

- os-image: windows-latest
os-name: windows
python-version: '3.8'
Expand Down Expand Up @@ -159,6 +183,7 @@ jobs:
if: matrix.config.os-name == 'mac'
run: .github/scripts/build-macos.sh
env:
ARCH: ${{ matrix.config.arch }}
MACOS_MIN_VERSION: ${{ matrix.config.macos-min-version }}
PYTHON_VERSION: ${{ matrix.config.python-version }}
NUMPY_VERSION: ${{ matrix.config.numpy-version }}
Expand Down Expand Up @@ -210,30 +235,54 @@ jobs:

- os-image: macos-11
os-name: mac
arch: x86_64
macos-min-version: '10.9'
python-version: '3.8'
numpy-version: '1.17.*'
- os-image: macos-11
os-name: mac
arch: x86_64
macos-min-version: '10.9'
python-version: '3.9'
numpy-version: '1.19.*'
- os-image: macos-11
os-name: mac
arch: x86_64
macos-min-version: '10.9'
python-version: '3.10'
numpy-version: '1.21.*'
- os-image: macos-11
os-name: mac
arch: x86_64
macos-min-version: '10.9'
python-version: '3.11'
numpy-version: '1.23.*'
- os-image: macos-11
os-name: mac
arch: x86_64
macos-min-version: '10.9'
python-version: '3.12'
numpy-version: '1.26.*'

- os-image: macos-14 # M1
os-name: mac
arch: arm64
macos-min-version: '11.0'
python-version: '3.10'
numpy-version: '1.21.*'
- os-image: macos-14 # M1
os-name: mac
arch: arm64
macos-min-version: '11.0'
python-version: '3.11'
numpy-version: '1.23.*'
- os-image: macos-14 # M1
os-name: mac
arch: arm64
macos-min-version: '11.0'
python-version: '3.12'
numpy-version: '1.26.*'

- os-image: windows-latest
os-name: windows
python-version: '3.8'
Expand Down Expand Up @@ -311,6 +360,7 @@ jobs:
.github/scripts/install-macos-obs-virtual-cam.sh
.github/scripts/test-macos.sh
env:
ARCH: ${{ matrix.config.arch }}
PYTHON_VERSION: ${{ matrix.config.python-version }}

- name: Store test captures as artifacts
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.11.1] - 2023-02-08
### Added
- macOS arm64 support (Python 3.10 and higher).

## [0.11.0] - 2023-12-10
### Added
- Python 3.12 support.
Expand Down Expand Up @@ -131,6 +135,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Windows only, Python 3.5 - 3.8.
- Support for [OBS-VirtualCam](https://github.com/CatxFish/obs-virtual-cam).

[0.11.1]: https://github.com/letmaik/pyvirtualcam/compare/v0.11.0...v0.11.1
[0.11.0]: https://github.com/letmaik/pyvirtualcam/compare/v0.10.2...v0.11.0
[0.10.2]: https://github.com/letmaik/pyvirtualcam/compare/v0.10.1...v0.10.2
[0.10.1]: https://github.com/letmaik/pyvirtualcam/compare/v0.10.0...v0.10.1
Expand Down
2 changes: 1 addition & 1 deletion pyvirtualcam/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.11.0"
__version__ = "0.11.1"

0 comments on commit 0534258

Please sign in to comment.