Skip to content

Commit

Permalink
Add libjpeg-turbo build and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Blackhex committed Nov 21, 2023
1 parent 16d9552 commit bcedddb
Show file tree
Hide file tree
Showing 4 changed files with 119 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .github/cmake/aarch64-w64-mingw32.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
set(CMAKE_SYSTEM_NAME Windows)
set(CMAKE_SYSTEM_PROCESSOR ARM64)
set(CMAKE_C_COMPILER aarch64-w64-mingw32-gcc)
set(CMAKE_CXX_COMPILER aarch64-w64-mingw32-g++)
set(CMAKE_RC_COMPILER aarch64-w64-mingw32-windres)
set(CMAKE_RANLIB aarch64-w64-mingw32-ranlib)
set(CMAKE_AR aarch64-w64-mingw32-ar)
44 changes: 44 additions & 0 deletions .github/scripts/build-libjpeg-turbo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash

LIBJPEG_TURBO_VERSION=${LIBJPEG_TURBO_VERSION:-libjpeg-turbo-main}

set -e # exit on error
set -x # echo on

TARGET=${TARGET:-aarch64-w64-mingw32}
SOURCES_PATH=${SOURCES_PATH:-$PWD/code}
TOOLCHAIN_PATH=${INSTALL_PATH:-~/cross}
TOOLCHAIN_FILE=${TOOLCHAIN_FILE:-$PWD/.github/cmake/$TARGET.cmake}
BUILD_PATH=${BUILD_PATH:-$PWD/build-$TARGET}
BUILD_MAKE_OPTIONS=-j$(nproc)
INSTALL_PATH=${INSTALL_PATH:-~/libjpeg-turbo}
RUN_CONFIG=${RUN_CONFIG:-1}
RUN_INSTALL=${RUN_INSTALL:-1}

export PATH=$TOOLCHAIN_PATH/bin:$PATH

cd $SOURCES_PATH/$LIBJPEG_TURBO_VERSION

if [ $RUN_CONFIG = 1 ] ; then
echo "::group::Configure libjpeg-turbo"

rm -f $BUILD_PATH/libjpeg-turbo/CMakeCache.txt

cmake -G"Unix Makefiles" \
-DCMAKE_INSTALL_PREFIX=$INSTALL_PATH \
-DCMAKE_TOOLCHAIN_FILE=$TOOLCHAIN_FILE \
-B$BUILD_PATH/libjpeg-turbo
echo "::endgroup::"
fi

echo "::group::Build libjpeg-turbo"
cmake --build $BUILD_PATH/libjpeg-turbo $BUILD_MAKE_OPTIONS
echo "::endgroup::"

if [ $RUN_INSTALL = 1 ] ; then
echo "::group::Install libjpeg-turbo"
cmake --install $BUILD_PATH/libjpeg-turbo
echo "::endgroup::"
fi

echo 'Success!'
1 change: 1 addition & 0 deletions .github/scripts/test-libjpeg-turbo.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
echo 'Success!'
67 changes: 67 additions & 0 deletions .github/workflows/advanced.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,76 @@ jobs:
run: |
.github/scripts/build-gcc-libs.sh
- name: Pack artifact
run: |
tar cf ${{ env.TARGET }}-${{ env.CRT }}-toolchain.tar ${{ env.INSTALL_PATH }}/*
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: ${{ env.TARGET }}-${{ env.CRT }}-toolchain
path: ${{ env.TARGET }}-${{ env.CRT }}-toolchain.tar
retention-days: 1

build-libjpeg-turbo:
needs: [build-toolchain]
runs-on: ubuntu-latest

env:
LIBJPEG_TURBO_REPO: libjpeg-turbo/libjpeg-turbo
LIBJPEG_TURBO_BRANCH: main
LIBJPEG_TURBO_VERSION: libjpeg-turbo-main
TOOLCHAIN_PATH: ${{ github.workspace }}/cross
INSTALL_PATH: ${{ github.workspace }}/libjpeg-turbo

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
path: ${{ github.workspace }}

- name: Checkout libjpeg-turbo
uses: actions/checkout@v4
with:
repository: ${{ env.LIBJPEG_TURBO_REPO }}
ref: ${{ env.LIBJPEG_TURBO_BRANCH }}
path: ${{ github.workspace }}/code/${{ env.LIBJPEG_TURBO_VERSION }}

- name: Download toolchain
uses: actions/download-artifact@v3
with:
name: aarch64-w64-mingw32-msvcrt-toolchain
path: ${{ github.workspace }}

- name: Unpack artifact
run: |
mkdir -p ${{ env.TOOLCHAIN_PATH }}
tar xf aarch64-w64-mingw32-msvcrt-toolchain.tar -C ${{ env.TOOLCHAIN_PATH }}
ls -al ${{ env.TOOLCHAIN_PATH }}
ls -al ${{ env.TOOLCHAIN_PATH }}/bin
- name: Build libjpeg-turbo
run: |
.github/scripts/build-libjpeg-turbo.sh
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: aarch64-w64-mingw32-msvcrt-libjpeg-turbo
path: ${{ env.INSTALL_PATH }}
retention-days: 1

test-libpeg-turbo:
needs: [build-libjpeg-turbo]
runs-on: [Windows, GCC, ARM64]

steps:
- name: Download libjpeg-turbo
uses: actions/download-artifact@v3
with:
name: aarch64-w64-mingw32-msvcrt-libjpeg-turbo
path: ${{ github.workspace }}

- name: Test libjpeg-turbo
run: |
.github/scripts/test-libjpeg-turbo.ps1

0 comments on commit bcedddb

Please sign in to comment.