sudo: false

language: cpp

# Build with gcc and clang.
compiler:
  - gcc
  - clang

# Build both debug and release configurations, through use of an environment variable in the build matrix.
env:
  - BUILD_TYPE=debug CMAKE_BUILD_TYPE=Debug
  - BUILD_TYPE=release CMAKE_BUILD_TYPE=Release

addons:
  apt:
    packages:
      - libsdl2-dev

install:
  - wget https://github.com/premake/premake-core/releases/download/v5.0.0-alpha12/premake-5.0.0-alpha12-linux.tar.gz -O premake.tar.gz
  - tar -xf premake.tar.gz
  - rm premake.tar.gz

# Run premake to generate makefiles.
# Have to cd into directory and back out since premake5 doesn't appear to accept a directory argument.
before_script:
  - cd RecastDemo && ../premake5 gmake && cd ..
  - mkdir build && cd build && cmake -D CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} .. && cd ..

# Run make in the directory containing generated makefiles, on the configuration specified by the environment variable.
script:
  - make -C RecastDemo/Build/gmake -j$(nproc) config=${BUILD_TYPE}
  - RecastDemo/Bin/Tests
  - make -C build -j$(nproc)
  - cd build && ctest
