Skip to content

Commit c0f1294

Browse files
committed
CI: build macOS dylibs on native runners (arm64 + x64)
1 parent f2bac70 commit c0f1294

1 file changed

Lines changed: 28 additions & 30 deletions

File tree

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,49 @@
11
name: Build macOS bundled dylibs
22

33
on:
4-
workflow_dispatch: # manual trigger only
4+
workflow_dispatch:
55

66
jobs:
7-
build:
7+
build-arm64:
88
runs-on: macos-latest
99
steps:
1010
- uses: actions/checkout@v4
11-
12-
- name: Install GLFW and GLEW via Homebrew
13-
run: brew install glfw glew
14-
15-
- name: Collect dylibs (arm64)
11+
- name: Install GLFW and GLEW
12+
run: |
13+
export HOMEBREW_NO_REQUIRE_TAP_TRUST=1
14+
brew install glfw glew
15+
- name: Collect arm64 dylibs
1616
run: |
1717
mkdir -p libs/macos-arm64
18-
# GLFW
1918
cp $(brew --prefix glfw)/lib/libglfw.3.dylib libs/macos-arm64/
20-
# GLEW
2119
cp $(brew --prefix glew)/lib/libGLEW.dylib libs/macos-arm64/
22-
# Fix install names so the binary finds them via @rpath
2320
install_name_tool -id @rpath/libglfw.3.dylib libs/macos-arm64/libglfw.3.dylib
2421
install_name_tool -id @rpath/libGLEW.dylib libs/macos-arm64/libGLEW.dylib
25-
ls -la libs/macos-arm64/
2622
file libs/macos-arm64/*.dylib
23+
- uses: actions/upload-artifact@v4
24+
with:
25+
name: macos-arm64-dylibs
26+
path: libs/macos-arm64/
27+
retention-days: 30
2728

28-
- name: Also build x64 slice (lipo from universal if available)
29+
build-x64:
30+
runs-on: macos-13
31+
steps:
32+
- uses: actions/checkout@v4
33+
- name: Install GLFW and GLEW
34+
run: |
35+
export HOMEBREW_NO_REQUIRE_TAP_TRUST=1
36+
brew install glfw glew
37+
- name: Collect x64 dylibs
2938
run: |
3039
mkdir -p libs/macos-x64
31-
# GitHub's macos-latest runners are arm64; extract x86_64 slice if universal
32-
for f in libs/macos-arm64/*.dylib; do
33-
name=$(basename $f)
34-
if lipo -info $f 2>/dev/null | grep -q x86_64; then
35-
lipo $f -thin x86_64 -output libs/macos-x64/$name
36-
else
37-
# arm64 only -- copy as-is for now, x64 users need Homebrew
38-
cp $f libs/macos-x64/$name
39-
fi
40-
done
41-
ls -la libs/macos-x64/
40+
cp $(brew --prefix glfw)/lib/libglfw.3.dylib libs/macos-x64/
41+
cp $(brew --prefix glew)/lib/libGLEW.dylib libs/macos-x64/
42+
install_name_tool -id @rpath/libglfw.3.dylib libs/macos-x64/libglfw.3.dylib
43+
install_name_tool -id @rpath/libGLEW.dylib libs/macos-x64/libGLEW.dylib
4244
file libs/macos-x64/*.dylib
43-
44-
- name: Upload as artifact
45-
uses: actions/upload-artifact@v4
45+
- uses: actions/upload-artifact@v4
4646
with:
47-
name: macos-dylibs
48-
path: |
49-
libs/macos-arm64/
50-
libs/macos-x64/
47+
name: macos-x64-dylibs
48+
path: libs/macos-x64/
5149
retention-days: 30

0 commit comments

Comments
 (0)