-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add gh action to build python wheels for macos arm64
- Loading branch information
Showing
2 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: Python Wheel Build MacOS Arm64 | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
tags: | ||
- v* | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
MacOS: | ||
runs-on: macos-13 | ||
env: | ||
MACOSX_DEPLOYMENT_TARGET: 11.0 | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install libomp and fftw | ||
run: | | ||
pkg=$(brew fetch --force --bottle-tag=arm64_ventura fftw | grep 'Downloaded to' | cut -d' ' -f3) | ||
brew install $pkg | ||
pkg=$(brew fetch --force --bottle-tag=arm64_ventura libomp | grep 'Downloaded to' | cut -d' ' -f3) | ||
brew install $pkg | ||
- name: Compile libfinufft | ||
run: | | ||
cp make.inc.gh_macos_arm64_whl make.inc | ||
make lib | ||
- name: Build wheels | ||
uses: pypa/[email protected] | ||
env: | ||
FINUFFT_DIR: ${{ github.workspace }} | ||
CC: Clang | ||
CXX: Clang++ | ||
CIBW_ARCHS_MACOS: arm64 | ||
CIBW_BUILD: cp38-* cp39-* cp310-* cp311-* cp312-* | ||
with: | ||
package-dir: ./python/finufft | ||
output-dir: wheelhouse | ||
|
||
- name: Upload wheels | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: macos-wheels | ||
path: wheelhouse/*.whl | ||
|
||
- name: Setup tmate session | ||
if: ${{ failure() }} | ||
uses: mxschmitt/action-tmate@v3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Makefile variable overrides for Mac OSX compilation with CLANG. | ||
CFLAGS = -O3 -arch arm64 | ||
|
||
CXX=clang++ | ||
CC=clang | ||
|
||
OMP_ROOT = $(shell brew --prefix libomp) | ||
# taken from makefile... | ||
CFLAGS += -I include -I/usr/local/include -I/opt/homebrew/include -I$(OMP_ROOT)/include -target arm64-apple-macos11 | ||
FFLAGS = $(CFLAGS) | ||
CXXFLAGS = $(CFLAGS) | ||
LIBS += -L/usr/local/lib -L/opt/homebrew/lib -L$(OMP_ROOT)/lib -target arm64-apple-macos11 -arch arm64 | ||
|
||
# OpenMP with clang needs following... | ||
OMPFLAGS = -Xpreprocessor -fopenmp | ||
OMPLIBS = -L/usr/local/lib -L/opt/homebrew/lib -lomp | ||
# since fftw3_omp doesn't work in OSX, we need... | ||
FFTWOMPSUFFIX=threads | ||
|
||
|
||
# MATLAB interface: this will probably segfault. Instead we suggest you use | ||
# make.inc.macosx_clang_matlab | ||
|
||
# Some of these will depend on your FFTW library location... | ||
MFLAGS += -I/usr/local/include -I/opt/homebrew/include -L/usr/local/lib -L/opt/homebrew/lib -lm | ||
# may need to edit for your MATLAB version location... | ||
MEX = $(shell ls -d /Applications/MATLAB_R20**.app)/bin/mex | ||
# Also see docs/install.rst for possible edits to MATLAB's MEX XML file. |