CI: Match SDL across platforms and centralize versions (#383)

This commit is contained in:
David Chavez 2024-06-09 01:42:15 +02:00 committed by GitHub
parent 2607c8098f
commit 0e31d3b582
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 24 additions and 7 deletions

View File

@ -1,6 +1,15 @@
name: validate name: validate
on: on:
workflow_call: workflow_call:
inputs:
SDL2_VERSION:
type: string
required: false
default: '2.28.5'
N64RECOMP_COMMIT:
type: string
required: false
default: '2a2df89349ff25a3afb3a09617deb3a166efe2f3'
secrets: secrets:
ZRE_REPO_WITH_PAT: ZRE_REPO_WITH_PAT:
required: true required: true
@ -37,9 +46,9 @@ jobs:
# Enable ccache # Enable ccache
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
wget https://github.com/libsdl-org/SDL/releases/download/release-2.26.1/SDL2-2.26.1.tar.gz wget https://github.com/libsdl-org/SDL/releases/download/release-${{ inputs.SDL2_VERSION }}/SDL2-${{ inputs.SDL2_VERSION }}.tar.gz
tar -xzf SDL2-2.26.1.tar.gz tar -xzf SDL2-${{ inputs.SDL2_VERSION }}.tar.gz
cd SDL2-2.26.1 cd SDL2-${{ inputs.SDL2_VERSION }}
./configure ./configure
make -j 10 make -j 10
sudo make install sudo make install
@ -54,7 +63,7 @@ jobs:
run: | run: |
git clone https://github.com/Mr-Wiseguy/N64Recomp.git --recurse-submodules N64RecompSource git clone https://github.com/Mr-Wiseguy/N64Recomp.git --recurse-submodules N64RecompSource
cd N64RecompSource cd N64RecompSource
git checkout 2a2df89349ff25a3afb3a09617deb3a166efe2f3 git checkout ${{ inputs.N64RECOMP_COMMIT }}
git submodule update --init --recursive git submodule update --init --recursive
# enable ccache # enable ccache
@ -128,7 +137,7 @@ jobs:
run: | run: |
git clone https://github.com/Mr-Wiseguy/N64Recomp.git --recurse-submodules N64RecompSource git clone https://github.com/Mr-Wiseguy/N64Recomp.git --recurse-submodules N64RecompSource
cd N64RecompSource cd N64RecompSource
git checkout 2a2df89349ff25a3afb3a09617deb3a166efe2f3 git checkout ${{ inputs.N64RECOMP_COMMIT }}
git submodule update --init --recursive git submodule update --init --recursive
# enable ccache # enable ccache
@ -158,6 +167,8 @@ jobs:
cmake -DCMAKE_BUILD_TYPE=${{ matrix.type }} -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_C_COMPILER=clang-cl -DCMAKE_MAKE_PROGRAM=ninja -G Ninja -S . -B cmake-build -DCMAKE_CXX_FLAGS="-Xclang -fexceptions -Xclang -fcxx-exceptions" cmake -DCMAKE_BUILD_TYPE=${{ matrix.type }} -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_C_COMPILER=clang-cl -DCMAKE_MAKE_PROGRAM=ninja -G Ninja -S . -B cmake-build -DCMAKE_CXX_FLAGS="-Xclang -fexceptions -Xclang -fcxx-exceptions"
cmake --build cmake-build --config ${{ matrix.type }} --target Zelda64Recompiled -j $cpuCores cmake --build cmake-build --config ${{ matrix.type }} --target Zelda64Recompiled -j $cpuCores
env:
SDL2_VERSION: ${{ inputs.SDL2_VERSION }}
- name: Prepare Archive - name: Prepare Archive
run: | run: |
Move-Item -Path "cmake-build/Zelda64Recompiled.exe" -Destination "Zelda64Recompiled.exe" Move-Item -Path "cmake-build/Zelda64Recompiled.exe" -Destination "Zelda64Recompiled.exe"

View File

@ -179,11 +179,17 @@ endif()
if (WIN32) if (WIN32)
include(FetchContent) include(FetchContent)
if (DEFINED ENV{SDL2_VERSION})
set(SDL2_VERSION $ENV{SDL2_VERSION})
else()
set(SDL2_VERSION "2.28.5")
endif()
# Fetch SDL2 on windows # Fetch SDL2 on windows
FetchContent_Declare( FetchContent_Declare(
sdl2 sdl2
URL https://github.com/libsdl-org/SDL/releases/download/release-2.28.5/SDL2-devel-2.28.5-VC.zip URL https://github.com/libsdl-org/SDL/releases/download/release-${SDL2_VERSION}/SDL2-devel-${SDL2_VERSION}-VC.zip
URL_HASH MD5=d8173db078e54040c666f411c5a6afff
) )
FetchContent_MakeAvailable(sdl2) FetchContent_MakeAvailable(sdl2)
target_include_directories(Zelda64Recompiled PRIVATE target_include_directories(Zelda64Recompiled PRIVATE