summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Zern <jzern@google.com>2021-12-10 19:44:36 -0800
committerJames Zern <jzern@google.com>2021-12-10 19:44:36 -0800
commite94716e27c852053b7baa843b52a62e54c978d9e (patch)
tree374afde3d6aea8fe6a3906a88e67f5ba005a1fef
parentc846efd888616bf85c796b1deddeb4f4dd8623de (diff)
downloadlibwebp-e94716e27c852053b7baa843b52a62e54c978d9e.tar.gz
xcframeworkbuild.sh: place headers in a subdir
Headers/<framework> rather than Headers/ to avoid a Xcode error when using multiple frameworks: error: Multiple commands produce '.../Build/Products/Debug-iphoneos/include/types.h' WebPMux.xcframework/ios-arm64_i386_x86_64-simulator/Headers/WebPMux WebPMux.xcframework/ios-arm64_armv7_armv7s/Headers/WebPMux WebPMux.xcframework/macos-arm64_x86_64/Headers/WebPMux WebPMux.xcframework/ios-arm64_x86_64-maccatalyst/Headers/WebPMux WebPDecoder.xcframework/ios-arm64_i386_x86_64-simulator/Headers/WebPDecoder WebPDecoder.xcframework/ios-arm64_armv7_armv7s/Headers/WebPDecoder WebPDecoder.xcframework/macos-arm64_x86_64/Headers/WebPDecoder WebPDecoder.xcframework/ios-arm64_x86_64-maccatalyst/Headers/WebPDecoder WebPDemux.xcframework/ios-arm64_i386_x86_64-simulator/Headers/WebPDemux WebPDemux.xcframework/ios-arm64_armv7_armv7s/Headers/WebPDemux WebPDemux.xcframework/macos-arm64_x86_64/Headers/WebPDemux WebPDemux.xcframework/ios-arm64_x86_64-maccatalyst/Headers/WebPDemux WebP.xcframework/ios-arm64_i386_x86_64-simulator/Headers/WebP WebP.xcframework/ios-arm64_armv7_armv7s/Headers/WebP WebP.xcframework/macos-arm64_x86_64/Headers/WebP WebP.xcframework/ios-arm64_x86_64-maccatalyst/Headers/WebP Bug: webp:542 Change-Id: Ic7e03d85d2119597e422b9cf68b3ac5a892d494d
-rwxr-xr-xxcframeworkbuild.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/xcframeworkbuild.sh b/xcframeworkbuild.sh
index dc079455..45389cde 100755
--- a/xcframeworkbuild.sh
+++ b/xcframeworkbuild.sh
@@ -79,6 +79,26 @@ if [[ -z "${SDK[$IOS]}" ]] || [[ ${SDK[$IOS]%%.*} -lt 8 ]]; then
exit 1
fi
+#######################################
+# Moves Headers/*.h to Headers/<framework>/
+#
+# Places framework headers in a subdirectory to avoid Xcode errors when using
+# multiple frameworks:
+# error: Multiple commands produce
+# '.../Build/Products/Debug-iphoneos/include/types.h'
+# Arguments:
+# $1 - path to framework
+#######################################
+update_headers_path() {
+ local framework_name="$(basename ${1%.xcframework})"
+ local subdir
+ for d in $(find "$1" -path "*/Headers"); do
+ subdir="$d/$framework_name"
+ mkdir "$subdir"
+ mv "$d/"*.h "$subdir"
+ done
+}
+
echo "Xcode Version: ${XCODE}"
echo "iOS SDK Version: ${SDK[$IOS]}"
echo "MacOS SDK Version: ${SDK[$MACOS]}"
@@ -228,6 +248,10 @@ xcodebuild -create-xcframework "${FAT_DEMUXLIBLIST[@]}" \
-output ${DEMUXTARGETDIR}
xcodebuild -create-xcframework "${FAT_MUXLIBLIST[@]}" \
-output ${MUXTARGETDIR}
+update_headers_path "${TARGETDIR}"
+update_headers_path "${DECTARGETDIR}"
+update_headers_path "${DEMUXTARGETDIR}"
+update_headers_path "${MUXTARGETDIR}"
set +x
echo "SUCCESS"