diff --git a/.travis.yml b/.travis.yml index 781f498e2..6d8970b67 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,4 @@ -os: - - linux - - osx -osx_image: xcode9.4 language: cpp -sudo: required -dist: trusty branches: only: - master @@ -20,16 +14,16 @@ addons: sources: - sourceline: 'ppa:openmw/openmw' - ubuntu-toolchain-r-test - - llvm-toolchain-precise-3.6 + - llvm-toolchain-trusty-7 packages: [ # Dev - cmake, clang-3.6, libunshield-dev, libtinyxml-dev, + cmake, clang-7, clang-tools-7, gcc-8, g++-8, # Boost libboost-filesystem-dev, libboost-program-options-dev, libboost-system-dev, # FFmpeg libavcodec-dev, libavformat-dev, libavutil-dev, libswscale-dev, - # Audio & Video - libsdl2-dev, libqt4-dev, libopenal-dev, + # Audio, Video and Misc. deps + libsdl2-dev, libqt4-dev, libopenal-dev, libunshield-dev, libtinyxml-dev, # The other ones from OpenMW ppa libbullet-dev, libswresample-dev, libopenscenegraph-3.4-dev, libmygui-dev ] @@ -44,18 +38,44 @@ addons: branch_pattern: coverity_scan matrix: include: - - os: linux + - name: OpenMW (all) on MacOS xcode9.4 + os: osx + osx_image: xcode9.4 + - name: OpenMW (all) on Ubuntu Trusty GCC-8 + os: linux + dist: trusty + sudo: required env: - ANALYZE="scan-build-3.6 --use-cc clang-3.6 --use-c++ clang++-3.6 " + - MATRIX_EVAL="CC=gcc-8 && CXX=g++-8" + - name: OpenMW (openmw) on Ubuntu Trusty Clang-7 with Static Analysis + os: linux + dist: trusty + sudo: required + env: + - MATRIX_EVAL="CC=clang-7 && CXX=clang++-7" + - ANALYZE="scan-build-7 --use-cc clang-7 --use-c++ clang++-7" + - BUILD_OPENMW_CS="OFF" + compiler: clang + - name: OpenMW (openmw-cs) on Ubuntu Trusty Clang-7 with Static Analysis + os: linux + dist: trusty + sudo: required + env: + - MATRIX_EVAL="CC=clang-7 && CXX=clang++-7" + - ANALYZE="scan-build-7 --use-cc clang-7 --use-c++ clang++-7" + - BUILD_OPENMW="OFF" compiler: clang - allow_failures: - - env: ANALYZE="scan-build-3.6 --use-cc clang-3.6 --use-c++ clang++-3.6 " +# allow_failures: +# - name: OpenMW (openmw) on Ubuntu Trusty Clang-7 with Static Analysis -before_install: ./CI/before_install.${TRAVIS_OS_NAME}.sh -before_script: ./CI/before_script.${TRAVIS_OS_NAME}.sh +before_install: + - if [ "${TRAVIS_OS_NAME}" = "linux" ]; then eval "${MATRIX_EVAL}"; fi + - ./CI/before_install.${TRAVIS_OS_NAME}.sh +before_script: + - ./CI/before_script.${TRAVIS_OS_NAME}.sh script: - cd ./build - - if [ "$COVERITY_SCAN_BRANCH" != 1 ]; then ${ANALYZE}make -j3; fi + - if [ "$COVERITY_SCAN_BRANCH" != 1 ]; then ${ANALYZE} make -j3; fi - if [ "$COVERITY_SCAN_BRANCH" != 1 ] && [ "${TRAVIS_OS_NAME}" = "osx" ]; then make package; fi - if [ "$COVERITY_SCAN_BRANCH" != 1 ] && [ "${TRAVIS_OS_NAME}" = "linux" ]; then ./openmw_test_suite; fi - if [ "$COVERITY_SCAN_BRANCH" != 1 ] && [ "${TRAVIS_OS_NAME}" = "linux" ]; then cd .. && ./CI/check_tabs.sh; fi diff --git a/CI/before_install.linux.sh b/CI/before_install.linux.sh index 1ec88fb9e..fd4e4829c 100755 --- a/CI/before_install.linux.sh +++ b/CI/before_install.linux.sh @@ -1,3 +1,4 @@ -#!/bin/sh -e -sudo ln -s /usr/bin/clang-3.6 /usr/local/bin/clang -sudo ln -s /usr/bin/clang++-3.6 /usr/local/bin/clang++ +#!/bin/bash -ex + +sudo ln -sf /usr/bin/clang-7 /usr/local/bin/clang +sudo ln -sf /usr/bin/clang++-7 /usr/local/bin/clang++ diff --git a/CI/before_script.linux.sh b/CI/before_script.linux.sh index dd879989a..c8c4f8f85 100755 --- a/CI/before_script.linux.sh +++ b/CI/before_script.linux.sh @@ -1,4 +1,4 @@ -#!/bin/sh -e +#!/bin/bash -ex free -m @@ -8,8 +8,22 @@ GOOGLETEST_DIR="$(pwd)/googletest/build" mkdir build cd build export CODE_COVERAGE=1 -if [ "${CC}" = "clang" ]; then export CODE_COVERAGE=0; fi -${ANALYZE}cmake \ + +if [[ "${CC}" =~ "clang" ]]; then export CODE_COVERAGE=0; fi +if [[ -z "${BUILD_OPENMW}" ]]; then export BUILD_OPENMW=ON; fi +if [[ -z "${BUILD_OPENMW_CS}" ]]; then export BUILD_OPENMW_CS=ON; fi + +${ANALYZE} cmake \ + -DBUILD_OPENMW=${BUILD_OPENMW} \ + -DBUILD_OPENCS=${BUILD_OPENMW_CS} \ + -DBUILD_LAUNCHER=${BUILD_OPENMW_CS} \ + -DBUILD_BSATOOL=${BUILD_OPENMW_CS} \ + -DBUILD_ESMTOOL=${BUILD_OPENMW_CS} \ + -DBUILD_MWINIIMPORTER=${BUILD_OPENMW_CS} \ + -DBUILD_ESSIMPORTER=${BUILD_OPENMW_CS} \ + -DBUILD_WIZARD=${BUILD_OPENMW_CS} \ + -DBUILD_NIFTEST=${BUILD_OPENMW_CS} \ + -DBUILD_MYGUI_PLUGIN=${BUILD_OPENMW_CS} \ -DBUILD_WITH_CODE_COVERAGE=${CODE_COVERAGE} \ -DBUILD_UNITTESTS=1 \ -DCMAKE_INSTALL_PREFIX=/usr \ diff --git a/components/detournavigator/recastallocutils.hpp b/components/detournavigator/recastallocutils.hpp index 7b083d139..69a5cfa8b 100644 --- a/components/detournavigator/recastallocutils.hpp +++ b/components/detournavigator/recastallocutils.hpp @@ -86,17 +86,6 @@ namespace DetourNavigator return static_cast(ptr) + 1; } - // TODO: use std::align - inline void* align(std::size_t align, std::size_t size, void*& ptr, std::size_t& space) noexcept - { - const auto intptr = reinterpret_cast(ptr); - const auto aligned = (intptr - 1u + align) & - align; - const auto diff = aligned - intptr; - if ((size + diff) > space) - return nullptr; - space -= diff; - return ptr = reinterpret_cast(aligned); - } } #endif diff --git a/components/detournavigator/recasttempallocator.hpp b/components/detournavigator/recasttempallocator.hpp index e369b4224..fbf9fd62c 100644 --- a/components/detournavigator/recasttempallocator.hpp +++ b/components/detournavigator/recasttempallocator.hpp @@ -21,7 +21,7 @@ namespace DetourNavigator std::size_t space = mStack.size() - getUsedSize(); void* top = mTop; const auto itemSize = 2 * sizeof(std::size_t) + size; - if (rcUnlikely(!align(sizeof(std::size_t), itemSize, top, space))) + if (rcUnlikely(!std::align(sizeof(std::size_t), itemSize, top, space))) return nullptr; setTempPtrBufferType(top, BufferType_temp); setTempPtrPrev(top, mPrev);