[tests] Build test libraries for [ios|tvos]simulator-arm64
This turned out a bit complicated, because we're lipo'ing together both the simulator and device slices, and that doesn't work anymore when ARM64 is both a simulator and a device architecture. The solution is a custom lipo logic that doesn't include the simulator version of the ARM64 architecture in the final binary.
This commit is contained in:
Родитель
ac441c1106
Коммит
8bf7b663be
|
@ -176,10 +176,10 @@ endef
|
|||
# 4: platform name
|
||||
# 5: min version
|
||||
# 6: os
|
||||
$(eval $(call Template,iphonesimulator,IOSSIMULATOR,x86 x86_64,iPhoneSimulator,-mios-simulator-version-min=8.0 -isysroot $(SIMULATOR_SDK)))
|
||||
$(eval $(call Template,iphonesimulator,IOSSIMULATOR,x86 x86_64 arm64,iPhoneSimulator,-mios-simulator-version-min=8.0 -isysroot $(SIMULATOR_SDK)))
|
||||
$(eval $(call Template,iphoneos,IPHONEOS,armv7 armv7s arm64,iPhoneOS,-miphoneos-version-min=8.0 -isysroot $(DEVICE_SDK)))
|
||||
ifdef INCLUDE_TVOS
|
||||
$(eval $(call Template,tvsimulator,TVSIMULATOR,x86_64,AppleTVSimulator,-mtvos-simulator-version-min=9.0 -isysroot $(SIMULATORTV_SDK)))
|
||||
$(eval $(call Template,tvsimulator,TVSIMULATOR,x86_64 arm64,AppleTVSimulator,-mtvos-simulator-version-min=9.0 -isysroot $(SIMULATORTV_SDK)))
|
||||
$(eval $(call Template,tvos,TVOS,arm64,AppleTVOS,-mtvos-version-min=9.0 -fembed-bitcode -isysroot $(DEVICETV_SDK)))
|
||||
endif
|
||||
ifdef INCLUDE_WATCH
|
||||
|
@ -228,15 +228,15 @@ endif
|
|||
define FatFrameworkTemplate
|
||||
.libs/$(1)/XStaticObjectTest.framework/XStaticObjectTest: .libs/$(2)/XStaticObjectTest.framework/XStaticObjectTest .libs/$(3)/XStaticObjectTest.framework/XStaticObjectTest | .libs/$(1)
|
||||
$(Q) mkdir -p $$(dir $$@)
|
||||
$(Q) lipo -create -output $$@ $$^
|
||||
$(Q) ./lipo-remove-sim-arm64.sh $$@ $$^
|
||||
|
||||
.libs/$(1)/XStaticArTest.framework/XStaticArTest: .libs/$(2)/XStaticArTest.framework/XStaticArTest .libs/$(3)/XStaticArTest.framework/XStaticArTest | .libs/$(1)
|
||||
$(Q) mkdir -p $$(dir $$@)
|
||||
$(Q) lipo -create -output $$@ $$^
|
||||
$(Q) ./lipo-remove-sim-arm64.sh $$@ $$^
|
||||
|
||||
.libs/$(1)/XTest.framework$($(4)_BINARY_INFIX)/XTest: .libs/$(2)/XTest.framework$($(4)_BINARY_INFIX)/XTest .libs/$(3)/XTest.framework$($(4)_BINARY_INFIX)/XTest | .libs/$(1)
|
||||
$(Q) mkdir -p $$(dir $$@)
|
||||
$(Q) lipo -create -output $$@ $$^
|
||||
$(Q) ./lipo-remove-sim-arm64.sh $$@ $$^
|
||||
|
||||
.libs/$(1)/XTest.framework$($(4)_INFO_PLIST_INFIX)/Info.plist: .libs/$(2)/XTest.framework$($(4)_INFO_PLIST_INFIX)/Info.plist .libs/$(3)/XTest.framework$($(4)_INFO_PLIST_INFIX)/Info.plist
|
||||
$(Q) mkdir -p $$(dir $$@)
|
||||
|
@ -248,13 +248,13 @@ endif
|
|||
$(Q) $(CP) $$< $$@
|
||||
|
||||
.libs/$(1)/libtest.a: .libs/$(2)/libtest.a .libs/$(3)/libtest.a | .libs/$(1)
|
||||
$(Q) lipo -create -output $$@ $$^
|
||||
$(Q) ./lipo-remove-sim-arm64.sh $$@ $$^
|
||||
|
||||
.libs/$(1)/libtest2.a: .libs/$(2)/libtest2.a .libs/$(3)/libtest2.a | .libs/$(1)
|
||||
$(Q) lipo -create -output $$@ $$^
|
||||
$(Q) ./lipo-remove-sim-arm64.sh $$@ $$^
|
||||
|
||||
.libs/$(1)/libtest.dylib: .libs/$(2)/libtest.dylib .libs/$(3)/libtest.dylib | .libs/$(1)
|
||||
$(Q) lipo -create -output $$@ $$^
|
||||
$(Q) ./lipo-remove-sim-arm64.sh $$@ $$^
|
||||
|
||||
$(3)_TARGETS += \
|
||||
.libs/$(1)/XTest.framework$($(4)_BINARY_INFIX)/XTest \
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
# This is a script that wraps lipo, but removes any arm64 slices for any input
|
||||
# binaries built for the simulator before running the actual lipo. The problem
|
||||
# is that device slices may also contain arm64 slices, and lipo complains if
|
||||
# there are more than one slice with the same architecture. The eventual fix
|
||||
# is to not use binaries that span more than one platform (ios+iossimulator
|
||||
# for instance), but instead use xcframeworks.
|
||||
|
||||
OUTPUT="$1"
|
||||
shift
|
||||
INPUTS=($@)
|
||||
TMPFILES=()
|
||||
|
||||
function cleanup ()
|
||||
{
|
||||
for element in "${TMPFILES[@]}"; do
|
||||
rm -f "$element"
|
||||
done
|
||||
}
|
||||
trap "cleanup" EXIT
|
||||
|
||||
for index in "${!INPUTS[@]}"; do
|
||||
INPUT="${INPUTS[$index]}"
|
||||
#printf "INPUTS[%s]=%s\n" "$index" "${INPUTS[$index]}"
|
||||
if [[ "$INPUT" =~ simulator/ ]]; then
|
||||
TMPFILE=$(mktemp)
|
||||
TMPFILES+=("$TMPFILE")
|
||||
if lipo "$INPUT" -verify_arch arm64; then
|
||||
if test -n "$V"; then echo "Removing ARM64 from $INPUT and writing to $TMPFILE"; fi
|
||||
lipo "$INPUT" -remove arm64 -output "$TMPFILE"
|
||||
INPUTS[$index]="$TMPFILE"
|
||||
else
|
||||
if test -n "$V"; then echo "The file $INPUT does not contain an ARM64 slice"; fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
lipo -create -output "$OUTPUT" "${INPUTS[@]}"
|
Загрузка…
Ссылка в новой задаче