From b61ef0f7ca8cdd51d1a36bee5998e2e509936578 Mon Sep 17 00:00:00 2001 From: mihacooper Date: Sun, 22 Jan 2017 20:01:02 +0300 Subject: [PATCH] Modify Travis config to add Linux support --- .travis.yml | 50 ++++++++++++++++++++++++++++++++++++++++++++------ CMakeLists.txt | 9 +++++---- ci.sh | 16 ---------------- 3 files changed, 49 insertions(+), 26 deletions(-) delete mode 100755 ci.sh diff --git a/.travis.yml b/.travis.yml index 5e0df1e..214b2ab 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,45 @@ language: cpp -dist: trusty -sudo: required -compiler: clang -os: osx -osx_image: xcode8.2 -script: ./ci.sh \ No newline at end of file + +matrix: + # Linux / GCC 5.0 + include: + - compiler: g++-5 + sudo: required + dist: trusty + addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - g++-5 + - lua5.2 + - liblua5.2-dev + before_install: + - sudo apt-get autoremove lua lua5.1 + install: + - sudo apt-get install -y gdb + - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 30 + after_failure: + - COREFILE=$(find . -maxdepth 1 -name "core*" | head -n 1) # find core file + - if [[ -f "$COREFILE" ]]; then gdb -c "$COREFILE" ./tests -ex "thread apply all bt" -ex "set pagination 0" -batch; fi + before_script: + - ulimit -c unlimited -S + script: + - mkdir build_dir && cd build_dir + - cmake -DLUA_INCLUDE_DIR="/usr/include/lua5.2" -DLUA_LIBRARY="/usr/lib/x86_64-linux-gnu/liblua5.2.so" .. + - make -j4 all && make install + - ./tests + - cd ../lua-tests/ && ./run_tests.lua + # Mac OS X / Clang 3.8 + - compiler: clang + os: osx + osx_image: xcode8.2 + before_install: + - brew update + install: + - brew install lua + script: + - mkdir build_dir && cd build_dir + - cmake .. && make -j4 all && make install + - ./tests + - cd ../lua-tests && ./run_tests.lua diff --git a/CMakeLists.txt b/CMakeLists.txt index f5907b3..5c306d2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,10 +1,11 @@ cmake_minimum_required(VERSION 2.8) project(effil) -find_package(Lua REQUIRED) - -if( "${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}" LESS "5.2") - message(FATAL_ERROR "Wrong Lua version ${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}, use 5.2 or higher") +if (NOT LUA_INCLUDE_DIR OR NOT LUA_LIBRARY) + find_package(Lua REQUIRED) + if( "${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}" LESS "5.2") + message(FATAL_ERROR "Wrong Lua version ${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}, use 5.2 or higher") + endif() endif() include_directories(src src/sol/single/sol ${LUA_INCLUDE_DIR}) diff --git a/ci.sh b/ci.sh deleted file mode 100755 index a6b68fb..0000000 --- a/ci.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -e - -brew update && true -brew install lua cmake && true - -ROOT_DIR=$( cd $(dirname $0); pwd ) -WORK_DIR=$ROOT_DIR/build - -mkdir -p $WORK_DIR - -# build -(cd $WORK_DIR && cmake $ROOT_DIR && make -j4 all && make install) - -# run tests -(cd $WORK_DIR && ./tests) -(cd $ROOT_DIR/lua-tests && ./run_tests.lua)