name: iOS

on:
  push:
  pull_request:

jobs:
  build:
    runs-on: macos-latest
    steps:
      - uses: actions/checkout@master

      - name: Checkout submodules
        run: git submodule update --init --recursive

      - name: Configure
        run: |
          mkdir build-ios
          cd build-ios
          cmake .. \
            -GXcode \
            -DCMAKE_TOOLCHAIN_FILE=../hello_imgui_cmake/ios-cmake/ios.toolchain.cmake \
            -DHELLOIMGUI_USE_SDL2=ON -DHELLOIMGUI_HAS_OPENGL3=ON \
            -DHELLOIMGUI_FREETYPE_STATIC=ON \
            -DPLATFORM=SIMULATOR64

      - name: Build for simulator
        working-directory: build-ios
        run: |
          xcodebuild -configuration Release -project hello-imgui.xcodeproj -target ALL_BUILD -arch x86_64 -sdk iphonesimulator
