.travis.yml
author Simon McVittie <smcv@debian.org>
Mon, 12 Sep 2022 10:40:53 -0400
branch1.0.0
changeset 15859 7b1d6dfa3173
parent 14924 58070c3dd043
child 15453 f28016c508c0
permissions -rw-r--r--
Remove FindSDL2 find-module, use sdl2-config.cmake instead This requires SDL >= 2.0.4. Since <https://bugzilla.libsdl.org/show_bug.cgi?id=2464> was fixed in SDL 2.0.4, SDL behaves as a CMake "config-file package", even if it was not itself built using CMake: it installs a sdl2-config.cmake file to ${libdir}/cmake/SDL2, which tells CMake where to find SDL's headers and library, analogous to a pkg-config .pc file. As a result, we no longer need to copy/paste a "find-module package" to be able to find a system copy of SDL >= 2.0.4 with find_package(SDL2). Find-module packages are now discouraged by the CMake developers, in favour of having upstream projects behave as config-file packages. This results in a small API change: FindSDL2 used to set SDL2_INCLUDE_DIR and SDL2_LIBRARY, but the standard behaviour for config-file packages is to set <name>_INCLUDE_DIRS and <name>_LIBRARIES. Use the CONFIG keyword to make sure we search in config-file package mode, and will not find a FindSDL2.cmake in some other directory that implements the old interface. In addition to deleting redundant code, this avoids some assumptions in FindSDL2 about the layout of a SDL installation. The current libsdl2-dev package in Debian breaks those assumptions; this is considered a bug and will hopefully be fixed soon, but it illustrates how fragile these assumptions can be. We can be more robust against different installation layouts by relying on SDL's own CMake integration. When linking to a copy of CMake in a non-standard location, users can now set the SDL2_DIR or CMAKE_PREFIX_PATH environment variable to point to it; previously, these users would have used the SDL2DIR environment variable. This continues to be unnecessary if using matching system-wide installations of CMake and SDL2, for example both from Debian.

sudo: required
dist: xenial
language: c
sudo: true
os:
  - linux
  - osx

branches:
  only:
    master

compiler:
  - gcc
  - clang

matrix:
  exclude:
    - os: osx
      compiler: gcc

env:
  - BUILD_ARGS="-DCMAKE_BUILD_TYPE=Release"
  - BUILD_ARGS="-DCMAKE_BUILD_TYPE=Debug"
  - BUILD_ARGS="-DNOSERVER=1 -DGL2=1 -DNOPNG=1"
  - BUILD_ARGS="-DNOSERVER=1 -DLUA_SYSTEM=0"

matrix:
  include:
  - language: c
    os: linux
    compiler: clang
    env: BUILD_ARGS="-DNOSERVER=1 -DBUILD_ENGINE_C=1"
  - language: c
    os: osx
    compiler: clang
    env: BUILD_ARGS="-DNOSERVER=1 -DBUILD_ENGINE_C=1"
  - language: c
    os: linux
    compiler: clang
    env: BUILD_ARGS="-DNOSERVER=1 -DBUILD_ENGINE_C=1 -DGL2=1"
  - language: c
    os: osx
    compiler: clang
    env: BUILD_ARGS="-DNOSERVER=1 -DBUILD_ENGINE_C=1 -DGL2=1"
  - language: objective-c
    sudo: required
    os: osx
    compiler: clang
    env: TRAVIS_OS_NAME="ios" SDL_LIB_PATH="$TRAVIS_BUILD_DIR/../Library"
    osx_image: xcode7.2

before_install: |
  if [ "$TRAVIS_OS_NAME" == "linux" ]; then
    sudo apt-get update -qq
  elif [ "$TRAVIS_OS_NAME" == "osx" ]; then
    brew update
  elif [ "$TRAVIS_OS_NAME" == "ios" ]; then
    hg clone http://hg.libsdl.org/SDL $SDL_LIB_PATH/SDL/
    hg clone http://hg.libsdl.org/SDL_image $SDL_LIB_PATH/SDL_image/
    hg clone http://hg.libsdl.org/SDL_net $SDL_LIB_PATH/SDL_net/
    hg clone http://hg.libsdl.org/SDL_ttf $SDL_LIB_PATH/SDL_ttf/
    hg clone http://hg.libsdl.org/SDL_mixer $SDL_LIB_PATH/SDL_mixer/
  fi

