diff --git a/.github/cmake/aarch64-w64-mingw32.cmake b/.github/cmake/aarch64-w64-mingw32.cmake new file mode 100644 index 000000000..1aa89cec9 --- /dev/null +++ b/.github/cmake/aarch64-w64-mingw32.cmake @@ -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) diff --git a/.github/scripts/build-libjpeg-turbo.sh b/.github/scripts/build-libjpeg-turbo.sh new file mode 100755 index 000000000..fd92bc8e9 --- /dev/null +++ b/.github/scripts/build-libjpeg-turbo.sh @@ -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!' diff --git a/.github/scripts/test-libjpeg-turbo.ps1 b/.github/scripts/test-libjpeg-turbo.ps1 new file mode 100644 index 000000000..ffb0ba1f0 --- /dev/null +++ b/.github/scripts/test-libjpeg-turbo.ps1 @@ -0,0 +1 @@ +echo 'Success!' \ No newline at end of file diff --git a/.github/workflows/advanced.yml b/.github/workflows/advanced.yml index 813978658..58c9e84d0 100644 --- a/.github/workflows/advanced.yml +++ b/.github/workflows/advanced.yml @@ -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