Skip to content

Commit a7f69b0

Browse files
committed
ci: add FreeType multi-platform build workflow
1 parent 1958fde commit a7f69b0

File tree

1 file changed

+242
-0
lines changed

1 file changed

+242
-0
lines changed

.github/workflows/dep-freetype.yml

Lines changed: 242 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,242 @@
1+
name: "Dep: Build FreeType"
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
freetype-version:
7+
description: FreeType version tag (e.g. VER-2-13-3)
8+
default: VER-2-13-3
9+
required: true
10+
11+
jobs:
12+
build-windows:
13+
name: Build FreeType (Windows)
14+
runs-on: windows-2025-vs2026
15+
strategy:
16+
matrix:
17+
include:
18+
- arch: x64
19+
rid: win-x64
20+
- arch: ARM64
21+
rid: win-arm64
22+
- arch: Win32
23+
rid: win-x86
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
28+
- name: Checkout FreeType
29+
uses: actions/checkout@v4
30+
with:
31+
repository: freetype/freetype
32+
ref: ${{ github.event.inputs.freetype-version }}
33+
path: freetype-src
34+
35+
- name: Build
36+
shell: pwsh
37+
run: |
38+
cmake -S freetype-src -B freetype-build -A ${{ matrix.arch }} `
39+
-DBUILD_SHARED_LIBS=ON `
40+
-DCMAKE_BUILD_TYPE=Release `
41+
-DFT_DISABLE_BZIP2=ON `
42+
-DFT_DISABLE_BROTLI=ON `
43+
-DFT_DISABLE_HARFBUZZ=ON `
44+
-DFT_DISABLE_PNG=ON `
45+
-DFT_DISABLE_ZLIB=ON
46+
cmake --build freetype-build --config Release
47+
48+
- name: Collect output
49+
shell: pwsh
50+
run: |
51+
New-Item -Path "out/${{ matrix.rid }}" -ItemType Directory -Force
52+
Copy-Item freetype-build/Release/freetype.dll "out/${{ matrix.rid }}/"
53+
Copy-Item freetype-build/Release/freetype.pdb "out/${{ matrix.rid }}/" -ErrorAction SilentlyContinue
54+
55+
- name: Upload
56+
uses: actions/upload-artifact@v4
57+
with:
58+
name: freetype-${{ matrix.rid }}
59+
path: out/${{ matrix.rid }}/
60+
61+
build-linux:
62+
name: Build FreeType (Linux x64)
63+
runs-on: ubuntu-24.04
64+
steps:
65+
- name: Checkout FreeType
66+
uses: actions/checkout@v4
67+
with:
68+
repository: freetype/freetype
69+
ref: ${{ github.event.inputs.freetype-version }}
70+
path: freetype-src
71+
72+
- name: Build
73+
run: |
74+
cmake -S freetype-src -B freetype-build \
75+
-DBUILD_SHARED_LIBS=ON \
76+
-DCMAKE_BUILD_TYPE=Release \
77+
-DCMAKE_C_FLAGS="-fPIC" \
78+
-DFT_DISABLE_BZIP2=ON \
79+
-DFT_DISABLE_BROTLI=ON \
80+
-DFT_DISABLE_HARFBUZZ=ON \
81+
-DFT_DISABLE_PNG=ON \
82+
-DFT_DISABLE_ZLIB=ON
83+
cmake --build freetype-build -- -j$(nproc)
84+
85+
- name: Collect output
86+
run: |
87+
mkdir -p out/linux-x64
88+
# Copy the actual shared library (not symlinks) with a versionless name
89+
cp $(readlink -f freetype-build/libfreetype.so) out/linux-x64/libfreetype.so
90+
91+
- name: Upload
92+
uses: actions/upload-artifact@v4
93+
with:
94+
name: freetype-linux-x64
95+
path: out/linux-x64/
96+
97+
build-macos:
98+
name: Build FreeType (macOS)
99+
runs-on: macos-15
100+
strategy:
101+
matrix:
102+
include:
103+
- arch: arm64
104+
rid: osx-arm64
105+
- arch: x86_64
106+
rid: osx-x64
107+
steps:
108+
- name: Checkout FreeType
109+
uses: actions/checkout@v4
110+
with:
111+
repository: freetype/freetype
112+
ref: ${{ github.event.inputs.freetype-version }}
113+
path: freetype-src
114+
115+
- name: Build
116+
run: |
117+
cmake -S freetype-src -B freetype-build \
118+
-DBUILD_SHARED_LIBS=ON \
119+
-DCMAKE_BUILD_TYPE=Release \
120+
-DCMAKE_OSX_ARCHITECTURES=${{ matrix.arch }} \
121+
-DFT_DISABLE_BZIP2=ON \
122+
-DFT_DISABLE_BROTLI=ON \
123+
-DFT_DISABLE_HARFBUZZ=ON \
124+
-DFT_DISABLE_PNG=ON \
125+
-DFT_DISABLE_ZLIB=ON
126+
cmake --build freetype-build -- -j$(sysctl -n hw.ncpu)
127+
128+
- name: Collect output
129+
run: |
130+
mkdir -p out/${{ matrix.rid }}
131+
# Copy the actual dylib (not symlinks) with a versionless name
132+
cp $(readlink -f freetype-build/libfreetype.dylib) out/${{ matrix.rid }}/libfreetype.dylib
133+
134+
- name: Upload
135+
uses: actions/upload-artifact@v4
136+
with:
137+
name: freetype-${{ matrix.rid }}
138+
path: out/${{ matrix.rid }}/
139+
140+
build-android:
141+
name: Build FreeType (Android)
142+
runs-on: ubuntu-24.04
143+
strategy:
144+
matrix:
145+
include:
146+
- abi: armeabi-v7a
147+
rid: android-arm
148+
- abi: arm64-v8a
149+
rid: android-arm64
150+
- abi: x86
151+
rid: android-x86
152+
- abi: x86_64
153+
rid: android-x64
154+
steps:
155+
- name: Checkout FreeType
156+
uses: actions/checkout@v4
157+
with:
158+
repository: freetype/freetype
159+
ref: ${{ github.event.inputs.freetype-version }}
160+
path: freetype-src
161+
162+
- name: Build
163+
run: |
164+
cmake -S freetype-src -B freetype-build \
165+
-DBUILD_SHARED_LIBS=ON \
166+
-DCMAKE_BUILD_TYPE=Release \
167+
-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_ROOT/build/cmake/android.toolchain.cmake \
168+
-DANDROID_ABI=${{ matrix.abi }} \
169+
-DANDROID_PLATFORM=android-21 \
170+
-DFT_DISABLE_BZIP2=ON \
171+
-DFT_DISABLE_BROTLI=ON \
172+
-DFT_DISABLE_HARFBUZZ=ON \
173+
-DFT_DISABLE_PNG=ON \
174+
-DFT_DISABLE_ZLIB=ON
175+
cmake --build freetype-build -- -j$(nproc)
176+
177+
- name: Collect output
178+
run: |
179+
mkdir -p out/${{ matrix.rid }}
180+
cp freetype-build/libfreetype.so out/${{ matrix.rid }}/
181+
182+
- name: Upload
183+
uses: actions/upload-artifact@v4
184+
with:
185+
name: freetype-${{ matrix.rid }}
186+
path: out/${{ matrix.rid }}/
187+
188+
build-ios:
189+
name: Build FreeType (iOS)
190+
runs-on: macos-15
191+
steps:
192+
- name: Checkout FreeType
193+
uses: actions/checkout@v4
194+
with:
195+
repository: freetype/freetype
196+
ref: ${{ github.event.inputs.freetype-version }}
197+
path: freetype-src
198+
199+
- name: Build
200+
run: |
201+
cmake -S freetype-src -B freetype-build \
202+
-DBUILD_SHARED_LIBS=OFF \
203+
-DCMAKE_BUILD_TYPE=Release \
204+
-DCMAKE_SYSTEM_NAME=iOS \
205+
-DCMAKE_OSX_ARCHITECTURES=arm64 \
206+
-DCMAKE_OSX_DEPLOYMENT_TARGET=12.0 \
207+
-DFT_DISABLE_BZIP2=ON \
208+
-DFT_DISABLE_BROTLI=ON \
209+
-DFT_DISABLE_HARFBUZZ=ON \
210+
-DFT_DISABLE_PNG=ON \
211+
-DFT_DISABLE_ZLIB=ON
212+
cmake --build freetype-build -- -j$(sysctl -n hw.ncpu)
213+
214+
- name: Collect output
215+
run: |
216+
mkdir -p out/ios
217+
cp freetype-build/libfreetype.a out/ios/
218+
219+
- name: Upload
220+
uses: actions/upload-artifact@v4
221+
with:
222+
name: freetype-ios
223+
path: out/ios/
224+
225+
collect:
226+
name: Collect all platforms
227+
needs: [build-windows, build-linux, build-macos, build-android, build-ios]
228+
runs-on: ubuntu-24.04
229+
steps:
230+
- name: Download all artifacts
231+
uses: actions/download-artifact@v4
232+
with:
233+
path: freetype-all/
234+
235+
- name: List contents
236+
run: find freetype-all -type f | sort
237+
238+
- name: Upload combined
239+
uses: actions/upload-artifact@v4
240+
with:
241+
name: freetype-all-platforms
242+
path: freetype-all/

0 commit comments

Comments
 (0)