Lei Zhang | c4ebb55 | 2016-05-04 11:29:21 -0400 | [diff] [blame] | 1 | # Linux and Mac Build Configuration for Travis |
| 2 | |
| 3 | language: cpp |
| 4 | |
| 5 | os: |
| 6 | - linux |
| 7 | - osx |
| 8 | |
| 9 | # Use Ubuntu 14.04 LTS (Trusty) as the Linux testing environment. |
Lei Zhang | b21213e | 2017-05-13 14:26:30 -0400 | [diff] [blame] | 10 | sudo: false |
Lei Zhang | c4ebb55 | 2016-05-04 11:29:21 -0400 | [diff] [blame] | 11 | dist: trusty |
| 12 | |
| 13 | env: |
| 14 | - GLSLANG_BUILD_TYPE=Release |
| 15 | - GLSLANG_BUILD_TYPE=Debug |
| 16 | |
| 17 | compiler: |
| 18 | - clang |
| 19 | - gcc |
| 20 | |
| 21 | matrix: |
| 22 | fast_finish: true # Show final status immediately if a test fails. |
| 23 | exclude: |
| 24 | # Skip GCC builds on Mac OS X. |
| 25 | - os: osx |
| 26 | compiler: gcc |
Lei Zhang | b21213e | 2017-05-13 14:26:30 -0400 | [diff] [blame] | 27 | include: |
| 28 | # Additional build using Android NDK. |
| 29 | - env: BUILD_NDK=ON |
Lei Zhang | c4ebb55 | 2016-05-04 11:29:21 -0400 | [diff] [blame] | 30 | |
| 31 | cache: |
| 32 | apt: true |
| 33 | |
| 34 | branches: |
| 35 | only: |
| 36 | - master |
| 37 | |
| 38 | addons: |
| 39 | apt: |
| 40 | packages: |
| 41 | - clang-3.6 |
| 42 | - ninja-build |
| 43 | |
| 44 | install: |
| 45 | # Install ninja on Mac OS X. |
| 46 | - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update && brew install ninja; fi |
Lei Zhang | b21213e | 2017-05-13 14:26:30 -0400 | [diff] [blame] | 47 | # Make sure that clang-3.6 is selected on Linux. |
Lei Zhang | c4ebb55 | 2016-05-04 11:29:21 -0400 | [diff] [blame] | 48 | - if [[ "$TRAVIS_OS_NAME" == "linux" && "$CC" == "clang" ]]; then |
| 49 | export CC=clang-3.6 CXX=clang++-3.6; |
| 50 | fi |
Lei Zhang | b21213e | 2017-05-13 14:26:30 -0400 | [diff] [blame] | 51 | # Download Android NDK and Android CMake toolchain file. |
| 52 | - if [[ "$BUILD_NDK" == "ON" ]]; then |
| 53 | git clone --depth=1 https://github.com/urho3d/android-ndk.git $HOME/android-ndk; |
| 54 | export ANDROID_NDK=$HOME/android-ndk; |
| 55 | git clone --depth=1 https://github.com/taka-no-me/android-cmake.git $HOME/android-cmake; |
| 56 | export TOOLCHAIN_PATH=$HOME/android-cmake/android.toolchain.cmake; |
| 57 | fi |
Lei Zhang | c4ebb55 | 2016-05-04 11:29:21 -0400 | [diff] [blame] | 58 | |
| 59 | before_script: |
| 60 | - git clone https://github.com/google/googletest.git External/googletest |
| 61 | |
| 62 | script: |
| 63 | - mkdir build && cd build |
Lei Zhang | b21213e | 2017-05-13 14:26:30 -0400 | [diff] [blame] | 64 | # For Android, do release building using NDK without testing. |
| 65 | # For Linux and macOS, do debug/release building with testing. |
| 66 | - if [[ "$BUILD_NDK" == "ON" ]]; then |
| 67 | cmake -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_PATH} |
| 68 | -DANDROID_NATIVE_API_LEVEL=android-12 |
| 69 | -DCMAKE_BUILD_TYPE=Release |
| 70 | -DANDROID_ABI="armeabi-v7a with NEON" |
| 71 | -DBUILD_TESTING=OFF |
| 72 | -GNinja ..; |
| 73 | ninja; |
| 74 | else |
| 75 | cmake -DCMAKE_BUILD_TYPE=${GLSLANG_BUILD_TYPE} |
| 76 | -DCMAKE_INSTALL_PREFIX=`pwd`/install |
| 77 | -GNinja ..; |
| 78 | ninja install; |
| 79 | ctest --output-on-failure && |
| 80 | cd ../Test && ./runtests; |
| 81 | fi |