|
1 | 1 | name: Build macOS bundled libs (GLFW + GLEW) |
2 | 2 |
|
3 | 3 | on: |
4 | | - workflow_dispatch: # manual trigger only |
| 4 | + workflow_dispatch: |
5 | 5 |
|
6 | 6 | permissions: |
7 | 7 | contents: write |
8 | 8 |
|
9 | 9 | jobs: |
10 | | - build: |
11 | | - runs-on: macos-latest # arm64 runner |
12 | | - |
| 10 | + build-arm64: |
| 11 | + runs-on: macos-latest # arm64 |
13 | 12 | steps: |
14 | 13 | - uses: actions/checkout@v4 |
15 | 14 |
|
16 | | - - name: Install GLFW and GLEW via Homebrew |
| 15 | + - name: Install GLFW and GLEW |
17 | 16 | run: brew install glfw glew |
18 | 17 |
|
19 | 18 | - name: Collect and fix dylib install names |
20 | 19 | run: | |
21 | 20 | mkdir -p libs/macos-arm64 |
22 | 21 |
|
23 | | - # GLFW |
24 | 22 | GLFW=$(brew --prefix glfw)/lib/libglfw.3.dylib |
25 | 23 | cp "$GLFW" libs/macos-arm64/libglfw.3.dylib |
26 | 24 | install_name_tool -id @rpath/libglfw.3.dylib libs/macos-arm64/libglfw.3.dylib |
27 | 25 |
|
28 | | - # GLEW |
29 | | - GLEW=$(brew --prefix glew)/lib/libGLEW.dylib |
30 | | - # Get actual versioned name |
31 | 26 | GLEW_VER=$(ls $(brew --prefix glew)/lib/libGLEW.*.dylib | head -1) |
32 | 27 | GLEW_BASE=$(basename "$GLEW_VER") |
33 | 28 | cp "$GLEW_VER" libs/macos-arm64/$GLEW_BASE |
34 | 29 | install_name_tool -id @rpath/$GLEW_BASE libs/macos-arm64/$GLEW_BASE |
35 | | - # Also create libGLEW.dylib symlink-equivalent copy |
36 | 30 | cp "$GLEW_VER" libs/macos-arm64/libGLEW.dylib |
37 | 31 | install_name_tool -id @rpath/libGLEW.dylib libs/macos-arm64/libGLEW.dylib |
38 | 32 |
|
39 | 33 | echo "=== arm64 libs ===" |
40 | 34 | file libs/macos-arm64/*.dylib |
41 | | - otool -L libs/macos-arm64/libglfw.3.dylib |
42 | | - otool -L libs/macos-arm64/libGLEW.dylib |
43 | 35 |
|
44 | | - - name: Upload as artifact |
| 36 | + - name: Upload artifact |
45 | 37 | uses: actions/upload-artifact@v4 |
46 | 38 | with: |
47 | 39 | name: macos-arm64-libs |
48 | 40 | path: libs/macos-arm64/ |
49 | 41 |
|
| 42 | + build-x64: |
| 43 | + runs-on: macos-13 # last Intel runner |
| 44 | + steps: |
| 45 | + - uses: actions/checkout@v4 |
| 46 | + |
| 47 | + - name: Install GLFW and GLEW |
| 48 | + run: brew install glfw glew |
| 49 | + |
| 50 | + - name: Collect and fix dylib install names |
| 51 | + run: | |
| 52 | + mkdir -p libs/macos-x64 |
| 53 | +
|
| 54 | + GLFW=$(brew --prefix glfw)/lib/libglfw.3.dylib |
| 55 | + cp "$GLFW" libs/macos-x64/libglfw.3.dylib |
| 56 | + install_name_tool -id @rpath/libglfw.3.dylib libs/macos-x64/libglfw.3.dylib |
| 57 | +
|
| 58 | + GLEW_VER=$(ls $(brew --prefix glew)/lib/libGLEW.*.dylib | head -1) |
| 59 | + GLEW_BASE=$(basename "$GLEW_VER") |
| 60 | + cp "$GLEW_VER" libs/macos-x64/$GLEW_BASE |
| 61 | + install_name_tool -id @rpath/$GLEW_BASE libs/macos-x64/$GLEW_BASE |
| 62 | + cp "$GLEW_VER" libs/macos-x64/libGLEW.dylib |
| 63 | + install_name_tool -id @rpath/libGLEW.dylib libs/macos-x64/libGLEW.dylib |
| 64 | +
|
| 65 | + echo "=== x64 libs ===" |
| 66 | + file libs/macos-x64/*.dylib |
| 67 | +
|
| 68 | + - name: Upload artifact |
| 69 | + uses: actions/upload-artifact@v4 |
| 70 | + with: |
| 71 | + name: macos-x64-libs |
| 72 | + path: libs/macos-x64/ |
| 73 | + |
| 74 | + commit: |
| 75 | + needs: [build-arm64, build-x64] |
| 76 | + runs-on: ubuntu-latest |
| 77 | + steps: |
| 78 | + - uses: actions/checkout@v4 |
| 79 | + |
| 80 | + - uses: actions/download-artifact@v4 |
| 81 | + with: |
| 82 | + name: macos-arm64-libs |
| 83 | + path: libs/macos-arm64/ |
| 84 | + |
| 85 | + - uses: actions/download-artifact@v4 |
| 86 | + with: |
| 87 | + name: macos-x64-libs |
| 88 | + path: libs/macos-x64/ |
| 89 | + |
50 | 90 | - name: Commit to repo |
51 | 91 | run: | |
52 | 92 | git config user.name "github-actions[bot]" |
53 | 93 | git config user.email "github-actions[bot]@users.noreply.github.com" |
54 | | - git add libs/macos-arm64/ |
55 | | - git diff --staged --quiet || git commit -m "ci: add bundled macOS arm64 GLFW+GLEW dylibs" |
| 94 | + git add libs/macos-arm64/ libs/macos-x64/ |
| 95 | + git diff --staged --quiet || git commit -m "ci: update bundled macOS arm64+x64 GLFW+GLEW dylibs" |
56 | 96 | git push |
0 commit comments