From e94716e27c852053b7baa843b52a62e54c978d9e Mon Sep 17 00:00:00 2001 From: James Zern Date: Fri, 10 Dec 2021 19:44:36 -0800 Subject: [PATCH] xcframeworkbuild.sh: place headers in a subdir Headers/ 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 --- xcframeworkbuild.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) 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// +# +# 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"