Skip to content

Commit 37bc815

Browse files
committed
[Build] Add FreeType support for CI
1 parent 39a8699 commit 37bc815

File tree

4 files changed

+58
-24
lines changed

4 files changed

+58
-24
lines changed

.github/workflows/ci-build.yml

Lines changed: 54 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,63 +4,97 @@ jobs:
44
build-java:
55
strategy:
66
matrix:
7-
os: [ubuntu-latest, macos-latest]
8-
name: Build Java [${{ matrix.os }}]
7+
os: [ubuntu-20.04, macos-10.15]
8+
name: Build Java
99
runs-on: ${{ matrix.os }}
1010
steps:
1111
- name: Checkout repository
1212
uses: actions/checkout@v2
13+
1314
- name: Set up Java 8
1415
uses: actions/setup-java@v1
1516
with:
1617
java-version: 8
18+
1719
- name: Build
1820
uses: eskatos/gradle-command-action@v1
1921
with:
2022
arguments: build
2123
build-natives:
24+
env:
25+
FREETYPE_URL: https://download.savannah.gnu.org/releases/freetype/freetype-2.10.4.tar.gz
2226
strategy:
2327
matrix:
24-
os: [ubuntu-latest, macos-latest]
28+
os: [ubuntu-20.04, macos-10.15]
2529
type: [win, linux, mac]
30+
freetype: [true, false]
2631
include:
27-
- os: ubuntu-latest
28-
type: win
32+
- type: win
2933
expected: /tmp/imgui/libsNative/windows64/imgui-java64.dll
30-
- os: ubuntu-latest
31-
type: linux
34+
libName: imgui-java64.dll
35+
libNameFt: imgui-java64-ft.dll
36+
- type: linux
3237
expected: /tmp/imgui/libsNative/linux64/libimgui-java64.so
33-
- os: macos-latest
34-
type: mac
38+
libName: libimgui-java64.so
39+
libNameFt: libimgui-java64-ft.so
40+
- type: mac
3541
expected: /tmp/imgui/libsNative/macosx64/libimgui-java64.dylib
42+
libName: libimgui-java64.dylib
43+
libNameFt: libimgui-java64-ft.dylib
3644
exclude:
37-
- os: ubuntu-latest
45+
- os: ubuntu-20.04
3846
type: mac
39-
- os: macos-latest
47+
- os: macos-10.15
4048
type: win
41-
- os: macos-latest
49+
- os: macos-10.15
4250
type: linux
43-
name: Build Natives [${{ matrix.os }}]-[${{ matrix.type }}]
51+
name: Build Native (type=${{ matrix.type }}, freetype=${{ matrix.freetype }})
4452
runs-on: ${{ matrix.os }}
4553
steps:
4654
- name: Checkout repository and submodules
4755
uses: actions/checkout@v2
4856
with:
4957
submodules: recursive
58+
5059
- name: Set up Java 8
5160
uses: actions/setup-java@v1
5261
with:
5362
java-version: 8
63+
5464
- name: Ant Version
5565
run: ant -version
56-
- if: matrix.os == 'ubuntu-latest'
66+
67+
- if: matrix.os == 'ubuntu-20.04'
5768
name: Install MinGW-w64/GCC/G++
58-
run: sudo apt-get install mingw-w64 gcc-multilib g++-multilib
59-
- name: Build [${{ matrix.type }}]
69+
run: sudo apt install mingw-w64
70+
71+
- if: matrix.os == 'ubuntu-20.04' && matrix.type == 'linux' && matrix.freetype == true
72+
name: FreeType - Install
73+
run: sudo apt install libfreetype6-dev
74+
75+
- if: matrix.os == 'ubuntu-20.04' && matrix.type == 'win' && matrix.freetype == true
76+
name: FreeType - Download
77+
run: |
78+
sudo wget -O /freetype.tar.gz ${{ env.FREETYPE_URL }}
79+
sudo mkdir /freetype
80+
sudo tar -xzf /freetype.tar.gz -C /freetype --strip-components=1
81+
82+
- if: matrix.os == 'ubuntu-20.04' && matrix.type == 'win' && matrix.freetype == true
83+
name: FreeType - Compile & Install
84+
working-directory: /freetype
85+
run: |
86+
sudo ./configure --with-zlib=no --with-bzip2=no --with-png=no --with-harfbuzz=no --with-brotli=no --host=x86_64-w64-mingw32 --prefix=/usr/x86_64-w64-mingw32
87+
sudo make
88+
sudo make install
89+
90+
- name: Build
6091
uses: eskatos/gradle-command-action@v1
6192
with:
62-
arguments: :imgui-binding:generateLibs -Denvs=${{ matrix.type }}
63-
- name: Check [${{ matrix.expected }}]
64-
uses: andstor/file-existence-action@v1
93+
arguments: :imgui-binding:generateLibs -Denvs=${{ matrix.type }} -Dfreetype=${{ matrix.freetype }}
94+
95+
- name: Upload Native
96+
uses: actions/upload-artifact@v2
6597
with:
66-
files: ${{ matrix.expected }}
98+
name: ${{ matrix.freetype && matrix.libNameFt || matrix.libName }}
99+
path: ${{ matrix.expected }}
100+
if-no-files-found: error

buildSrc/scripts/build-ft-local.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
BASEDIR=$(dirname "$0")
44
cd $BASEDIR/../../imgui-binding || exit
55

6-
../gradlew clean generateLibs -Denvs=$* -Dlocal -Dfreetype
6+
../gradlew clean generateLibs -Denvs=$* -Dlocal -Dfreetype=true
77
rm -frd libsNative

buildSrc/scripts/build-ft.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ BASEDIR=$(dirname "$0")
44
cd $BASEDIR/../../imgui-binding || exit
55

66
rm -frd /tmp/imgui
7-
../gradlew clean generateLibs -Denvs=$* -Dfreetype
7+
../gradlew clean generateLibs -Denvs=$* -Dfreetype=true

buildSrc/src/main/groovy/imgui/generate/GenerateLibs.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ class GenerateLibs extends DefaultTask {
1919
private final boolean forLinux = buildEnvs?.contains('linux')
2020
private final boolean forMac = buildEnvs?.contains('mac')
2121

22-
private final boolean isLocal = System.properties.containsKey("local")
23-
private final boolean withFreeType = System.properties.containsKey("freetype")
22+
private final boolean isLocal = System.properties.containsKey('local')
23+
private final boolean withFreeType = Boolean.valueOf(System.properties.getProperty('freetype', 'false'))
2424

2525
private final String sourceDir = project.file('src/main/java')
2626
private final String classpath = project.file('build/classes/java/main')

0 commit comments

Comments
 (0)