Skip to content

Commit

Permalink
Merge pull request #1225 from mavlink/move-to-xcframework
Browse files Browse the repository at this point in the history
iOS: build xcframework instead of fat binary
  • Loading branch information
JonasVautherin authored Oct 13, 2020
2 parents 3e63184 + 0e2a673 commit 5510f82
Showing 1 changed file with 10 additions and 19 deletions.
29 changes: 10 additions & 19 deletions src/backend/tools/package_backend_framework.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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}!"

0 comments on commit 5510f82

Please sign in to comment.