Update the build scripts with destination-based instead of sdk-based
Which fix the issue on M1 Mac for x86_64 cross-build
This commit is contained in:
parent
b231b2c55e
commit
99770368b5
|
@ -1,5 +1,8 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
XCODE_VERSION=$(xcodebuild -version | head -n 1| awk -F ' ' '{print $2}')
|
XCODE_VERSION=$(xcodebuild -version | head -n 1| awk -F ' ' '{print $2}')
|
||||||
XCODE_VERSION_MAJOR=$(echo $XCODE_VERSION | awk -F '.' '{print $1}')
|
XCODE_VERSION_MAJOR=$(echo $XCODE_VERSION | awk -F '.' '{print $1}')
|
||||||
if [ -z "$SRCROOT" ]
|
if [ -z "$SRCROOT" ]
|
||||||
|
@ -8,32 +11,33 @@ then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p "${SRCROOT}/build"
|
mkdir -p "${SRCROOT}/build"
|
||||||
declare -a PLATFORMS=("iphoneos" "iphonesimulator" "macosx" "appletvos" "appletvsimulator" "watchos" "watchsimulator" "maccatalyst")
|
PLATFORMS=("iOS" "iOSSimulator" "macOS" "tvOS" "tvOSSimulator" "watchOS" "watchOSSimulator")
|
||||||
|
|
||||||
|
if [ $XCODE_VERSION_MAJOR -ge 11 ]
|
||||||
|
then
|
||||||
|
PLATFORMS+=("macCatalyst")
|
||||||
|
fi
|
||||||
|
|
||||||
if [ $XCODE_VERSION_MAJOR -ge 15 ]
|
if [ $XCODE_VERSION_MAJOR -ge 15 ]
|
||||||
then
|
then
|
||||||
PLATFORMS+=("xros")
|
PLATFORMS+=("visionOS")
|
||||||
PLATFORMS+=("xrsimulator")
|
PLATFORMS+=("visionOSSimulator")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for CURRENT_PLATFORM in "${PLATFORMS[@]}"
|
for CURRENT_PLATFORM in "${PLATFORMS[@]}"
|
||||||
do
|
do
|
||||||
if [[ $CURRENT_PLATFORM == *"simulator" ]]; then
|
DESTINATION="generic/platform=${CURRENT_PLATFORM}"
|
||||||
xcodebuild build -project "SDWebImage.xcodeproj" -sdk "${CURRENT_PLATFORM}" -scheme "SDWebImage" -configuration "Debug" -derivedDataPath "${SRCROOT}/build/DerivedData" CONFIGURATION_BUILD_DIR="${SRCROOT}/build/${CURRENT_PLATFORM}/"
|
|
||||||
else
|
|
||||||
# macOS Catalyst
|
# macOS Catalyst
|
||||||
if [[ $CURRENT_PLATFORM == "maccatalyst" ]]; then
|
if [[ $CURRENT_PLATFORM == "macCatalyst" ]]; then
|
||||||
if [[ $XCODE_VERSION_MAJOR -lt 11 ]]; then
|
DESTINATION="generic/platform=macOS,variant=Mac Catalyst"
|
||||||
# Xcode 10 does not support macOS Catalyst
|
|
||||||
continue
|
|
||||||
else
|
|
||||||
xcodebuild archive -project "SDWebImage.xcodeproj" -scheme "SDWebImage" -configuration "Release" -destination 'platform=macOS,arch=x86_64,variant=Mac Catalyst' -archivePath "${SRCROOT}/build/${CURRENT_PLATFORM}/SDWebImage.xcarchive" -derivedDataPath "${SRCROOT}/build/DerivedData" SKIP_INSTALL=NO
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
xcodebuild archive -project "SDWebImage.xcodeproj" -sdk "${CURRENT_PLATFORM}" -scheme "SDWebImage" -configuration "Release" -archivePath "${SRCROOT}/build/${CURRENT_PLATFORM}/SDWebImage.xcarchive" SKIP_INSTALL=NO
|
|
||||||
fi
|
fi
|
||||||
mv "${SRCROOT}/build/${CURRENT_PLATFORM}/SDWebImage.xcarchive/Products/Library/Frameworks/SDWebImage.framework" "${SRCROOT}/build/${CURRENT_PLATFORM}/"
|
|
||||||
mv "${SRCROOT}/build/${CURRENT_PLATFORM}/SDWebImage.xcarchive/dSYMs/SDWebImage.framework.dSYM" "${SRCROOT}/build/${CURRENT_PLATFORM}/"
|
# Simulator
|
||||||
rm -rf "${SRCROOT}/build/${CURRENT_PLATFORM}/SDWebImage.xcarchive/"
|
if [[ $CURRENT_PLATFORM == *Simulator ]]; then
|
||||||
|
CURRENT_PLATFORM_OS=${CURRENT_PLATFORM%Simulator}
|
||||||
|
DESTINATION="generic/platform=${CURRENT_PLATFORM_OS} Simulator"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
xcodebuild build -project "SDWebImage.xcodeproj" -destination "${DESTINATION}" -scheme "SDWebImage" -configuration "Release" -derivedDataPath "${SRCROOT}/build/DerivedData" CONFIGURATION_BUILD_DIR="${SRCROOT}/build/${CURRENT_PLATFORM}/"
|
||||||
done
|
done
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
XCODE_VERSION=$(xcodebuild -version | head -n 1| awk -F ' ' '{print $2}')
|
XCODE_VERSION=$(xcodebuild -version | head -n 1| awk -F ' ' '{print $2}')
|
||||||
XCODE_VERSION_MAJOR=$(echo $XCODE_VERSION | awk -F '.' '{print $1}')
|
XCODE_VERSION_MAJOR=$(echo $XCODE_VERSION | awk -F '.' '{print $1}')
|
||||||
if [ -z "$SRCROOT" ]
|
if [ -z "$SRCROOT" ]
|
||||||
|
@ -14,12 +17,18 @@ then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
declare -a PLATFORMS=("iphoneos" "iphonesimulator" "macosx" "appletvos" "appletvsimulator" "watchos" "watchsimulator")
|
mkdir -p "${SRCROOT}/build"
|
||||||
|
PLATFORMS=("iOS" "iOSSimulator" "macOS" "tvOS" "tvOSSimulator" "watchOS" "watchOSSimulator")
|
||||||
|
|
||||||
|
if [ $XCODE_VERSION_MAJOR -ge 11 ]
|
||||||
|
then
|
||||||
|
PLATFORMS+=("macCatalyst")
|
||||||
|
fi
|
||||||
|
|
||||||
if [ $XCODE_VERSION_MAJOR -ge 15 ]
|
if [ $XCODE_VERSION_MAJOR -ge 15 ]
|
||||||
then
|
then
|
||||||
PLATFORMS+=("xros")
|
PLATFORMS+=("visionOS")
|
||||||
PLATFORMS+=("xrsimulator")
|
PLATFORMS+=("visionOSSimulator")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
COMMAND_ARGS=""
|
COMMAND_ARGS=""
|
||||||
|
|
Loading…
Reference in New Issue