build.sh 819 B

12345678910111213141516171819202122232425262728293031323334
  1. #!/bin/sh
  2. # This script is used by CI to build for a specific flavor. It can be used
  3. # locally: `./workspace/build.sh [linux|android] [sync]`
  4. #
  5. # For Android builds, you must set the ANDROID_NDK_PATH environment variable
  6. # to point to your Android NDK installation.
  7. flavor=${1:-linux}
  8. sync=${2}
  9. nprocs=4
  10. if [ "$(uname)" = "Linux" ]; then
  11. nprocs=$(grep -c ^processor /proc/cpuinfo)
  12. fi
  13. set -e
  14. rm -rf ci.build
  15. mkdir -p ci.build
  16. cd ci.build
  17. cmake_flags=""
  18. if [ "${flavor}" = "android" ]; then
  19. [ -z $ANDROID_NDK_PATH ] && (echo "ANDROID_NDK_PATH is not set!"; exit 1)
  20. cmake_flags="-DREALM_PLATFORM=Android -DANDROID_NDK=${ANDROID_NDK_PATH}"
  21. fi
  22. if [ "${sync}" = "sync" ]; then
  23. cmake_flags="${cmake_flags} -DREALM_ENABLE_SYNC=1 -DREALM_ENABLE_SERVER=1"
  24. fi
  25. cmake ${cmake_flags} ..
  26. make VERBOSE=1 -j${nprocs}