Skip to content

Commit

Permalink
update setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Yan Gao committed Jan 18, 2024
1 parent f1eb926 commit 52fd78e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- [ubuntu-latest, manylinux_x86_64, auto]
- [macos-latest, macosx_x86_64, x86_64]
# skip these for now, need more work
#- [macos-latest, macosx_arm64, arm64]
- [macos-latest, macosx_arm64, arm64]
python: ["cp38", "cp39", "cp310", "cp311", "cp312"]

steps:
Expand Down
15 changes: 9 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import os, platform, sys
import os

try:
from setuptools import setup, Extension
Expand All @@ -9,19 +9,22 @@

simde = ['-DUSE_SIMDE', '-DSIMDE_ENABLE_NATIVE_ALIASES']

if platform.system() == "Darwin":
machine_system = os.popen("uname").readlines()[0].rsplit()[0]
machine_arch = os.popen("uname -m").readlines()[0].rsplit()[0]

if machine_system == "Darwin":
# note: see https://github.com/pypa/wheel/issues/406
simd_flag = ['-march=native', '-D__AVX2__', '-mmacosx-version-min=10.9']
if platform.machine() in ["aarch64", "arm64"]:
if machine_arch in ["aarch64", "arm64"]:
os.environ['_PYTHON_HOST_PLATFORM'] = "macosx-10.9-arm64"
os.environ['ARCHFLAGS'] = "-arch arm64"
else:
else: # x86_64
os.environ['_PYTHON_HOST_PLATFORM'] = "macosx-10.9-x86_64"
os.environ['ARCHFLAGS'] = "-arch x86_64"
else:
if platform.machine() in ["aarch64", "arm64"]:
if machine_arch in ["aarch64", "arm64"]:
simd_flag = ['-march=armv8-a+simd', '-D__AVX2__']
elif platform.machine() in ["aarch32"]:
elif machine_arch in ["aarch32"]:
simd_flag = ['-march=armv8-a+simd', '-mfpu=auto -D__AVX2__']
else:
simd_flag=['-march=native']
Expand Down

0 comments on commit 52fd78e

Please sign in to comment.