Skip to content

Commit

Permalink
ARM64 binary support added for Linux and Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Bastian Bechtold committed Dec 30, 2024
1 parent a13f24a commit c40bf09
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ build/
*.egg-info/
.cache/
.vscode/
.DS_Store
.venv/
4 changes: 2 additions & 2 deletions build_wheels.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import shutil

architectures = dict(darwin=['x86_64', 'arm64'],
win32=['32bit', '64bit'],
linux=['x86_64'],
win32=['x86', 'x64', 'arm64'],
linux=['x86_64', 'arm64'],
noplatform='noarch')

def cleanup():
Expand Down
7 changes: 6 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,12 @@ def get_tag(self):
oses = 'win_amd64'
elif platform == 'linux':
# using the centos:7 runner with glibc2.17:
oses = 'manylinux_2_17_{}'.format(architecture0)
if architecture0 == 'arm64':
pep600_architecture = 'aarch64'
else:
pep600_architecture = architecture0

oses = 'manylinux_2_17_{}'.format(pep600_architecture)
else:
pythons = 'py2.py3'
oses = 'any'
Expand Down
16 changes: 14 additions & 2 deletions soundfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,22 @@
_packaged_libname = 'libsndfile_' + _machine() + '.dylib'
elif _sys.platform == 'win32':
from platform import architecture as _architecture
_packaged_libname = 'libsndfile_' + _architecture()[0] + '.dll'
from platform import machine as _machine
if _machine() == 'ARM64':
_packaged_libname = 'libsndfile_arm64.dll'
elif _architecture()[0] == '64bit':
_packaged_libname = 'libsndfile_x64.dll'
elif _architecture()[0] == '32bit':
_packaged_libname = 'libsndfile_x86.dll'
else:
raise OSError('no packaged library for Windows {} {}'
.format(_architecture(), _machine()))
elif _sys.platform == 'linux':
from platform import machine as _machine
_packaged_libname = 'libsndfile_' + _machine() + '.so'
if _machine() in ["aarch64", "aarch64_be", "armv8b", "armv8l"]:
_packaged_libname = 'libsndfile_arm64.so'
else:
_packaged_libname = 'libsndfile_' + _machine() + '.so'
else:
raise OSError('no packaged library for this platform')

Expand Down

0 comments on commit c40bf09

Please sign in to comment.