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
This commit is contained in:
James Zern 2021-12-10 19:44:36 -08:00
parent c846efd888
commit e94716e27c

View File

@ -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"