install: |
  if [ "$TRAVIS_OS_NAME" == "linux" ]; then
    sudo apt-get install -y debhelper cmake dpkg-dev qtbase5-dev qtbase5-private-dev qttools5-dev-tools qttools5-dev libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev libsdl2-image-dev libsdl2-net-dev bzip2 ghc libghc-mtl-dev libghc-vector-dev libghc-zlib-dev libghc-random-dev libghc-network-dev libghc-sandi-dev libghc-hslogger-dev libghc-utf8-string-dev libghc-sha-dev libghc-entropy-dev libghc-regex-tdfa-dev libghc-aeson-dev libghc-yaml-dev libghc-text-dev liblua5.1-0-dev fpc fp-compiler fp-units-misc libpng-dev fp-units-gfx libavcodec-dev libavformat-dev libglew1.6-dev

    # for xenial last availible version of libphysfs is 2.0.x, but we need >= 3.0
    # so... building from sources!
    wget https://icculus.org/physfs/downloads/physfs-3.0.1.tar.bz2
    tar -xjf physfs-3.0.1.tar.bz2
    mkdir physfs-3.0.1-build
    pushd physfs-3.0.1-build
    cmake ../physfs-3.0.1
    make
    sudo make install
    popd
  elif [ "$TRAVIS_OS_NAME" == "osx" ]; then
    brew install qt5
    brew install fpc glew physfs lua51 sdl2 sdl2_image sdl2_net sdl2_ttf ffmpeg ghc cabal-install
    brew install sdl2_mixer
    # use cabal install haskell deps, pas2c ones are covered by server
    if [[ "$BUILD_ARGS" != *"NOSERVER"* ]]; then
      cabal update
      cabal install --only-dependencies gameServer/hedgewars-server.cabal
    fi
    if [[ "$BUILD_ARGS" == *"BUILD_ENGINE_C"* ]]; then
      cabal update
      cabal install --only-dependencies tools/pas2c/pas2c.cabal
    fi
    # avoid installing Sparkle, add default unit path
    export BUILD_ARGS="$BUILD_ARGS -DNOAUTOUPDATE=1"
  elif [ "$TRAVIS_OS_NAME" == "ios" ]; then
    # FPC 3.0.0 required for using FPC 3.0.1 which contains rtl for ios
    sudo bash tools/dmg_pkg_install.sh ftp://freepascal.stack.nl/pub/mirrors/fpc/dist/3.0.0/i386-macosx/fpc-3.0.0.intel-macosx.dmg
    sudo bash tools/dmg_pkg_install.sh ftp://freepascal.stack.nl/pub/mirrors/fpc/dist/3.0.0/i386-macosx/fpc-3.0.1.intel-macosx.cross.ios.dmg
  fi

before_script: |
  if [ "$TRAVIS_OS_NAME" == "ios" ]; then
    # More or less stable hw iOS version can be compiled with FPC 3.1.1,
    # but there are no (easy?) way to build it from sources,
    # so we just temporary switch Xcode project to use FPC 3.0.1
    git apply tools/fix_fpc_ios_build_patch.diff
    xctool -project ./project_files/HedgewarsMobile/Hedgewars.xcodeproj -scheme UpdateDataFolder build
  else
    mkdir build && cd build && cmake $BUILD_ARGS ..
  fi

script: |
  if [ "$TRAVIS_OS_NAME" == "ios" ]; then
    xctool -project ./project_files/HedgewarsMobile/Hedgewars.xcodeproj -scheme Hedgewars -configuration Release build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO
  else
    make VERBOSE=1
  fi

after_success: |
  if [ "$TRAVIS_OS_NAME" == "linux" ]; then
    make test_verbose
  elif [ "$TRAVIS_OS_NAME" == "osx" ]; then
    make install
  fi

notifications:
  email: false
  irc:
    channels:
      - "chat.freenode.net#hedgewars"
    template:
      - "hw-build #%{build_number} (%{commit} by %{author}): %{message}"
      - "See details at %{build_url}"
    on_success: change
    on_failure: always
    skip_join: false