1# Linux and Mac Build Configuration for Travis
2
3language: cpp
4
5os:
6  - linux
7  - osx
8
9# Use Ubuntu 14.04 LTS (Trusty) as the Linux testing environment.
10sudo: false
11dist: trusty
12
13env:
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
19
20compiler:
21  - clang
22  - gcc
23
24matrix:
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
30  include:
31    # Additional build using Android NDK.
32    - env: BUILD_NDK=ON
33
34cache:
35  apt: true
36
37branches:
38  only:
39    - master
40
41addons:
42  apt:
43    packages:
44      - clang-3.6
45
46install:
47  # Make sure that clang-3.6 is selected on Linux.
48  - if [[ "$TRAVIS_OS_NAME" == "linux" && "$CC" == "clang" ]]; then
49      export CC=clang-3.6 CXX=clang++-3.6;
50    fi
51  # Download a recent Android NDK and use its android.toolchain.cmake file.
52  - if [[ "$BUILD_NDK" == "ON" ]]; then
53      export ANDROID_NDK=$HOME/android-ndk;
54      git init $ANDROID_NDK;
55      pushd $ANDROID_NDK;
56        git remote add dneto0 https://github.com/dneto0/android-ndk.git;
57        git fetch --depth=1 dneto0 r17b-strip;
58        git checkout FETCH_HEAD;
59      popd;
60      export TOOLCHAIN_PATH=$ANDROID_NDK/build/cmake/android.toolchain.cmake;
61    fi
62
63before_script:
64  # check out pre-breakage version of googletest; can be deleted when
65  # issue 3128 is fixed
66  # git clone --depth=1 https://github.com/google/googletest.git External/googletest
67  - mkdir -p External/googletest
68  - cd External/googletest
69  - git init
70  - git remote add origin https://github.com/google/googletest.git
71  - git fetch --depth 1 origin 0c400f67fcf305869c5fb113dd296eca266c9725
72  - git reset --hard FETCH_HEAD
73  - cd ../..
74  # get spirv-tools and spirv-headers
75  - ./update_glslang_sources.py
76
77script:
78  - mkdir build && cd build
79  # For Android, do release building using NDK without testing.
80  # Use android-14, the oldest native API level supporeted by NDK r17b.
81  # We can use newer API levels if we want.
82  # For Linux and macOS, do debug/release building with testing.
83  - if [[ "$BUILD_NDK" == "ON" ]]; then
84      cmake -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_PATH}
85            -DANDROID_NATIVE_API_LEVEL=android-14
86            -DCMAKE_BUILD_TYPE=Release
87            -DANDROID_ABI="armeabi-v7a with NEON"
88            -DBUILD_TESTING=OFF ..;
89      make -j4;
90    else
91      cmake -DCMAKE_BUILD_TYPE=${GLSLANG_BUILD_TYPE}
92            -DCMAKE_INSTALL_PREFIX=`pwd`/install ..;
93      make -j4 install;
94      ctest --output-on-failure &&
95      cd ../Test && ./runtests;
96    fi
97
98after_success:
99  # For debug build, the generated dll has a postfix "d" in its name.
100  - if [[ "${GLSLANG_BUILD_TYPE}" == "Debug" ]]; then
101      export SUFFIX="d";
102    else
103      export SUFFIX="";
104    fi
105  # Create tarball for deployment
106  - if [[ ${CC} == clang* && "${BUILD_NDK}" != "ON" ]]; then
107      cd ../build/install;
108      export TARBALL=glslang-master-${TRAVIS_OS_NAME}-${GLSLANG_BUILD_TYPE}.zip;
109      zip ${TARBALL}
110        bin/glslangValidator
111        include/glslang/*
112        lib/libglslang${SUFFIX}.a
113        lib/libHLSL${SUFFIX}.a
114        lib/libOGLCompiler${SUFFIX}.a
115        lib/libOSDependent${SUFFIX}.a
116        lib/libSPIRV${SUFFIX}.a
117        lib/libSPVRemapper${SUFFIX}.a
118        lib/libSPIRV-Tools${SUFFIX}.a
119        lib/libSPIRV-Tools-opt${SUFFIX}.a;
120    fi
121
122before_deploy:
123  # Tag the current top of the tree as "master-tot".
124  # Travis CI replies on the tag name to properly push to GitHub Releases.
125  - git config --global user.name "Travis CI"
126  - git config --global user.email "builds@travis-ci.org"
127  - git tag -f master-tot
128  - git push -q -f https://${glslangtoken}@github.com/KhronosGroup/glslang --tags
129
130deploy:
131  provider: releases
132  api_key: ${glslangtoken}
133  on:
134    branch: master
135    condition: ${CC} == clang* && ${BUILD_NDK} != ON
136  file: ${TARBALL}
137  skip_cleanup: true
138  overwrite: true
139