moltenvk/Scripts/create_xcframework.sh
Bill Hollings dd59aea71f Use external libraries as XCFrameworks.
Exclude arm64 architectures on macOS and Simulators.
Exclude arm64e architectures on iOS and tvOS.
Stop building fat libraries for external libraries.
Remove package_ext_libs.sh script.
Don't include Headers in ext lib XCFrameworks because of Xcode12 bug in using them.
2020-08-20 15:24:35 -04:00

26 lines
910 B
Bash
Executable File

#!/bin/bash
# Creates a universal XCFramework for a product from any libraries that can be found for the product.
#
# Takes one parameter:
# 1 - product_name
#
# Requires the variables MVK_XCFWK_STAGING_DIR and MVK_XCFWK_DEST_DIR.
#
function create_xcframework() {
prod_name=${1}
xcfwk_path="${MVK_XCFWK_DEST_DIR}/${CONFIGURATION}/${prod_name}.xcframework"
hdr_path="${MVK_XCFWK_STAGING_DIR}/Headers/${prod_name}"
xcfwk_cmd="xcodebuild -create-xcframework -output \"${xcfwk_path}\""
for prod_staging_dir in "${MVK_XCFWK_STAGING_DIR}/${CONFIGURATION}"/*; do
prod_lib_path="${prod_staging_dir}/lib${prod_name}.a"
xcfwk_cmd+=" -library \"${prod_lib_path}\""
# xcfwk_cmd+=" -headers \"${hdr_path}\"" # Headers currently break build during usage due to Xcode 12 bug: https://developer.apple.com/forums/thread/651043?answerId=628400022#628400022
done
rm -rf "${xcfwk_path}"
eval "${xcfwk_cmd}"
}