macos-build.sh 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #!/bin/bash
  2. export LANG=C
  3. COMMAND_LINE="$*"
  4. function has_option()
  5. {
  6. echo "$COMMAND_LINE" | grep "\-$1" &>/dev/null
  7. return $?
  8. }
  9. if has_option "h" ; then
  10. echo "Usage: $0 [-option|--long-build-option...]|[-h|--help]"
  11. echo "With -d, --debug : build the Debug viewer binary instead of Release."
  12. echo " -s, --symbols : build with debugging symbols (RelWithDebInfo viewer binary)."
  13. echo " -h, --help : this help..."
  14. exit 0
  15. fi
  16. export PATH="/Applications/CMake.app/Contents/bin:$PATH"
  17. if ! which cmake &>/dev/null; then
  18. echo
  19. echo "You need to have 'cmake' installed and in your PATH !".
  20. exit 1
  21. fi
  22. top=`pwd`
  23. if ! [ -x "./scripts/develop.py" ] ; then
  24. echo
  25. echo "This script must be ran from the linden/ Cool VL Viewer sources directory !".
  26. exit 1
  27. fi
  28. BUILD_TYPE="Release"
  29. if has_option "d" ; then
  30. BUILD_TYPE="Debug"
  31. elif has_option "s" ; then
  32. BUILD_TYPE="RelWithDebInfo"
  33. fi
  34. ./scripts/develop.py -t $BUILD_TYPE configure -DNO_FATAL_WARNINGS:BOOL=TRUE
  35. if ! [ -d "$top/build-darwin-x86_64/CoolVLViewer.xcodeproj" ] ; then
  36. echo
  37. echo "Failed to generate the project files, sorry !"
  38. exit 1
  39. fi
  40. # Create a dummy (empty) directory to prevent warnings at link time since cmake
  41. # apparently adds a spurious "Release" sub-directory search path for libraries...
  42. mkdir -p "$top/lib/release/Release"
  43. # Same thing for "RelWithDebInfo" and "Debug" build types, in case you would
  44. # need them instead of "Release".
  45. mkdir -p "$top/lib/release/RelWithDebInfo" "$top/lib/debug/RelWithDebInfo"
  46. mkdir -p "$top/lib/release/Debug" "$top/lib/debug/Debug"
  47. pushd build-darwin-x86_64
  48. xcodebuild -project CoolVLViewer.xcodeproj -target ALL_BUILD
  49. popd
  50. if [ -d "build-darwin-x86_64/Cool VL Viewer.app" ] ; then
  51. echo "Packaged viewer available in $top/build-darwin-x86_64/Cool VL Viewer.app"
  52. else
  53. echo "Build failed... :-("
  54. fi