name: "Win_Mac_Linux"

# Test that a default build works with no specific option on all desktop platforms

on:
  workflow_dispatch:
  pull_request:
  push:


jobs:
  build:
    name: Cpp
    runs-on: ${{ matrix.platform }}
    strategy:
      fail-fast: false
      matrix:
        platform: [windows-latest, macos-latest, ubuntu-latest]
        window_backend: [ Glfw, Sdl ]

    steps:
      - uses: actions/checkout@v4
        with:
          submodules: true

      - name: apt install xorg-dev libglfw3-dev libsdl2-dev libfreetype-dev (ubuntu only)
        if: ${{ matrix.platform == 'ubuntu-latest' }}
        run: sudo apt-get update && sudo apt-get install -y xorg-dev  libglfw3-dev libsdl2-dev libfreetype-dev

      - name: Build and install
        shell: bash
        run: |
          mkdir build
          cd build
          if [ "${{ matrix.window_backend }}" = "Sdl" ]; then
            cmake .. -DHELLOIMGUI_USE_SDL2=ON -DHELLOIMGUI_HAS_OPENGL3=ON -DHELLOIMGUI_DOWNLOAD_FREETYPE_IF_NEEDED=ON -DCMAKE_BUILD_TYPE=Release
          fi
          if [ "${{ matrix.window_backend }}" = "Glfw" ]; then
            cmake .. -DHELLOIMGUI_DOWNLOAD_FREETYPE_IF_NEEDED=ON -DCMAKE_BUILD_TYPE=Release
          fi
          cmake --build . -j 3
