build_ios.sh 725 B

123456789101112131415161718192021222324252627282930
  1. #!/bin/bash
  2. set -ex -o pipefail
  3. echo ""
  4. echo "DIR: $(pwd)"
  5. VISION_IOS_ROOT=$(dirname $(realpath $0))
  6. if ! [ -n "${LIBTORCH_HEADER_ROOT:-}" ]; then
  7. echo "Missing parameter: LIBTORCH_HEADER_ROOT"
  8. exit 1
  9. fi
  10. if [ -n "${IOS_ARCH:-}" ]; then
  11. if [ "${IOS_ARCH:-}" == "arm64" ]; then
  12. IOS_PLATFORM="OS"
  13. elif [ "${IOS_ARCH:-}" == "x86_64" ]; then
  14. IOS_PLATFORM="SIMULATOR"
  15. fi
  16. fi
  17. mkdir -p ${VISION_IOS_ROOT}/lib
  18. mkdir -p ${VISION_IOS_ROOT}/build
  19. cd ${VISION_IOS_ROOT}/build
  20. cmake -DLIBTORCH_HEADER_ROOT=${LIBTORCH_HEADER_ROOT} \
  21. -DCMAKE_TOOLCHAIN_FILE=${VISION_IOS_ROOT}/../cmake/iOS.cmake \
  22. -DIOS_ARCH=${IOS_ARCH} \
  23. -DIOS_PLATFORM=${IOS_PLATFORM} \
  24. ..
  25. make
  26. rm -rf ${VISION_IOS_ROOT}/build