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: |
Lei Zhang | fba299a | 2017-11-08 21:32:01 -0500 | [diff] [blame] | 14 | global: |
| 15 | - secure: aGFrgzyKp+84hKrGkxVWg8cHV61uqrKEHT38gfSQK6+WS4GfLOyH83p7WnsEBb7AMhzU7LMNFdvOFr6+NaMpVnqRvc40CEG1Q+lNg9Pq9mhIZLowvDrfqTL9kQ+8Nbw5Q6/dg6CTvY7fvRfpfCEmKIUZBRkoKUuHeuM1uy3IupFcdNuL5bSYn3Beo+apSJginh9DI4BLDXFUgBzTRSLLyCX5g3cpaeGGOCr8quJlYx75W6HRck5g9SZuLtUoH9GFEV3l+ZEWB8noErW+J56L03bwNwFuuAh321evw++oQk5KFa8rlDvar3SJ3b1RHB8u/eq5DBYMyaK/fS8+Q7QbGr8diF/wDe68bKO7U9IhpNfExXmczCpExjHomW5TQv4rYdGhygPMfW97aIsPRYyNKcl4fkmb7NDrM8w0Jscdq2g5c2Kz0ItyZoBri/NXLwFQQjaVCs7Pf97TjuMA7mK0GJmDTRzi6SrDYlWMt5BQL3y0CCojyfLIRcTh0CQjQI29s97bLfQrYAxt9GNNFR+HTXRLLrkaAlJkPGEPwUywlSfEThnvHLesNxYqemolAYpQT4ithoL4GehGIHmaxsW295aKVhuRf8K9eBODNqrfblvM42UHhjntT+92ZnQ/Gkq80GqaMxnxi4PO5FyPIxt0r981b54YBkWi8YA4P7w5pNI= |
| 16 | matrix: |
| 17 | - GLSLANG_BUILD_TYPE=Release |
| 18 | - GLSLANG_BUILD_TYPE=Debug |
Lei Zhang | c4ebb55 | 2016-05-04 11:29:21 -0400 | [diff] [blame] | 19 | |
| 20 | compiler: |
| 21 | - clang |
| 22 | - gcc |
| 23 | |
| 24 | matrix: |
| 25 | fast_finish: true # Show final status immediately if a test fails. |
| 26 | exclude: |
| 27 | # Skip GCC builds on Mac OS X. |
| 28 | - os: osx |
| 29 | compiler: gcc |
Lei Zhang | b21213e | 2017-05-13 14:26:30 -0400 | [diff] [blame] | 30 | include: |
| 31 | # Additional build using Android NDK. |
| 32 | - env: BUILD_NDK=ON |
Lei Zhang | c4ebb55 | 2016-05-04 11:29:21 -0400 | [diff] [blame] | 33 | |
| 34 | cache: |
| 35 | apt: true |
| 36 | |
| 37 | branches: |
| 38 | only: |
| 39 | - master |
| 40 | |
| 41 | addons: |
| 42 | apt: |
| 43 | packages: |
| 44 | - clang-3.6 |
Lei Zhang | c4ebb55 | 2016-05-04 11:29:21 -0400 | [diff] [blame] | 45 | |
| 46 | install: |
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 |
David Neto | 4aeca2d | 2018-07-12 14:49:26 -0400 | [diff] [blame] | 51 | # Download a recent Android NDK and use its android.toolchain.cmake file. |
Lei Zhang | b21213e | 2017-05-13 14:26:30 -0400 | [diff] [blame] | 52 | - if [[ "$BUILD_NDK" == "ON" ]]; then |
Lei Zhang | b21213e | 2017-05-13 14:26:30 -0400 | [diff] [blame] | 53 | export ANDROID_NDK=$HOME/android-ndk; |
David Neto | 3541d8a | 2018-07-11 15:31:36 -0400 | [diff] [blame] | 54 | git init $ANDROID_NDK; |
| 55 | pushd $ANDROID_NDK; |
David Neto | 4aeca2d | 2018-07-12 14:49:26 -0400 | [diff] [blame] | 56 | git remote add dneto0 https://github.com/dneto0/android-ndk.git; |
| 57 | git fetch --depth=1 dneto0 r17b-strip; |
David Neto | 3541d8a | 2018-07-11 15:31:36 -0400 | [diff] [blame] | 58 | git checkout FETCH_HEAD; |
| 59 | popd; |
David Neto | 4aeca2d | 2018-07-12 14:49:26 -0400 | [diff] [blame] | 60 | export TOOLCHAIN_PATH=$ANDROID_NDK/build/cmake/android.toolchain.cmake; |
Lei Zhang | b21213e | 2017-05-13 14:26:30 -0400 | [diff] [blame] | 61 | fi |
Lei Zhang | c4ebb55 | 2016-05-04 11:29:21 -0400 | [diff] [blame] | 62 | |
| 63 | before_script: |
Lei Zhang | afa128a | 2017-09-25 14:04:20 -0400 | [diff] [blame] | 64 | - git clone --depth=1 https://github.com/google/googletest.git External/googletest |
GregF | f451756 | 2017-09-22 15:30:10 -0600 | [diff] [blame] | 65 | - ./update_glslang_sources.py |
Lei Zhang | c4ebb55 | 2016-05-04 11:29:21 -0400 | [diff] [blame] | 66 | |
| 67 | script: |
| 68 | - mkdir build && cd build |
Lei Zhang | b21213e | 2017-05-13 14:26:30 -0400 | [diff] [blame] | 69 | # For Android, do release building using NDK without testing. |
David Neto | 4aeca2d | 2018-07-12 14:49:26 -0400 | [diff] [blame] | 70 | # Use android-14, the oldest native API level supporeted by NDK r17b. |
| 71 | # We can use newer API levels if we want. |
Lei Zhang | b21213e | 2017-05-13 14:26:30 -0400 | [diff] [blame] | 72 | # For Linux and macOS, do debug/release building with testing. |
| 73 | - if [[ "$BUILD_NDK" == "ON" ]]; then |
| 74 | cmake -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_PATH} |
David Neto | 4aeca2d | 2018-07-12 14:49:26 -0400 | [diff] [blame] | 75 | -DANDROID_NATIVE_API_LEVEL=android-14 |
Lei Zhang | b21213e | 2017-05-13 14:26:30 -0400 | [diff] [blame] | 76 | -DCMAKE_BUILD_TYPE=Release |
| 77 | -DANDROID_ABI="armeabi-v7a with NEON" |
Lei Zhang | afa128a | 2017-09-25 14:04:20 -0400 | [diff] [blame] | 78 | -DBUILD_TESTING=OFF ..; |
| 79 | make -j4; |
Lei Zhang | b21213e | 2017-05-13 14:26:30 -0400 | [diff] [blame] | 80 | else |
| 81 | cmake -DCMAKE_BUILD_TYPE=${GLSLANG_BUILD_TYPE} |
Lei Zhang | afa128a | 2017-09-25 14:04:20 -0400 | [diff] [blame] | 82 | -DCMAKE_INSTALL_PREFIX=`pwd`/install ..; |
| 83 | make -j4 install; |
Lei Zhang | b21213e | 2017-05-13 14:26:30 -0400 | [diff] [blame] | 84 | ctest --output-on-failure && |
| 85 | cd ../Test && ./runtests; |
| 86 | fi |
Lei Zhang | fba299a | 2017-11-08 21:32:01 -0500 | [diff] [blame] | 87 | |
| 88 | after_success: |
| 89 | # For debug build, the generated dll has a postfix "d" in its name. |
| 90 | - if [[ "${GLSLANG_BUILD_TYPE}" == "Debug" ]]; then |
| 91 | export SUFFIX="d"; |
| 92 | else |
| 93 | export SUFFIX=""; |
| 94 | fi |
| 95 | # Create tarball for deployment |
| 96 | - if [[ ${CC} == clang* && "${BUILD_NDK}" != "ON" ]]; then |
| 97 | cd ../build/install; |
| 98 | export TARBALL=glslang-master-${TRAVIS_OS_NAME}-${GLSLANG_BUILD_TYPE}.zip; |
| 99 | zip ${TARBALL} |
| 100 | bin/glslangValidator |
| 101 | include/glslang/* |
| 102 | include/SPIRV/* |
| 103 | lib/libglslang${SUFFIX}.a |
| 104 | lib/libHLSL${SUFFIX}.a |
| 105 | lib/libOGLCompiler${SUFFIX}.a |
| 106 | lib/libOSDependent${SUFFIX}.a |
| 107 | lib/libSPIRV${SUFFIX}.a |
| 108 | lib/libSPVRemapper${SUFFIX}.a |
| 109 | lib/libSPIRV-Tools${SUFFIX}.a |
| 110 | lib/libSPIRV-Tools-opt${SUFFIX}.a; |
| 111 | fi |
| 112 | |
| 113 | before_deploy: |
| 114 | # Tag the current top of the tree as "master-tot". |
| 115 | # Travis CI replies on the tag name to properly push to GitHub Releases. |
| 116 | - git config --global user.name "Travis CI" |
| 117 | - git config --global user.email "builds@travis-ci.org" |
| 118 | - git tag -f master-tot |
| 119 | - git push -q -f https://${glslangtoken}@github.com/KhronosGroup/glslang --tags |
| 120 | |
| 121 | deploy: |
| 122 | provider: releases |
| 123 | api_key: ${glslangtoken} |
| 124 | on: |
| 125 | branch: master |
| 126 | condition: ${CC} == clang* && ${BUILD_NDK} != ON |
| 127 | file: ${TARBALL} |
| 128 | skip_cleanup: true |
| 129 | overwrite: true |