os: osx
osx_image: xcode10.1
  
install:
  - brew unlink gettext && brew link --force gettext
  - HOMEBREW_NO_AUTO_UPDATE=1 brew install ccache glew sdl2 sdl2_image sdl2_mixer sdl2_ttf icu4c

before_script:
  - >
    if [ "$TRAVIS_OS_NAME" = osx ]; then \
      # icu4c cannot be forced
      export ICU_ROOT="$(brew --prefix icu4c)" && \
      # add ccache and gettext to the PATH variable
      export PATH="/usr/local/opt/ccache/libexec:/usr/local/opt/gettext/bin:$PATH" && \
      # Fix opengl path
      mkdir -p /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks && \
      ln -s /System/Library/Frameworks/OpenGL.framework /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/OpenGL.framework; \
    fi

branches:
  only:
    - master

cache: ccache

jobs:
    - name: "RELEASE: Xcode 10.1"
      env: BUILD_TYPE=Release BUILD_TRANSLATIONS=ON BUILD_WEBSITE_TOOLS=ON

    - name: "DEBUG: Xcode 10.1"
      env: BUILD_TYPE=Debug BUILD_TRANSLATIONS=ON BUILD_WEBSITE_TOOLS=ON

language: cpp

script:
  - >
    mkdir build && cd build && cmake .. -DCMAKE_BUILD_TYPE:STRING=$BUILD_TYPE -DOPTION_BUILD_TRANSLATIONS=$BUILD_TRANSLATIONS -DOPTION_BUILD_WEBSITE_TOOLS=$BUILD_WEBSITE_TOOLS -DOPTION_ASAN="OFF" -DOPTION_BUILD_CODECHECK="OFF" -DCMAKE_EXE_LINKER_FLAGS="-L/usr/local/opt/gettext/lib -lintl" -DCMAKE_CXX_FLAGS="-I/usr/local/opt/gettext/include" && make -k -j3
