Enable linux-arm64 in CI

Signed-off-by: Mary Guillemard <mary@mary.zone>
This commit is contained in:
Mary Guillemard 2024-02-06 20:44:23 +01:00
parent 275e67ad11
commit 2402c1a0db
3 changed files with 55 additions and 8 deletions

View file

@ -18,14 +18,18 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
platform: platform:
- { name: win-x64, os: windows-latest, arch: x64 } - { name: win-x64, os: windows-latest, arch: x64 }
- { name: win-x86, os: windows-latest, arch: Win32 } # - { name: win-x86, os: windows-latest, arch: Win32 }
- { name: win-arm64, os: windows-latest, arch: ARM64 } - { name: win-arm64, os: windows-latest, arch: ARM64 }
- { name: linux-x64, os: ubuntu-20.04, arch: amd64 } - { name: linux-x64, os: ubuntu-20.04, arch: amd64 }
- { name: linux-x86, os: ubuntu-20.04, arch: i386 } # - { name: linux-x86, os: ubuntu-20.04, arch: i386 }
- { name: osx-x64, os: macos-latest, arch: x86_64} - { name: linux-arm64, os: ubuntu-20.04, arch: arm64 }
- { name: osx-arm64, os: macos-latest, arch: arm64 } - { name: osx-x64, os: macos-latest, arch: x86_64 }
- { name: osx-arm64, os: macos-latest, arch: arm64 }
steps: steps:
- name: Setup qemu static
uses: docker/setup-qemu-action@v3
if: runner.os == 'Linux'
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
repository: Ryujinx/SDL repository: Ryujinx/SDL
@ -34,7 +38,7 @@ jobs:
with: with:
path: 'SDL2-CS' path: 'SDL2-CS'
- name: Build and prepare release - name: Build and prepare release
run: SDL2-CS/ci/build.sh $PWD SDL2-CS/native/${{ matrix.platform.name }} ${{ matrix.platform.arch }} run: SDL2-CS/ci/run.sh $PWD $PWD/SDL2-CS/native/${{ matrix.platform.name }} ${{ matrix.platform.arch }}
shell: bash shell: bash
- name: Upload artifacts - name: Upload artifacts
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3

View file

@ -97,6 +97,8 @@ cmake -B build -DCMAKE_BUILD_TYPE=Release -DSDL_SHARED_ENABLED_BY_DEFAULT=ON -DS
cmake --build build/ --config Release cmake --build build/ --config Release
$SUDO cmake --install build/ --prefix install_output --config Release $SUDO cmake --install build/ --prefix install_output --config Release
mkdir -p $output_path
if [[ $system_name == "linux" ]]; then if [[ $system_name == "linux" ]]; then
cp install_output/lib/libSDL2-2.0.so.0 $output_path/libSDL2.so cp install_output/lib/libSDL2-2.0.so.0 $output_path/libSDL2.so
elif [[ $system_name == "macos" ]]; then elif [[ $system_name == "macos" ]]; then

41
ci/run.sh Executable file
View file

@ -0,0 +1,41 @@
#!/bin/bash
set -e
if [ "$#" -le 2 ]; then
echo "usage: <sdl_dir> <output_path> <build_arch>"
exit 1
fi
uname_system="$(uname -s)"
case "${uname_system}" in
Linux*) system_name=linux;;
Darwin*) system_name=macos;;
CYGWIN*) system_name=win;;
MINGW*) system_name=win;;
*) system_name="Unknown OS: ${uname_system}"
esac
sdl_dir=$1
output_path=$2
build_arch=$3
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
mkdir -p $output_path
if [ $system_name == "linux" ] && [ $build_arch == "arm64" ]; then
if command -v podman &> /dev/null; then
DOCKER=podman
elif command -v docker &> /dev/null; then
DOCKER=docker
else
echo "ERROR - Missing docker/podman env, cannot crossbuild"
exit 1
fi
$DOCKER run --rm -v $SCRIPT_DIR:/scripts -v $output_path:/output -v $sdl_dir:/source -t arm64v8/ubuntu:focal bash /scripts/compile.sh /source /output $build_arch
else
$SCRIPT_DIR/compile.sh "$sdl_dir" "$output_path" "$build_arch"
fi