Skip to content

Commit a12485e

Browse files
add mac arm64 to github builds (#187)
1 parent d844bf0 commit a12485e

File tree

2 files changed

+109
-3
lines changed

2 files changed

+109
-3
lines changed

.cirrus.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ pi_task:
7272
mac_task:
7373
macos_instance:
7474
matrix:
75-
- image: ghcr.io/cirruslabs/macos-sonoma-xcode:latest
75+
- image: ghcr.io/cirruslabs/macos-sequoia-xcode:latest
7676
env:
77-
MACOSX_DEPLOYMENT_TARGET: "11.0"
77+
MACOSX_DEPLOYMENT_TARGET: "11"
7878
matrix:
7979
- env:
8080
PY_VER: "3.12"

.github/workflows/build.yml

Lines changed: 107 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,112 @@ jobs:
117117
path: dist/*
118118

119119

120+
build-mac-arm64:
121+
runs-on: macos-13
122+
strategy:
123+
matrix:
124+
python-version: [ '3.12', '3.13', '3.14']
125+
raylib-platform: ['Desktop', 'SDL']
126+
env:
127+
MACOSX_DEPLOYMENT_TARGET: '11'
128+
steps:
129+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
130+
- uses: actions/checkout@v4
131+
with:
132+
submodules: recursive
133+
134+
- name: fix raygui bug
135+
run: |
136+
patch -p0 <raygui.h.diff
137+
138+
- name: Build SDL
139+
run: |
140+
wget https://github.com/libsdl-org/SDL/archive/refs/tags/release-2.32.8.tar.gz
141+
tar xvfz release-2.32.8.tar.gz
142+
mkdir build
143+
cd build
144+
cmake ../SDL-release-2.32.8 -DSDL_SHARED=OFF -DSDL_STATIC=ON -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=Release
145+
cmake --build . --config Release
146+
sudo cmake --install .
147+
148+
- name: Setup Python
149+
uses: actions/setup-python@v5
150+
with:
151+
# Version range or exact version of a Python version to use, using SemVer's version range syntax.
152+
python-version: ${{ matrix.python-version }}
153+
# The target architecture (x86, x64) of the Python interpreter.
154+
architecture: arm64
155+
156+
# Runs a set of commands using the runners shell
157+
- name: Build raylib without SDL because SDL version has incorrect pkg-config
158+
run: |
159+
cd raylib-c
160+
mkdir build
161+
cd build
162+
cmake -DBUILD_EXAMPLES=OFF -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release ..
163+
make -j2
164+
sudo make install
165+
166+
- name: Build raylib with SDL if selected
167+
run: |
168+
cd raylib-c
169+
mkdir build2
170+
cd build2
171+
cmake -DPLATFORM=${{ matrix.raylib-platform }} -DBUILD_EXAMPLES=OFF -DCUSTOMIZE_BUILD=ON -DSUPPORT_FILEFORMAT_JPG=ON -DSUPPORT_FILEFORMAT_FLAC=ON -DWITH_PIC=ON -DCMAKE_BUILD_TYPE=Release ..
172+
make -j2
173+
sudo cp raylib/libraylib.a /usr/local/lib/libraylib.a
174+
175+
- name: Copy extras
176+
run: |
177+
sudo cp -r raylib-c/src/external/glfw/include/GLFW /usr/local/include/
178+
sudo cp physac/src/physac.h /usr/local/include/
179+
sudo cp raygui/src/raygui.h /usr/local/include/
180+
181+
- name: Build raylib-python-cffi
182+
env:
183+
RAYLIB_PLATFORM: ${{ matrix.raylib-platform }}
184+
185+
run: |
186+
python -m pip install --upgrade pip
187+
pip3 install --upgrade "cffi>=2.0.0"
188+
pip3 install --upgrade wheel
189+
pip3 install --upgrade setuptools
190+
python -m pip install --upgrade build
191+
python -m build --wheel
192+
193+
- name: Test
194+
run: |
195+
pip3 install dist/*.whl
196+
cd /
197+
python3 -c 'import pyray; pyray.init_window(100,100,"test")' >/tmp/output 2>&1 || true
198+
cat /tmp/output
199+
if grep -q "INFO: Initializing raylib" /tmp/output; then
200+
echo "Passed"
201+
exit 0
202+
else
203+
echo "Failed"
204+
exit 1
205+
fi
206+
207+
- name: Rename wheels from universal2 to arm64
208+
run: |
209+
# Rename universal2 wheels to arm64 since they aren't truly universal
210+
for wheel in dist/*universal2.whl; do
211+
if [ -f "$wheel" ]; then
212+
new_wheel=$(echo "$wheel" | sed 's/universal2/arm64/')
213+
echo "Renaming: $(basename "$wheel") -> $(basename "$new_wheel")"
214+
mv "$wheel" "$new_wheel"
215+
fi
216+
done
217+
shell: bash
218+
219+
- name: Upload build Artifact wheel
220+
uses: actions/upload-artifact@v4
221+
with:
222+
name: wheel-mac-arm64-${{ matrix.raylib-platform }}-${{ matrix.python-version }}
223+
path: dist/*
224+
225+
120226

121227
build-linux:
122228
runs-on: ubuntu-latest
@@ -394,7 +500,7 @@ jobs:
394500
path: dynamic/dist/*
395501

396502
merge:
397-
needs: [build-mac-intel, build-windows, build-linux, source-distro, dynamic-distro]
503+
needs: [build-mac-intel, build-mac-arm64, build-windows, build-linux, source-distro, dynamic-distro]
398504
runs-on: ubuntu-latest
399505
steps:
400506
- name: Merge All Artifacts

0 commit comments

Comments
 (0)