Skip to content

Commit

Permalink
Tweak for Arm Mac
Browse files Browse the repository at this point in the history
  • Loading branch information
nabobalis committed Jul 3, 2024
1 parent 8e59cda commit fc8b393
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ jobs:
- fftw
envs: |
# Mac Arm
- macos: py311
runs-on: macos-latest
#- macos: py311
# runs-on: macos-latest
# Mac Intel
- macos: py311
runs-on: macos-12
Expand Down Expand Up @@ -115,14 +115,14 @@ jobs:
submodules: false
libraries: libfftw3-dev
targets: |
- cp310-macosx_arm64
#- cp310-macosx_arm64
- cp310-macosx_x86_64
- cp310-manylinux*_x86_64
- cp311-macosx_arm64
- cp310-manylinux2014_x86_64
#- cp311-macosx_arm64
- cp311-macosx_x86_64
- cp311-manylinux*_x86_64
- cp312-macosx_arm64
- cp311-manylinux2014_x86_64
#- cp312-macosx_arm64
- cp312-macosx_x86_64
- cp312-manylinux*_x86_64
- cp312-manylinux2014_x86_64
secrets:
pypi_token: ${{ secrets.pypi_token }}
10 changes: 5 additions & 5 deletions pyflct/setup_package.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import sys
import platform
import subprocess
from glob import glob
from collections import defaultdict
Expand All @@ -26,15 +27,14 @@ def get_extensions():
cfg["library_dirs"].append(os.path.join(sys.prefix, "Library", "lib"))
else:
cfg["libraries"].append("m")
# WE assume we have brew installed on Mac OS to provide FFTW3
if sys.platform.lower() == "darwin":
# We assume we have brew installed on Mac OS to provide FFTW3
if platform.system().lower() == "darwin":
brew_path = (
subprocess.run(["brew", "--prefix"], stdout=subprocess.PIPE).stdout.decode("utf-8").replace("\n", "")
)
cfg["include_dirs"].append(f"{brew_path}/include")
if not (sys.platform.lower() == "darwin" and sys.processor().lower() == "arm"):
# This does not get registered on ARM Mac via Brew
cfg["libraries"].append("fftw3")
cfg["libraries"].append("fftw3")
cfg["include_dirs"].append("/usr/include")
cfg["include_dirs"].append("/usr/local/include")
cfg["extra_compile_args"].extend(["-O3", "-w", "-fomit-frame-pointer", "-fPIC"])
return [Extension("pyflct._flct", **cfg)]
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ before-all = "yum -y install fftw-devel; git clean -xfd -e dist"

[tool.cibuildwheel.macos]
before-all = "brew install fftw; git clean -xfd -e dist"
environment = {MACOSX_DEPLOYMENT_TARGET=12.0}

[tool.black]
line-length = 120
Expand Down

0 comments on commit fc8b393

Please sign in to comment.