CI: Add MinGW builds with SDL

This commit is contained in:
sfan5 2023-09-13 13:17:24 +02:00
parent dc43583a2c
commit f9d7a632f5
2 changed files with 24 additions and 11 deletions

@ -138,18 +138,16 @@ jobs:
LIBGL_ALWAYS_SOFTWARE=true xvfb-run ./AutomatedTest ogles2 LIBGL_ALWAYS_SOFTWARE=true xvfb-run ./AutomatedTest ogles2
mingw: mingw:
name: MinGW ${{matrix.config.arch}} name: "MinGW ${{matrix.config.variant}}${{matrix.config.extras}}"
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
config: config:
- - {variant: win32, arch: i686}
bits: 32 - {variant: win64, arch: x86_64}
arch: i686 - {variant: win32, arch: i686, extras: "-sdl"}
- - {variant: win64, arch: x86_64, extras: "-sdl"}
bits: 64
arch: x86_64
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Install compiler - name: Install compiler
@ -164,11 +162,12 @@ jobs:
env: env:
CC: ${{matrix.config.arch}}-w64-mingw32-gcc CC: ${{matrix.config.arch}}-w64-mingw32-gcc
CXX: ${{matrix.config.arch}}-w64-mingw32-g++ CXX: ${{matrix.config.arch}}-w64-mingw32-g++
extras: ${{matrix.config.extras}}
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v3
with: with:
name: irrlicht-win${{matrix.config.bits}} name: irrlicht-${{matrix.config.variant}}${{matrix.config.extras}}
path: ./irrlicht-win${{matrix.config.bits}}.zip path: ./irrlicht-${{matrix.config.variant}}${{matrix.config.extras}}.zip
macos: macos:
runs-on: macos-latest runs-on: macos-latest

@ -4,9 +4,14 @@
variant=win32 variant=win32
[[ "$(basename "$CXX")" == "x86_64-"* ]] && variant=win64 [[ "$(basename "$CXX")" == "x86_64-"* ]] && variant=win64
with_sdl=0
[[ "$extras" == *"-sdl"* ]] && with_sdl=1
#with_gl3=0
#[[ "$extras" == *"-gl3"* ]] && with_gl3=1
libjpeg_version=2.1.5.1 libjpeg_version=2.1.5.1
libpng_version=1.6.39 libpng_version=1.6.39
sdl2_version=2.28.1
zlib_version=1.2.13 zlib_version=1.2.13
mkdir -p libs mkdir -p libs
@ -16,10 +21,13 @@ libs=$PWD
wget "http://minetest.kitsunemimi.pw/libjpeg-$libjpeg_version-$variant.zip" -O libjpeg.zip wget "http://minetest.kitsunemimi.pw/libjpeg-$libjpeg_version-$variant.zip" -O libjpeg.zip
[ -e libpng.zip ] || \ [ -e libpng.zip ] || \
wget "http://minetest.kitsunemimi.pw/libpng-$libpng_version-$variant.zip" -O libpng.zip wget "http://minetest.kitsunemimi.pw/libpng-$libpng_version-$variant.zip" -O libpng.zip
[[ $with_sdl -eq 0 || -e sdl2.zip ]] || \
wget "http://minetest.kitsunemimi.pw/sdl2-$sdl2_version-$variant.zip" -O sdl2.zip
[ -e zlib.zip ] || \ [ -e zlib.zip ] || \
wget "http://minetest.kitsunemimi.pw/zlib-$zlib_version-$variant.zip" -O zlib.zip wget "http://minetest.kitsunemimi.pw/zlib-$zlib_version-$variant.zip" -O zlib.zip
[ -d libjpeg ] || unzip -o libjpeg.zip -d libjpeg [ -d libjpeg ] || unzip -o libjpeg.zip -d libjpeg
[ -d libpng ] || unzip -o libpng.zip -d libpng [ -d libpng ] || unzip -o libpng.zip -d libpng
[[ $with_sdl -eq 0 || -d sdl2 ]] || unzip -o sdl2.zip -d sdl2
[ -d zlib ] || unzip -o zlib.zip -d zlib [ -d zlib ] || unzip -o zlib.zip -d zlib
popd popd
@ -32,6 +40,11 @@ tmp=(
-DZLIB_LIBRARY=$libs/zlib/lib/libz.dll.a \ -DZLIB_LIBRARY=$libs/zlib/lib/libz.dll.a \
-DZLIB_INCLUDE_DIR=$libs/zlib/include -DZLIB_INCLUDE_DIR=$libs/zlib/include
) )
[ $with_sdl -eq 1 ] && tmp+=(
-DUSE_SDL2=ON
-DCMAKE_PREFIX_PATH=$libs/sdl2/lib/cmake
)
#[ $with_gl3 -eq 1 ] && tmp+=(-DENABLE_OPENGL=OFF -DENABLE_OPENGL3=ON)
cmake . "${tmp[@]}" cmake . "${tmp[@]}"
make -j$(nproc) make -j$(nproc)
@ -41,8 +54,9 @@ if [ "$1" = "package" ]; then
# strip library # strip library
"${CXX%-*}-strip" --strip-unneeded _install/usr/local/lib/*.dll "${CXX%-*}-strip" --strip-unneeded _install/usr/local/lib/*.dll
# bundle the DLLs that are specific to Irrlicht (kind of a hack) # bundle the DLLs that are specific to Irrlicht (kind of a hack)
cp -p $libs/*/bin/lib{jpeg,png}*.dll _install/usr/local/lib/ shopt -s nullglob
cp -p $libs/*/bin/{libjpeg,libpng,SDL}*.dll _install/usr/local/lib/
# create a ZIP # create a ZIP
(cd _install/usr/local; zip -9r "$OLDPWD"/irrlicht-$variant.zip -- *) (cd _install/usr/local; zip -9r "$OLDPWD/irrlicht-$variant$extras.zip" -- *)
fi fi
exit 0 exit 0