diff --git a/src/backend/tools/package_backend_framework.bash b/src/backend/tools/package_backend_framework.bash index c21727f9b7..3a55a05dd3 100644 --- a/src/backend/tools/package_backend_framework.bash +++ b/src/backend/tools/package_backend_framework.bash @@ -3,28 +3,19 @@ set -e SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -IOS_BACKEND_DIR=${SCRIPT_DIR}/../../../build/ios/src/backend/src -IOS_SIM_BACKEND_DIR=${SCRIPT_DIR}/../../../build/ios_simulator/src/backend/src -FAT_BIN_DIR=${SCRIPT_DIR}/../../../build/fat_bin +BUILD_DIR=${SCRIPT_DIR}/../../../build +IOS_BACKEND_DIR=${BUILD_DIR}/ios/src/backend/src +IOS_SIM_BACKEND_DIR=${BUILD_DIR}/ios_simulator/src/backend/src -mkdir -p ${FAT_BIN_DIR} - -if [ -d ${FAT_BIN_DIR}/mavsdk_server.framework ]; then - echo "${FAT_BIN_DIR}/mavsdk_server.framework already exists! Aborting..." +if [ -d ${BUILD_DIR}/mavsdk_server.xcframework ]; then + echo "${BUILD_DIR}/mavsdk_server.xcframework already exists! Aborting..." exit 1 fi -if [ -f ${FAT_BIN_DIR}/mavsdk_server.zip ]; then - echo "${FAT_BIN_DIR}/mavsdk_server.zip already exists! Aborting..." - exit 1 -fi - -echo "Creating fat bin..." - -cp -r ${IOS_BACKEND_DIR}/mavsdk_server.framework ${FAT_BIN_DIR} -lipo ${IOS_BACKEND_DIR}/mavsdk_server.framework/mavsdk_server ${IOS_SIM_BACKEND_DIR}/mavsdk_server.framework/mavsdk_server -create -output ${FAT_BIN_DIR}/mavsdk_server.framework/mavsdk_server +echo "Creating xcframework..." +xcodebuild -create-xcframework -framework ${IOS_BACKEND_DIR}/mavsdk_server.framework -framework ${IOS_SIM_BACKEND_DIR}/mavsdk_server.framework -output ${BUILD_DIR}/mavsdk_server.xcframework -cd ${FAT_BIN_DIR} -zip -9 -r mavsdk_server.zip mavsdk_server.framework +cd ${BUILD_DIR} +zip -9 -r mavsdk_server.zip mavsdk_server.xcframework -echo "Success! You'll find the fat bin in ${FAT_BIN_DIR}!" +echo "Success! You will find the xcframework in ${BUILD_DIR}!"