diff options
author | Loic Blot <loic.blot@unix-experience.fr> | 2017-05-26 17:03:46 +0200 |
---|---|---|
committer | Loïc Blot <nerzhul@users.noreply.github.com> | 2017-06-04 09:57:08 +0200 |
commit | bf6569b57019d070246d947ed929cb2b5eb67faf (patch) | |
tree | 3a8a3d4858f20a57930e0a0d0ad1f7c3fb48b512 /util/travis | |
parent | 0e58168fe5bce607f64805b854420e7558372f24 (diff) | |
download | minetest-bf6569b57019d070246d947ed929cb2b5eb67faf.tar.gz minetest-bf6569b57019d070246d947ed929cb2b5eb67faf.tar.bz2 minetest-bf6569b57019d070246d947ed929cb2b5eb67faf.zip |
Minetest for C++11 (CMakeLists + Travis)
* Move GCC to GCC 6 & GCC 7
* Move Clang to Clang 3.6 & Clang 4.0
* LINT moves from Clang 3.9 to Clang 4.0
* Move XCode 7.3 to 8.0
* Use more travis tricks to install compilers instead of adding complexity to our build script
* Clang format fixes on checked files (compat Cpp11 instead of Cpp03)
* Mingw GCC update from 4.8.4 to 5.3 (Ubuntu Xenial)
* Drop mingw cmake generated files and add them to gitignore
Diffstat (limited to 'util/travis')
-rwxr-xr-x | util/travis/before_install.sh | 40 | ||||
-rw-r--r-- | util/travis/common.sh | 35 | ||||
-rw-r--r-- | util/travis/lint.sh | 4 | ||||
-rwxr-xr-x | util/travis/script.sh | 19 |
4 files changed, 55 insertions, 43 deletions
diff --git a/util/travis/before_install.sh b/util/travis/before_install.sh index a4328fa46..afc16c332 100755 --- a/util/travis/before_install.sh +++ b/util/travis/before_install.sh @@ -1,49 +1,33 @@ #!/bin/bash -e + echo "Preparing for $TRAVIS_COMMIT_RANGE" -if [[ "$LINT" == "1" ]]; then - curl http://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - - sudo add-apt-repository "deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-3.9 main" - sudo apt-get -yq update - sudo apt-get install clang-format-3.9 +. util/travis/common.sh + +if [[ "${LINT}" == "1" ]]; then exit 0 fi -. util/travis/common.sh needs_compile || exit 0 -if [[ $TRAVIS_OS_NAME == "linux" ]]; then - sudo apt-get update - sudo apt-get install p7zip-full $COMPILER -fi - if [[ $PLATFORM == "Unix" ]]; then if [[ $TRAVIS_OS_NAME == "linux" ]]; then - sudo apt-get update - sudo apt-get install libirrlicht-dev cmake libbz2-dev libpng12-dev \ - libjpeg-dev libxxf86vm-dev libgl1-mesa-dev libsqlite3-dev \ - libhiredis-dev libogg-dev libgmp-dev libvorbis-dev libopenal-dev \ - gettext libpq-dev postgresql-server-dev-all - # Linking to LevelDB is broken, use a custom build - wget http://minetest.kitsunemimi.pw/libleveldb-1.18-ubuntu12.04.7z - sudo 7z x -o/usr libleveldb-1.18-ubuntu12.04.7z - if [[ "$VALGRIND" == "1" ]]; then - sudo apt-get install valgrind - fi - + install_linux_deps else - brew update - brew install freetype gettext hiredis irrlicht jpeg leveldb libogg libvorbis luajit - #brew upgrade postgresql + install_macosx_deps fi elif [[ $PLATFORM == "Win32" ]]; then - wget http://minetest.kitsunemimi.pw/mingw_w64_i686_ubuntu12.04_4.9.1.7z -O mingw.7z + sudo apt-get update + sudo apt-get install p7zip-full + wget http://minetest.kitsunemimi.pw/mingw-w64-i686_7.1.1_ubuntu14.04.7z -O mingw.7z sed -e "s|%PREFIX%|i686-w64-mingw32|" \ -e "s|%ROOTPATH%|/usr/i686-w64-mingw32|" \ < util/travis/toolchain_mingw.cmake.in > util/buildbot/toolchain_mingw.cmake sudo 7z x -y -o/usr mingw.7z elif [[ $PLATFORM == "Win64" ]]; then - wget http://minetest.kitsunemimi.pw/mingw_w64_x86_64_ubuntu12.04_4.9.1.7z -O mingw.7z + sudo apt-get update + sudo apt-get install p7zip-full + wget http://minetest.kitsunemimi.pw/mingw-w64-x86_64_7.1.1_ubuntu14.04.7z -O mingw.7z sed -e "s|%PREFIX%|x86_64-w64-mingw32|" \ -e "s|%ROOTPATH%|/usr/x86_64-w64-mingw32|" \ < util/travis/toolchain_mingw.cmake.in > util/buildbot/toolchain_mingw64.cmake diff --git a/util/travis/common.sh b/util/travis/common.sh index 35ceec08d..a5b2de728 100644 --- a/util/travis/common.sh +++ b/util/travis/common.sh @@ -1,5 +1,40 @@ #!/bin/bash -e +set_linux_compiler_env() { + if [[ "${COMPILER}" == "gcc-5.1" ]]; then + export CC=gcc-5.1 + export CXX=g++-5.1 + elif [[ "${COMPILER}" == "gcc-6" ]]; then + export CC=gcc-6 + export CXX=g++-6 + elif [[ "${COMPILER}" == "gcc-7" ]]; then + export CC=gcc-7 + export CXX=g++-7 + elif [[ "${COMPILER}" == "clang-3.6" ]]; then + export CC=clang-3.6 + export CXX=clang++-3.6 + elif [[ "${COMPILER}" == "clang-4.0" ]]; then + export CC=clang-4.0 + export CXX=clang++-4.0 + fi +} + +# Linux build only +install_linux_deps() { + sudo apt-get update + sudo apt-get install libirrlicht-dev cmake libbz2-dev libpng12-dev \ + libjpeg-dev libxxf86vm-dev libgl1-mesa-dev libsqlite3-dev \ + libhiredis-dev libogg-dev libgmp-dev libvorbis-dev libopenal-dev \ + gettext libpq-dev libleveldb-dev +} + +# Mac OSX build only +install_macosx_deps() { + brew update + brew install freetype gettext hiredis irrlicht jpeg leveldb libogg libvorbis luajit + #brew upgrade postgresql +} + # Relative to git-repository root: TRIGGER_COMPILE_PATHS="src/.*\.(c|cpp|h)|CMakeLists.txt|cmake/Modules/|util/travis/|util/buildbot/" diff --git a/util/travis/lint.sh b/util/travis/lint.sh index cd5f41779..555cf3ebe 100644 --- a/util/travis/lint.sh +++ b/util/travis/lint.sh @@ -1,8 +1,8 @@ #! /bin/bash function perform_lint() { echo "Performing LINT..." - if hash clang-format-3.9 2>/dev/null; then - CLANG_FORMAT=clang-format-3.9 + if hash clang-format-4.0 2>/dev/null; then + CLANG_FORMAT=clang-format-4.0 else CLANG_FORMAT=clang-format fi diff --git a/util/travis/script.sh b/util/travis/script.sh index 14b8dfb73..e5be1fe32 100755 --- a/util/travis/script.sh +++ b/util/travis/script.sh @@ -10,22 +10,15 @@ if [[ "$LINT" == "1" ]]; then exit 0 fi -if [[ $PLATFORM == "Unix" ]]; then +set_linux_compiler_env + +if [[ ${PLATFORM} == "Unix" ]]; then mkdir -p travisbuild cd travisbuild || exit 1 CMAKE_FLAGS='' - if [[ $COMPILER == "g++-6" ]]; then - export CC=gcc-6 - export CXX=g++-6 - fi - - # Clang builds with FreeType fail on Travis - if [[ $CC == "clang" ]]; then - CMAKE_FLAGS+=' -DENABLE_FREETYPE=FALSE' - fi - if [[ $TRAVIS_OS_NAME == "osx" ]]; then + if [[ ${TRAVIS_OS_NAME} == "osx" ]]; then CMAKE_FLAGS+=' -DCUSTOM_GETTEXT_PATH=/usr/local/opt/gettext' fi @@ -33,12 +26,12 @@ if [[ $PLATFORM == "Unix" ]]; then -DRUN_IN_PLACE=TRUE \ -DENABLE_GETTEXT=TRUE \ -DBUILD_SERVER=TRUE \ - $CMAKE_FLAGS .. + ${CMAKE_FLAGS} .. make -j2 echo "Running unit tests." CMD="../bin/minetest --run-unittests" - if [[ "$VALGRIND" == "1" ]]; then + if [[ "${VALGRIND}" == "1" ]]; then valgrind --leak-check=full --leak-check-heuristics=all --undef-value-errors=no --error-exitcode=9 ${CMD} && exit 0 else ${CMD} && exit 0 |