name: Build

on: [push, pull_request]

jobs:
  Build:
    name: ${{ matrix.platform.name }}
    runs-on: ${{ matrix.platform.os }}
    strategy:
      matrix:
        platform:
        - { name: Windows, os: windows-latest }
        - { name: Linux,   os: ubuntu-20.04, flags: -GNinja }
        - { name: MacOS,   os: macos-latest }
    steps:
    - name: Setup Linux dependencies
      if: runner.os == 'Linux'
      run: |
        sudo apt-get update
        sudo apt-get install cmake ninja-build libgl1-mesa-dev libglu1-mesa-dev
    - name: Get sdl12-compat sources
      uses: actions/checkout@v2
    - name: Get SDL2 headers
      uses: actions/checkout@v2
      with:
        repository: libsdl-org/SDL
        ref: release-2.0.18
        path: SDL2
    - name: Configure CMake
      run: cmake -DSDL2_INCLUDE_DIR="${{ github.workspace }}/SDL2/include" -B build ${{ matrix.platform.flags }}
    - name: Build
      run: cmake --build build/
