language: c
compiler:
  - gcc
  - clang
sudo: false
env:
  - TORCH_LUA_VERSION=LUAJIT21
  - TORCH_LUA_VERSION=LUA51
  - TORCH_LUA_VERSION=LUA52
addons:
  apt:
    packages:
    - cmake
    - gcc-multilib
    - build-essential
    - gcc
    - g++
    - curl
    - cmake
    - libreadline-dev
    - git-core
    - ncurses-dev
    - unzip
before_script:
- export ROOT_TRAVIS_DIR=$(pwd)
- export INSTALL_PREFIX=~/torch/install
- git clone https://github.com/torch/distro.git ~/torch --recursive
- cd ~/torch && git submodule update --init --recursive
- mkdir build && cd build
- cmake .. -DCMAKE_INSTALL_PREFIX="${INSTALL_PREFIX}" -DCMAKE_BUILD_TYPE=Release -DWITH_${TORCH_LUA_VERSION}=ON
- make && make install
- cd $ROOT_TRAVIS_DIR
- export LD_LIBRARY_PATH=${INSTALL_PREFIX}/lib:$LD_LIBRARY_PATH
script:
- ${INSTALL_PREFIX}/bin/luarocks install luaffi
- ${INSTALL_PREFIX}/bin/luarocks make rocks/sundown-scm-1.rockspec
- export PATH=${INSTALL_PREFIX}/bin:$PATH
- export TESTLUA=$(which luajit lua | head -n 1)
- ${TESTLUA} -lsundown -e "print('passed')"
