From 37bc815a062ea8055c9e51a684dc00c9c4a4718f Mon Sep 17 00:00:00 2001 From: SpaiR Date: Sun, 30 May 2021 16:11:19 +0300 Subject: [PATCH] [Build] Add FreeType support for CI --- .github/workflows/ci-build.yml | 74 ++++++++++++++----- buildSrc/scripts/build-ft-local.sh | 2 +- buildSrc/scripts/build-ft.sh | 2 +- .../groovy/imgui/generate/GenerateLibs.groovy | 4 +- 4 files changed, 58 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index d195a27..82ab2c2 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -4,63 +4,97 @@ jobs: build-java: strategy: matrix: - os: [ubuntu-latest, macos-latest] - name: Build Java [${{ matrix.os }}] + os: [ubuntu-20.04, macos-10.15] + name: Build Java runs-on: ${{ matrix.os }} steps: - name: Checkout repository uses: actions/checkout@v2 + - name: Set up Java 8 uses: actions/setup-java@v1 with: java-version: 8 + - name: Build uses: eskatos/gradle-command-action@v1 with: arguments: build build-natives: + env: + FREETYPE_URL: https://download.savannah.gnu.org/releases/freetype/freetype-2.10.4.tar.gz strategy: matrix: - os: [ubuntu-latest, macos-latest] + os: [ubuntu-20.04, macos-10.15] type: [win, linux, mac] + freetype: [true, false] include: - - os: ubuntu-latest - type: win + - type: win expected: /tmp/imgui/libsNative/windows64/imgui-java64.dll - - os: ubuntu-latest - type: linux + libName: imgui-java64.dll + libNameFt: imgui-java64-ft.dll + - type: linux expected: /tmp/imgui/libsNative/linux64/libimgui-java64.so - - os: macos-latest - type: mac + libName: libimgui-java64.so + libNameFt: libimgui-java64-ft.so + - type: mac expected: /tmp/imgui/libsNative/macosx64/libimgui-java64.dylib + libName: libimgui-java64.dylib + libNameFt: libimgui-java64-ft.dylib exclude: - - os: ubuntu-latest + - os: ubuntu-20.04 type: mac - - os: macos-latest + - os: macos-10.15 type: win - - os: macos-latest + - os: macos-10.15 type: linux - name: Build Natives [${{ matrix.os }}]-[${{ matrix.type }}] + name: Build Native (type=${{ matrix.type }}, freetype=${{ matrix.freetype }}) runs-on: ${{ matrix.os }} steps: - name: Checkout repository and submodules uses: actions/checkout@v2 with: submodules: recursive + - name: Set up Java 8 uses: actions/setup-java@v1 with: java-version: 8 + - name: Ant Version run: ant -version - - if: matrix.os == 'ubuntu-latest' + + - if: matrix.os == 'ubuntu-20.04' name: Install MinGW-w64/GCC/G++ - run: sudo apt-get install mingw-w64 gcc-multilib g++-multilib - - name: Build [${{ matrix.type }}] + run: sudo apt install mingw-w64 + + - if: matrix.os == 'ubuntu-20.04' && matrix.type == 'linux' && matrix.freetype == true + name: FreeType - Install + run: sudo apt install libfreetype6-dev + + - if: matrix.os == 'ubuntu-20.04' && matrix.type == 'win' && matrix.freetype == true + name: FreeType - Download + run: | + sudo wget -O /freetype.tar.gz ${{ env.FREETYPE_URL }} + sudo mkdir /freetype + sudo tar -xzf /freetype.tar.gz -C /freetype --strip-components=1 + + - if: matrix.os == 'ubuntu-20.04' && matrix.type == 'win' && matrix.freetype == true + name: FreeType - Compile & Install + working-directory: /freetype + run: | + 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 + sudo make + sudo make install + + - name: Build uses: eskatos/gradle-command-action@v1 with: - arguments: :imgui-binding:generateLibs -Denvs=${{ matrix.type }} - - name: Check [${{ matrix.expected }}] - uses: andstor/file-existence-action@v1 + arguments: :imgui-binding:generateLibs -Denvs=${{ matrix.type }} -Dfreetype=${{ matrix.freetype }} + + - name: Upload Native + uses: actions/upload-artifact@v2 with: - files: ${{ matrix.expected }} + name: ${{ matrix.freetype && matrix.libNameFt || matrix.libName }} + path: ${{ matrix.expected }} + if-no-files-found: error diff --git a/buildSrc/scripts/build-ft-local.sh b/buildSrc/scripts/build-ft-local.sh index abab948..7acbe0e 100644 --- a/buildSrc/scripts/build-ft-local.sh +++ b/buildSrc/scripts/build-ft-local.sh @@ -3,5 +3,5 @@ BASEDIR=$(dirname "$0") cd $BASEDIR/../../imgui-binding || exit -../gradlew clean generateLibs -Denvs=$* -Dlocal -Dfreetype +../gradlew clean generateLibs -Denvs=$* -Dlocal -Dfreetype=true rm -frd libsNative diff --git a/buildSrc/scripts/build-ft.sh b/buildSrc/scripts/build-ft.sh index 345d249..906f9c7 100644 --- a/buildSrc/scripts/build-ft.sh +++ b/buildSrc/scripts/build-ft.sh @@ -4,4 +4,4 @@ BASEDIR=$(dirname "$0") cd $BASEDIR/../../imgui-binding || exit rm -frd /tmp/imgui -../gradlew clean generateLibs -Denvs=$* -Dfreetype +../gradlew clean generateLibs -Denvs=$* -Dfreetype=true diff --git a/buildSrc/src/main/groovy/imgui/generate/GenerateLibs.groovy b/buildSrc/src/main/groovy/imgui/generate/GenerateLibs.groovy index a2e678c..a17895b 100644 --- a/buildSrc/src/main/groovy/imgui/generate/GenerateLibs.groovy +++ b/buildSrc/src/main/groovy/imgui/generate/GenerateLibs.groovy @@ -19,8 +19,8 @@ class GenerateLibs extends DefaultTask { private final boolean forLinux = buildEnvs?.contains('linux') private final boolean forMac = buildEnvs?.contains('mac') - private final boolean isLocal = System.properties.containsKey("local") - private final boolean withFreeType = System.properties.containsKey("freetype") + private final boolean isLocal = System.properties.containsKey('local') + private final boolean withFreeType = Boolean.valueOf(System.properties.getProperty('freetype', 'false')) private final String sourceDir = project.file('src/main/java') private final String classpath = project.file('build/classes/java/main')