Skip to content

tweak for native build #316

tweak for native build

tweak for native build #316

Workflow file for this run

# SDLBuild.yml
name: SDLBuild
env:
PROJECT_DIR: examples_for_PC/CMake_SDL
on:
push:
paths:
- '**.ino'
- '**.cpp'
- '**.hpp'
- '**.h'
- '**.c'
- '**SDLBuild.yml'
- '**SDL.cmake'
- '**installSDL2.bat'
pull_request:
workflow_dispatch:
jobs:
LGFX_SDL2:
name: LGFX_SDL2 (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
include:
- { os: windows-latest }
- { os: macos-12 }
- { os: ubuntu-latest }
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cache SDL2 for Windows
if: ${{ matrix.os == 'windows-latest' }}
uses: actions/cache@v3
id: cache-SLD2-windows
with:
path: contrib
key: ${{ runner.os }}-${{ hashFiles('.github/scripts/installSDL2.bat') }}
- name: Build SDL2 for Windows
if: matrix.os == 'windows-latest' && steps.cache-SLD2-windows.outputs.cache-hit != 'true'
run: |
.github/scripts/installSDL2.bat
- name: Build LGFX_SDL2 for Windows
if: ${{ matrix.os == 'windows-latest' }}
env:
CC: clang
CXX: clang++
SDL2_DIR: D:/a/LovyanGFX/LovyanGFX/contrib/src/SDL2-2.0.22/install
run: |
cp .github/scripts/SDL.cmake ${{ env.PROJECT_DIR }}/CMakeLists.txt
cd ${{ env.PROJECT_DIR }}
cmake -S . -B build/debug -G "Visual Studio 17 2022" -A x64 -T ClangCL -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }}
cmake --build build/debug --config Debug
cmake -S . -B build/release -G "Visual Studio 17 2022" -A x64 -T ClangCL -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }}
cmake --build build/release --config Release
- name: Build LGFX_SDL2 for Linux
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
sudo apt update
sudo apt-get install libsdl2-dev
cp .github/scripts/SDL.cmake ${{ env.PROJECT_DIR }}/CMakeLists.txt
cd ${{ env.PROJECT_DIR }}
mkdir build
cd build
cmake ..
cmake --build .
- name: Build LGFX_SDL2 for Mac
if: ${{ matrix.os == 'macos-12' }}
run: |
brew install sdl2
cp .github/scripts/SDL.cmake ${{ env.PROJECT_DIR }}/CMakeLists.txt
cd ${{ env.PROJECT_DIR }}
mkdir build
cd build
cmake ..
cmake --build .