You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

128 lines
2.6 KiB

8 years ago
8 years ago
8 years ago
  1. #!/bin/bash -x
  2. # Inspired by https://github.com/google/fruit
  3. set -e
  4. # This only exists in OS X, but it doesn't cause issues in Linux (the dir doesn't exist, so it's
  5. # ignored).
  6. export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
  7. case $COMPILER in
  8. gcc-4.8)
  9. export CC=gcc-4.8
  10. export CXX=g++-4.8
  11. ;;
  12. gcc-4.9)
  13. export CC=gcc-4.9
  14. export CXX=g++-4.9
  15. ;;
  16. gcc-5)
  17. export CC=gcc-5
  18. export CXX=g++-5
  19. ;;
  20. gcc-6)
  21. export CC=gcc-6
  22. export CXX=g++-6
  23. ;;
  24. gcc-default)
  25. export CC=gcc
  26. export CXX=g++
  27. ;;
  28. clang-3.5)
  29. export CC=clang-3.5
  30. export CXX=clang++-3.5
  31. ;;
  32. clang-3.6)
  33. export CC=clang-3.6
  34. export CXX=clang++-3.6
  35. ;;
  36. clang-3.7)
  37. export CC=clang-3.7
  38. export CXX=clang++-3.7
  39. ;;
  40. clang-3.8)
  41. export CC=clang-3.8
  42. export CXX=clang++-3.8
  43. ;;
  44. clang-3.9)
  45. export CC=clang-3.9
  46. export CXX=clang++-3.9
  47. ;;
  48. clang-4.0)
  49. case "$OS" in
  50. linux)
  51. export CC=clang-4.0
  52. export CXX=clang++-4.0
  53. ;;
  54. osx)
  55. export CC=/usr/local/opt/llvm/bin/clang-4.0
  56. export CXX=/usr/local/opt/llvm/bin/clang++
  57. ;;
  58. *) echo "Error: unexpected OS: $OS"; exit 1 ;;
  59. esac
  60. ;;
  61. clang-default)
  62. export CC=clang
  63. export CXX=clang++
  64. ;;
  65. *)
  66. echo "Unrecognized value of COMPILER: $COMPILER"
  67. exit 1
  68. esac
  69. travis_fold() {
  70. local action=$1
  71. local name=$2
  72. echo -en "travis_fold:${action}:${name}\r"
  73. }
  74. run_make() {
  75. travis_fold start make
  76. #make storm -j$N_JOBS
  77. #make resources -j$N_JOBS
  78. make -j$N_JOBS
  79. travis_fold end make
  80. }
  81. # Build
  82. echo CXX version: $($CXX --version)
  83. echo C++ Standard library location: $(echo '#include <vector>' | $CXX -x c++ -E - | grep 'vector\"' | awk '{print $3}' | sed 's@/vector@@;s@\"@@g' | head -n 1)
  84. echo Normalized C++ Standard library location: $(readlink -f $(echo '#include <vector>' | $CXX -x c++ -E - | grep 'vector\"' | awk '{print $3}' | sed 's@/vector@@;s@\"@@g' | head -n 1))
  85. case "$1" in
  86. DebugPlain) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="$STLARG") ;;
  87. ReleasePlain) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="$STLARG") ;;
  88. *) echo "Error: you need to specify one of the supported postsubmit modes (see postsubmit.sh)."; exit 1 ;;
  89. esac
  90. # Restore timestamps of files
  91. travis_fold start mtime
  92. ruby travis/mtime_cache/mtime_cache.rb -g travis/mtime_cache/globs.txt -c travis/mtime_cache/cache.json
  93. travis_fold end mtime
  94. travis_fold start cmake
  95. #rm -rf build
  96. mkdir -p build
  97. cd build
  98. cmake .. "${CMAKE_ARGS[@]}"
  99. echo
  100. echo "Content of CMakeFiles/CMakeError.log:"
  101. if [ -f "CMakeFiles/CMakeError.log" ]
  102. then
  103. cat CMakeFiles/CMakeError.log
  104. fi
  105. echo
  106. travis_fold end cmake
  107. run_make