-
Notifications
You must be signed in to change notification settings - Fork 1
112 lines (94 loc) · 3.5 KB
/
macos.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
name: macOS
on:
workflow_dispatch:
push:
paths:
- '**'
- 'examples/**'
- '.github/workflows/macos.yml'
pull_request:
paths:
- '**'
- 'examples/**'
- '.github/workflows/macos.yml'
release:
types: [published]
permissions:
contents: read
jobs:
build:
permissions:
contents: write # for actions/upload-release-asset to upload release asset
runs-on: macos-latest
env:
RELEASE_NAME: RSGL-dev_macos
steps:
- name: Checkout
uses: actions/checkout@master
- name: Setup Release Version
run: |
echo "RELEASE_NAME=RSGL-${{ github.event.release.tag_name }}_macos" >> $GITHUB_ENV
shell: bash
if: github.event_name == 'release' && github.event.action == 'published'
- name: Setup Environment
run: |
mkdir build
cd build
mkdir ${{ env.RELEASE_NAME }}
cd ${{ env.RELEASE_NAME }}
mkdir include
mkdir lib
cd ../..
# Generating static + shared library, note that i386 architecture is deprecated
# Defining GL_SILENCE_DEPRECATION because OpenGL is deprecated on macOS
- name: Build Library
run: |
clang --version
# Extract version numbers from Makefile
brew install grep
# Build RSGL x86_64 static
make CUSTOM_CFLAGS="-target x86_64-apple-macos10.12 -DGL_SILENCE_DEPRECATION"
mv libRSGL.a /tmp/libRSGL_x86_64.a
rm -f RSGL.o
# Build RSGL arm64 static
make CUSTOM_CFLAGS="-target arm64-apple-macos11 -DGL_SILENCE_DEPRECATION"
mv libRSGL.a /tmp/libRSGL_arm64.a
rm -f RSGL.o
# Join x86_64 and arm64 static
lipo -create -output build/${{ env.RELEASE_NAME }}/lib/libRSGL.a /tmp/libRSGL_x86_64.a /tmp/libRSGL_arm64.a
# Build RSGL x86_64 dynamic
make CUSTOM_CFLAGS="-target x86_64-apple-macos10.12 -DGL_SILENCE_DEPRECATION"
mv libRSGL.dylib /tmp/libRSGL_x86_64.dylib
rm -f RSGL.o
# Build RSGL arm64 dynamic
make CUSTOM_CFLAGS="-target arm64-apple-macos11 -DGL_SILENCE_DEPRECATION"
mv libRSGL.dylib /tmp/libRSGL_arm64.dylib
# Join x86_64 and arm64 dynamic
rm -f ./build/lib/*
lipo -create -output libRSGL.dylib /tmp/libRSGL_x86_64.dylib /tmp/libRSGL_arm64.dylib
ln -sv libRSGL.dylib build/${{ env.RELEASE_NAME }}/lib/libRSGL.dylib
- name: Generate Artifacts
run: |
mkdir -p build
mkdir -p build/include
mkdir -p build/lib
cp -v ./RSGL.h ./build/${{ env.RELEASE_NAME }}/include
cp -v ./RSGL_gl.h ./build/${{ env.RELEASE_NAME }}/include
cp -v -r ./deps ./build/${{ env.RELEASE_NAME }}/include
cp -v ./libRSGL.a ./build/${{ env.RELEASE_NAME }}/lib
cp -v ./README.md ./build/${{ env.RELEASE_NAME }}/README.md
cp -v ./LICENSE ./build/${{ env.RELEASE_NAME }}/LICENSE
cd build
tar -czvf ${{ env.RELEASE_NAME }}.tar.gz ${{ env.RELEASE_NAME }}
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ env.RELEASE_NAME }}.tar.gz
path: ./build/${{ env.RELEASE_NAME }}.tar.gz
- name: Upload Artifact to Release
uses: softprops/action-gh-release@v1
with:
files: ./build/${{ env.RELEASE_NAME }}.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: github.event_name == 'release' && github.event.action == 'published'