build.sh 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #!/bin/bash
  2. set -e
  3. dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
  4. pushd $dir > /dev/null
  5. if [ ! "$#" -eq 0 ] && [ ! "$#" -eq 2 ]; then
  6. echo "Usage: ./build.sh <Godot branch or tag> <dev>"
  7. echo
  8. echo "e.g.:"
  9. echo " ./build.sh 3.4.4-stable true"
  10. echo " ./build.sh master master"
  11. echo
  12. echo "If no arguments are given"
  13. read version
  14. exit 1
  15. fi
  16. if [ "$#" -eq 0 ] && [ ! -d ../godot ]; then
  17. echo "No Godot clone found. Run ./build.sh <Godot branch or tag> <dev> first."
  18. exit 1
  19. fi
  20. branch=${1%/}
  21. if [ "${2}" = "true" ]; then
  22. target="target=debug"
  23. else
  24. target=""
  25. fi
  26. pushd ..
  27. echo `pwd`
  28. if [ ! -z "$branch" ]; then
  29. rm -rf godot
  30. git clone --depth 1 https://github.com/godotengine/godot.git -b $branch
  31. if [ "${2}" = "true" ]; then
  32. cp -r .idea godot
  33. cp build/custom.py godot
  34. rm -rf example/.import
  35. rm -rf example/.godot
  36. fi
  37. fi
  38. cp -r ../spine-cpp/spine-cpp spine_godot
  39. popd
  40. pushd ../godot
  41. scons $target arch=x86_64 compiledb=yes custom_modules="../spine_godot" -j16
  42. if [ `uname` == 'Darwin' ]; then
  43. scons $target arch=arm64 compiledb=yes custom_modules="../spine_godot" -j16
  44. lipo -create bin/godot.osx.tools.x86_64 bin/godot.osx.tools.arm64 -output bin/godot.osx.tools.universal
  45. strip -S -x bin/godot.osx.tools.universal
  46. fi
  47. popd
  48. popd > /dev/null