-
Notifications
You must be signed in to change notification settings - Fork 36
138 lines (137 loc) · 5.84 KB
/
build-libs.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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: Build Libs
on:
workflow_dispatch:
push:
branches:
- 'main'
paths:
- 'Platform/**'
- '!Platform/libs/**'
pull_request:
paths:
- 'Platform/**'
- '!Platform/libs/**'
jobs:
Build:
strategy:
matrix:
include:
- os: windows-latest
arch: x64
target: win-x64
lib: FosterPlatform.dll
- os: windows-latest
arch: arm64
target: win-arm64
lib: FosterPlatform.dll
- os: macos-latest
arch: x64-arm64
target: osx
lib: libFosterPlatform.dylib
- os: ubuntu-latest
arch: x64
target: linux-x64
lib: libFosterPlatform.so
- os: ubuntu-latest
arch: arm64
target: linux-arm64
lib: libFosterPlatform.so
- os: ubuntu-latest
arch: arm32
target: linux-arm32
lib: libFosterPlatform.so
runs-on: ${{matrix.os}}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get CMake
uses: lukka/[email protected]
- name: Setup Linux dependencies
if: ${{ runner.os == 'Linux' && matrix.arch != 'arm64' }}
run: |
sudo apt-get update
sudo apt-get install libsdl2-dev
- name: Setup Linux dependencies (arm64)
if: ${{ runner.os == 'Linux' && matrix.arch == 'arm64' }}
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu
sudo sed -i "s/^deb/deb [arch=amd64,i386]/g" /etc/apt/sources.list
echo "deb [arch=arm64,armhf] http://ports.ubuntu.com/ $(lsb_release -s -c) main universe multiverse restricted" | sudo tee -a /etc/apt/sources.list
echo "deb [arch=arm64,armhf] http://ports.ubuntu.com/ $(lsb_release -s -c)-updates main universe multiverse restricted" | sudo tee -a /etc/apt/sources.list
sudo dpkg --add-architecture arm64
sudo apt-get update
sudo apt-get install -y libsdl2-dev:arm64 libwayland-dev:arm64 libegl-dev:arm64 libdrm-dev:arm64 libxkbcommon-dev:arm64 libpulse-dev:arm64
- name: Setup Linux dependencies (arm32)
if: ${{ runner.os == 'Linux' && matrix.arch == 'arm32' }}
run: |
sudo apt-get update
sudo apt-get install -y gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf binutils-arm-linux-gnueabihf
sudo sed -i "s/^deb/deb [arch=amd64,i386]/g" /etc/apt/sources.list
echo "deb [arch=arm64,armhf] http://ports.ubuntu.com/ $(lsb_release -s -c) main universe multiverse restricted" | sudo tee -a /etc/apt/sources.list
echo "deb [arch=arm64,armhf] http://ports.ubuntu.com/ $(lsb_release -s -c)-updates main universe multiverse restricted" | sudo tee -a /etc/apt/sources.list
sudo dpkg --add-architecture armhf
sudo apt-get update
sudo apt-get install -y libsdl2-dev:armhf libwayland-dev:armhf libegl-dev:armhf libdrm-dev:armhf libxkbcommon-dev:armhf libpulse-dev:armhf
- name: CMake Configure
if: ${{ !(runner.os == 'Linux' && matrix.arch == 'arm64') && !(runner.os == 'Linux' && matrix.arch == 'arm32') }}
run: cmake -B build -S Platform -DFOSTER_OVERRIDE_TARGET=${{matrix.target}}
- name: CMake Configure (Linux-arm64)
if: ${{ runner.os == 'Linux' && matrix.arch == 'arm64' }}
run: PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig cmake -B build -S Platform -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ -DCMAKE_SYSTEM_PROCESSOR=aarch64 -DCMAKE_SYSTEM_NAME=Linux -DFOSTER_OVERRIDE_TARGET=${{matrix.target}}
- name: CMake Configure (Linux-arm32)
if: ${{ runner.os == 'Linux' && matrix.arch == 'arm32' }}
run: PKG_CONFIG_PATH=/usr/lib/arm-linux-gnueabihf/pkgconfig cmake -B build -S Platform -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc -DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ -DCMAKE_SYSTEM_PROCESSOR=armv7l -DCMAKE_SYSTEM_NAME=Linux -DFOSTER_OVERRIDE_TARGET=${{matrix.target}}
- name: CMake Build
run: cmake --build build --config Release
- name: Publish Artifact
uses: actions/upload-artifact@v4
with:
name: ${{matrix.os}}-${{matrix.arch}}-build
path: Platform/libs/${{matrix.target}}/${{matrix.lib}}
UpdateLibs:
if: github.ref == 'refs/heads/main'
needs: [Build]
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download windows x64 lib
uses: actions/download-artifact@v4
with:
name: windows-latest-x64-build
path: Platform/libs/win-x64
- name: Download windows arm lib
uses: actions/download-artifact@v4
with:
name: windows-latest-arm64-build
path: Platform/libs/win-arm64
- name: Download macos lib
uses: actions/download-artifact@v4
with:
name: macos-latest-x64-arm64-build
path: Platform/libs/osx
- name: Download ubuntu lib
uses: actions/download-artifact@v4
with:
name: ubuntu-latest-x64-build
path: Platform/libs/linux-x64
- name: Download ubuntu lib (arm64)
uses: actions/download-artifact@v4
with:
name: ubuntu-latest-arm64-build
path: Platform/libs/linux-arm64
- name: Download ubuntu lib (arm32)
uses: actions/download-artifact@v4
with:
name: ubuntu-latest-arm32-build
path: Platform/libs/linux-arm32
- name: Display structure of libs
run: ls -R
working-directory: Platform/libs
- name: Commit changes
uses: EndBug/[email protected]
with:
message: Updated platform libs
committer_name: GitHub Actions
committer_email: [email protected]