# Optimize git clone git: depth: 5 # No need for sudo sudo: false # Bionic is the most recent version of Ubuntu I can get to work properly dist: bionic # Enable C++ language support language: cpp # Cache compiled object files with ccache cache: ccache osx_image: xcode11.2 compiler: - gcc - clang os: - linux - osx addons: apt: sources: - sourceline: 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-9 main' key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key' - sourceline: 'ppa:ubuntu-toolchain-r/test' packages: - clang-9 - cmake - gcc-9 - g++-9 homebrew: packages: - cmake - gcc@9 - llvm@9 update: true env: - BUILD_TYPE=Debug - BUILD_TYPE=RelWithDebInfo before_install: # Display available disk space - df -h # Display Travis OS name - echo $TRAVIS_OS_NAME # Display build type - echo $BUILD_TYPE # The following Homebrew packages aren't linked by default, and need to be prepended to the path explicitly. - if [ "$TRAVIS_OS_NAME" = "osx" ]; then export PATH="$(brew --prefix llvm)/bin:$PATH"; fi # /usr/bin/gcc points to an older compiler on both Linux and macOS. - if [ "$CXX" = "g++" ]; then export CXX="g++-9" CC="gcc-9"; fi # /usr/bin/clang points to an older compiler on both Linux and macOS. # # Homebrew's llvm package doesn't ship a versioned clang++ binary, so the values # below don't work on macOS. Fortunately, the path change above makes the # default values (clang and clang++) resolve to the correct compiler on macOS. - if [ "$TRAVIS_OS_NAME" = "linux" ]; then if [ "$CXX" = "clang++" ]; then export CXX="clang++-9" CC="clang-9"; fi; fi # Display compilers/cmake name/version - echo ${CC} - echo ${CXX} - ${CC} --version - ${CXX} --version - cmake --version install: # Get number of cores (or 2 by default if somehow none of these are available somehow) - JOBS=$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || getconf _NPROCESSORS_ONLN 2>/dev/null || echo 2) - echo $JOBS # Recommanded build directory - CMAKE_BUILD_DIR=build # Install ccache on OSX - | if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then # This is OSX brew install ccache export PATH="/usr/local/opt/ccache/libexec:$PATH" fi # Install required libraries - mkdir travisLibs && cd travisLibs # Install modern SDL2 - SDL2_VERSION=2.0.10 - | travis_retry curl -L https://www.libsdl.org/release/SDL2-${SDL2_VERSION}.tar.gz | tar xz cd SDL2-${SDL2_VERSION} ./configure make -j ${JOBS} sudo make install -j ${JOBS} cd .. # Finished installing required libraries - cd .. before_script: # Make build directory and generate CMake build files - mkdir -p ${CMAKE_BUILD_DIR} && cd ${CMAKE_BUILD_DIR} - cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DFIX_BUGS=ON -DWARNINGS=ON -DALL_WARNINGS=ON script: # CMake build - cmake --build . --config ${BUILD_TYPE} --parallel ${JOBS} # Make build - cd .. - make -j ${JOBS} FIX_BUGS=1 RELEASE=1 WARNINGS=1 ALL_WARNINGS=1 - cd ${CMAKE_BUILD_DIR}