BuildMac.sh 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. #!/bin/sh
  2. #
  3. # A complete build script for Polycode on Mac OS X
  4. # Author: Mark Austin <[email protected]>
  5. #
  6. # Make sure you have the following libraries and tools installed prior to running a build
  7. # Xcode
  8. # py-ply
  9. # pkgconfig
  10. # cmake
  11. #
  12. # With macports you can easily install most of the needed libs with the following command:
  13. # sudo port install py-ply pkgconfig cmake
  14. #
  15. # Note: Building with macports versions will require changing your python version to the macports version
  16. # so that the lua binding build
  17. # sudo port select python python27
  18. #
  19. # Start
  20. #
  21. #
  22. # Validate that the build command exited cleanly
  23. #
  24. function validate(){
  25. if [ $? -eq 0 ]; then
  26. echo "[INFO] Build command executed successfully."
  27. else
  28. echo "[ERROR] One of the build commands failed!"
  29. exit 1
  30. fi
  31. }
  32. function cleanup(){
  33. # Do not remove this by default since it takes a while to download stuff
  34. # if [ -d Dependencies/Build ]; then
  35. # rm -fr Dependencies/Build
  36. # echo "[INFO] Removed previous Dependencies/Build folder."
  37. # fi
  38. if [ -d Build ]; then
  39. rm -fr Build
  40. echo "[INFO] Removed previous Build folder."
  41. fi
  42. if [ -d Standalone/Build ]; then
  43. rm -fr Standalone/Build
  44. echo "[INFO] Removed previous Standalone/Build folder."
  45. fi
  46. }
  47. #
  48. # Cleanup
  49. #
  50. cleanup
  51. #
  52. # Build debug and release static dependencies
  53. #
  54. mkdir -p Dependencies/Build
  55. cd Dependencies/Build
  56. cmake -G Xcode ..
  57. validate
  58. xcodebuild -target ALL_BUILD -configuration Debug
  59. validate
  60. xcodebuild -target ALL_BUILD -configuration Release
  61. validate
  62. cd ../../
  63. #
  64. # Build polycode player and bindings
  65. #
  66. mkdir -p Build
  67. cd Build
  68. cmake -G Xcode .. -DPOLYCODE_BUILD_BINDINGS=1 -DPOLYCODE_BUILD_PLAYER=1
  69. validate
  70. xcodebuild -DPOLYCODE_BUILD_BINDINGS=1 -DPOLYCODE_BUILD_PLAYER=1 -target ALL_BUILD -configuration Debug
  71. validate
  72. xcodebuild -target PolycodeLua -configuration Debug
  73. validate
  74. xcodebuild -target install -configuration Debug
  75. validate
  76. xcodebuild -DPOLYCODE_BUILD_BINDINGS=1 -DPOLYCODE_BUILD_PLAYER=1 -target ALL_BUILD -configuration Release
  77. validate
  78. xcodebuild -target PolycodeLua -configuration Release
  79. validate
  80. xcodebuild -target install -configuration Release
  81. validate
  82. cd ../
  83. #
  84. # Build standalone
  85. #
  86. mkdir -p Standalone/Build
  87. cd Standalone/Build
  88. cmake -G "Unix Makefiles" ..
  89. validate
  90. make install
  91. validate
  92. cd ../../
  93. #
  94. # Build IDE
  95. #
  96. cd IDE/Build/Mac\ OS\ X/
  97. xcodebuild
  98. validate
  99. #
  100. # End
  101. #
  102. exit 0