travis_osx_script.sh 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #!/bin/bash
  2. set -e
  3. echo "\n=== Building ==="
  4. export OPENSSL_ROOT_DIR="/usr/local/opt/openssl"
  5. export PATH="/Users/travis/Library/Python/2.7/bin:$PATH"
  6. # OSX may have different hostnames between processes, which causes multicast unit test to fail.
  7. # Hardcode the hostname here
  8. # Note: do not use the `hostname` addon from travis:
  9. # addons:
  10. # hostname: travis-osx
  11. #
  12. # Travis support says:
  13. # the `hostname` command is actually a super ephemeral way to change it. There’s a different way:
  14. # `sudo scutil --set HostName <new host name>` which is more permanent and potentially more resilient
  15. sudo scutil --set HostName travis-osx
  16. echo "Full Namespace 0 Generation" && echo -en 'travis_fold:start:script.build.ns0\\r'
  17. mkdir -p build
  18. cd build
  19. cmake \
  20. -DCMAKE_BUILD_TYPE=Debug \
  21. -DUA_BUILD_EXAMPLES=ON \
  22. -DUA_NAMESPACE_ZERO=FULL ..
  23. make -j
  24. if [ $? -ne 0 ] ; then exit 1 ; fi
  25. cd .. && rm -rf build
  26. echo -en 'travis_fold:end:script.build.ns0\\r'
  27. echo "Compile release build for OS X" && echo -en 'travis_fold:start:script.build.osx\\r'
  28. mkdir -p build && cd build
  29. cmake \
  30. -DCMAKE_BUILD_TYPE=Release \
  31. -DCMAKE_INSTALL_PREFIX=${TRAVIS_BUILD_DIR}/open62541-osx \
  32. -DUA_BUILD_EXAMPLES=ON \
  33. -DUA_ENABLE_AMALGAMATION=OFF ..
  34. make -j
  35. if [ $? -ne 0 ] ; then exit 1 ; fi
  36. make install
  37. if [ $? -ne 0 ] ; then exit 1 ; fi
  38. cd ..
  39. tar -pczf open62541-osx.tar.gz LICENSE AUTHORS README.md ${TRAVIS_BUILD_DIR}/open62541-osx/*
  40. rm -rf build
  41. echo -en 'travis_fold:end:script.build.osx\\r'
  42. echo "Compile multithreaded version" && echo -en 'travis_fold:start:script.build.multithread\\r'
  43. mkdir -p build && cd build
  44. cmake \
  45. -DUA_BUILD_EXAMPLES=ON \
  46. -DUA_MULTITHREADING=200 ..
  47. make -j
  48. if [ $? -ne 0 ] ; then exit 1 ; fi
  49. cd .. && rm -rf build
  50. echo -en 'travis_fold:end:script.build.multithread\\r'
  51. echo "Debug build and unit tests with valgrind" && echo -en 'travis_fold:start:script.build.unit_test\\r'
  52. mkdir -p build && cd build
  53. cmake \
  54. -DCHECK_PREFIX=/usr/local/Cellar/check/0.11.0 \
  55. -DCMAKE_BUILD_TYPE=Debug \
  56. -DUA_BUILD_EXAMPLES=ON \
  57. -DUA_BUILD_UNIT_TESTS=ON \
  58. -DUA_ENABLE_COVERAGE=OFF \
  59. -DUA_ENABLE_DISCOVERY=ON \
  60. -DUA_ENABLE_DISCOVERY_MULTICAST=ON \
  61. -DUA_ENABLE_ENCRYPTION=ON \
  62. -DUA_ENABLE_UNIT_TESTS_MEMCHECK=OFF ..
  63. make -j && make test ARGS="-V"
  64. if [ $? -ne 0 ] ; then exit 1 ; fi
  65. cd .. && rm -rf build
  66. echo -en 'travis_fold:end:script.build.unit_test\\r'