The source code and dockerfile for the GSW2024 AI Lab.
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.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

131 lines
3.0 KiB

4 weeks ago
  1. #!/bin/bash
  2. set -e
  3. # Helper for travis folding
  4. travis_fold() {
  5. local action=$1
  6. local name=$2
  7. echo -en "travis_fold:${action}:${name}\r"
  8. }
  9. # Helper for building and testing
  10. run() {
  11. # Create virtual environment
  12. travis_fold start virtualenv
  13. $PYTHON -m venv pycarl-env
  14. source pycarl-env/bin/activate
  15. # Print version
  16. python --version
  17. travis_fold end virtualenv
  18. # Build Carl
  19. travis_fold start build_carl
  20. git clone --single-branch -b master14 https://github.com/smtrat/carl
  21. cd carl
  22. mkdir build
  23. cd build
  24. PARSER_ARGS=""
  25. if [[ "$BUILD_CARL_PARSER" == TRUE ]]
  26. then
  27. # Build Carl with carl-parser
  28. cmake .. "${CMAKE_ARGS[@]}" "-DUSE_CLN_NUMBERS=$BUILD_CARL_CLN" "-DUSE_GINAC=$BUILD_CARL_CLN" "-DBUILD_ADDONS=ON" "-DBUILD_ADDON_PARSER=ON"
  29. make lib_carl carl-parser -j$N_JOBS
  30. # Build a second time to avoid problems in macOS
  31. cmake .
  32. make lib_carl carl-parser -j$N_JOBS
  33. else
  34. # Build Carl without parser
  35. cmake .. "${CMAKE_ARGS[@]}" "-DUSE_CLN_NUMBERS=$BUILD_CARL_CLN" "-DUSE_GINAC=$BUILD_CARL_CLN"
  36. make lib_carl -j$N_JOBS
  37. fi
  38. cd ../..
  39. travis_fold end build_carl
  40. # Build Pycarl
  41. travis_fold start build_pycarl
  42. case "$CONFIG" in
  43. Debug*)
  44. python setup.py build_ext --debug -j 1 develop
  45. ;;
  46. *)
  47. python setup.py build_ext -j 1 develop
  48. ;;
  49. esac
  50. travis_fold end build_pycarl
  51. # Perform task
  52. case $TASK in
  53. Test)
  54. # Run tests
  55. set +e
  56. python setup.py test
  57. ;;
  58. Documentation)
  59. # Generate documentation
  60. pip install sphinx sphinx_bootstrap_theme
  61. cd doc
  62. make html
  63. touch build/html/.nojekyll
  64. rm -r build/html/_sources
  65. ;;
  66. *)
  67. echo "Unrecognized value of TASK: $TASK"
  68. exit 1
  69. esac
  70. }
  71. # This only exists in OS X, but it doesn't cause issues in Linux (the dir doesn't exist, so it's
  72. # ignored).
  73. export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
  74. case $COMPILER in
  75. gcc-6)
  76. export CC=gcc-6
  77. export CXX=g++-6
  78. ;;
  79. gcc)
  80. export CC=gcc
  81. export CXX=g++
  82. ;;
  83. clang-4)
  84. case "$OS" in
  85. linux)
  86. export CC=clang-4.0
  87. export CXX=clang++-4.0
  88. ;;
  89. osx)
  90. export CC=/usr/local/opt/llvm/bin/clang-4.0
  91. export CXX=/usr/local/opt/llvm/bin/clang++
  92. ;;
  93. *) echo "Error: unexpected OS: $OS"; exit 1 ;;
  94. esac
  95. ;;
  96. clang)
  97. export CC=clang
  98. export CXX=clang++
  99. ;;
  100. *)
  101. echo "Unrecognized value of COMPILER: $COMPILER"
  102. exit 1
  103. esac
  104. # Build
  105. echo CXX version: $($CXX --version)
  106. 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)
  107. 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))
  108. case "$CONFIG" in
  109. Debug*) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="$STLARG") ;;
  110. Release*) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="$STLARG") ;;
  111. *) echo "Unrecognized value of CONFIG: $CONFIG"; exit 1 ;;
  112. esac
  113. run