Skip to content

Commit 1f648a6

Browse files
authored
adding armv7 support for xcframework (#446)
1 parent 2745ba6 commit 1f648a6

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

Tools/build.sh

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ build_ios_dylib() {
157157
"$ACTION" ARCHS='armv7' RUN_CLANG_STATIC_ANALYZER=NO BUILD_DIR="${BUILD_DIR}${ARMV7_DIR}" \
158158
BUILD_ROOT="${BUILD_ROOT}" OTHER_CFLAGS="-fembed-bitcode" \
159159
GCC_PREPROCESSOR_DEFINITIONS="PACKAGE_IDENTIFIER=${LEANPLUM_PACKAGE_IDENTIFIER}"
160+
160161
run "Building Leanplum-SDK-iOS dynamic (device/armv7s) target ..." \
161162
xcodebuild -configuration "${CONFIGURATION}" -target "Leanplum-iOS-SDK" -sdk "${DEVICE_SDK}" \
162163
"$ACTION" ARCHS='armv7s' RUN_CLANG_STATIC_ANALYZER=NO BUILD_DIR="${BUILD_DIR}${ARMV7S_DIR}" \
@@ -189,19 +190,31 @@ build_ios_dylib() {
189190
"${CURRENTCONFIG_X86_DEVICE_DIR}/Leanplum-iOS-SDK/Leanplum.framework/Leanplum" \
190191
"${CURRENTCONFIG_X8664_SIMULATOR_DIR}/Leanplum-iOS-SDK/Leanplum.framework/Leanplum"
191192

192-
# Copy generated framework
193-
cp -r "${BUILD_DIR}$ARMV7_DIR/$CONFIGURATION-iphoneos/Leanplum-iOS-SDK/Leanplum.framework/" \
194-
"${RELEASE_DIR}/Leanplum.framework"
193+
# Copy generated framework and replace executable with fat library
194+
cp -r "${BUILD_DIR}$ARMV7_DIR/$CONFIGURATION-iphoneos/Leanplum-iOS-SDK/Leanplum.framework/" "${RELEASE_DIR}/Leanplum.framework"
195195
rm -f "${RELEASE_DIR}/Leanplum.framework/Leanplum"
196196
mv "${RELEASE_DIR}/Leanplum" "${RELEASE_DIR}/Leanplum.framework/"
197197

198+
# Create fat framework for phoneos that will be used in xcframework
199+
mkdir "${RELEASE_DIR}/phoneos/"
200+
run "Combining builds to phoneos fat library ..." \
201+
lipo -create -output "${RELEASE_DIR}/phoneos/Leanplum" \
202+
"${CURRENTCONFIG_ARMV7_DEVICE_DIR}/Leanplum-iOS-SDK/Leanplum.framework/Leanplum" \
203+
"${CURRENTCONFIG_ARM64_DEVICE_DIR}/Leanplum-iOS-SDK/Leanplum.framework/Leanplum"
204+
205+
cp -r "${BUILD_DIR}$ARMV7_DIR/$CONFIGURATION-iphoneos/Leanplum-iOS-SDK/Leanplum.framework/" "${RELEASE_DIR}/phoneos/Leanplum.framework"
206+
rm -f "${RELEASE_DIR}/phoneos/Leanplum.framework/Leanplum"
207+
mv "${RELEASE_DIR}/phoneos/Leanplum" "${RELEASE_DIR}/phoneos/Leanplum.framework/"
208+
198209
# create xcframework
199210
run "Combining builds into xcframework" \
200211
xcodebuild -create-xcframework \
201-
-framework "${CURRENTCONFIG_ARM64_DEVICE_DIR}/Leanplum-iOS-SDK/Leanplum.framework" \
212+
-framework "${RELEASE_DIR}/phoneos/Leanplum.framework" \
202213
-framework "${CURRENTCONFIG_X8664_SIMULATOR_DIR}/Leanplum-iOS-SDK/Leanplum.framework" \
203214
-output "${RELEASE_DIR}/Leanplum.xcframework"
204215

216+
rm -rf "${RELEASE_DIR}/phoneos/"
217+
205218
printf "%s\n" "Successfully built Leanplum-SDK (iOS) Framework."
206219
}
207220

0 commit comments

Comments
 (0)