Skip to content

Commit 792323c

Browse files
committed
setup.py: arm64 macOS fixes
- Passing --target to CFLAGS and LDFLAGS based on ARCHFLAGS
1 parent 519f01c commit 792323c

3 files changed

Lines changed: 24 additions & 5 deletions

File tree

.github/workflows/wheels.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@ jobs:
77
name: Build wheels on ${{ matrix.os }}
88
runs-on: ${{ matrix.os }}
99
strategy:
10+
fail-fast: false
1011
matrix:
1112
# os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, macos-13, macos-latest]
1213
# os: [ubuntu-latest]
1314
# os: [windows-2019] #latest]
1415
# os: [macos-13] # macos-latest]
15-
os: [ubuntu-latest, windows-2022, ubuntu-24.04-arm, macos-15-intel, macos-latest]
16+
#os: [ubuntu-latest, windows-2022, ubuntu-24.04-arm, macos-15-intel, macos-latest]
17+
os: [windows-2022, macos-15-intel, macos-latest]
1618

1719
steps:
1820
- uses: actions/checkout@v4
@@ -43,15 +45,15 @@ jobs:
4345
run: git submodule update --init --recursive
4446

4547
- name: Install cibuildwheel
46-
run: python3 -m pip install cibuildwheel==2.23.3
48+
run: python3 -m pip install cibuildwheel #==2.23.3
4749

4850
- name: Build wheels
4951
run: python3 -m cibuildwheel --output-dir wheelhouse
5052
env:
5153
CIBW_ENABLE: "pypy"
5254
# Windows PyPy 3.8 build is currently failing due to https://github.com/python-cffi/cffi/issues/170
5355
# 32-bit builds on Windows are not supported because the MinGW-w64 does not have multilib enabled
54-
CIBW_SKIP: "*-win32 pp*-win*"
56+
CIBW_SKIP: "*-win32 pp*-win* cp*t-*"
5557
# This ensures WIN_SHELL_COMMANDS does not get defined on Windows in crossplatform.mk, which breaks deep directory creations
5658
# since commands are executed in a UNIX-like shell expecting 'mkdir -p'
5759
CIBW_ENVIRONMENT: "MSYSCON=y"

setup.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,24 @@ def build_package():
134134
#subprocess.check_call(['gcc', '-v', '-m32'], cwd=eC_dir, env=env)
135135
#subprocess.check_call(['gcc', '-print-sysroot', '-m32'], cwd=eC_dir, env=env)
136136
#subprocess.check_call([make_cmd, f'troubleshoot'], cwd=eC_dir, env=env)
137-
make_and_args = [make_cmd, f'-j{cpu_count}', 'SKIP_SONAME=y'] #, 'V=1']
137+
138+
archflags = env.get("ARCHFLAGS", "")
139+
# Convert the space-separated -arch into a single-word target flag (work-around for eC compiler not yet recognizing two arguments '-arch arm64')
140+
if "arm64" in archflags:
141+
archflags = "--target=arm64-apple-macos11.0"
142+
env["MACOSX_DEPLOYMENT_TARGET"] = "11.0"
143+
elif "x86_64" in archflags:
144+
archflags = "--target=x86_64-apple-macos10.9"
145+
env["MACOSX_DEPLOYMENT_TARGET"] = "10.9"
146+
else:
147+
archflags = None
148+
149+
make_and_args = [make_cmd, f'-j{cpu_count}', 'SKIP_SONAME=y', 'V=1']
150+
if archflags is not None:
151+
# This will add arm64 architecture flags for macos-latest
152+
make_and_args.append('CFLAGS=' + archflags)
153+
make_and_args.append('LDFLAGS=' + archflags)
154+
138155
if cc_override is not None:
139156
make_and_args.extend(cc_override)
140157

0 commit comments

Comments
 (0)