From 8830bf3d8cc0adec5bdfc281cabd4209b322ac87 Mon Sep 17 00:00:00 2001 From: Stefan-Alin Pahontu <56953855+alinpahontu2912@users.noreply.github.com> Date: Mon, 17 Feb 2025 13:30:50 +0100 Subject: [PATCH] add checks for WinArm64 --- setup.py | 7 ++++++- soundfile.py | 9 ++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/setup.py b/setup.py index 1e94f44..9a5083c 100644 --- a/setup.py +++ b/setup.py @@ -12,8 +12,13 @@ # _find_library('sndfile') fails: if sys.platform == 'win32': architecture0 = architecture()[0] # 64bit or 32bit + if architecture0 == '64bit': + if 'arm' in machine().lower(): + architecture0 = 'arm64' + else: + architecture0 = 'x64' else: - architecture0 = machine() # x86_64 or arm64 + architecture0 = machine() if platform == 'darwin': libname = 'libsndfile_' + architecture0 + '.dylib' diff --git a/soundfile.py b/soundfile.py index 61db56c..c9917ef 100644 --- a/soundfile.py +++ b/soundfile.py @@ -158,12 +158,11 @@ elif _sys.platform == 'win32': from platform import architecture as _architecture from platform import machine as _machine - # this check can not be completed correctly: for x64 binaries running on - # arm64 Windows report the same values as arm64 binaries. For now, neither - # numpy nor cffi are available for arm64, so we can safely assume we're - # in x86 land: if _architecture()[0] == '64bit': - _packaged_libname = 'libsndfile_x64.dll' + if _machine().lower() == 'arm64': + _packaged_libname = 'libsndfile_arm64.dll' + else: + _packaged_libname = 'libsndfile_x64.dll' elif _architecture()[0] == '32bit': _packaged_libname = 'libsndfile_x86.dll' else: