moltenvk/Scripts/create_xcframework_func.sh
Bill Hollings 56df7d61d7 Remove MoltenVK fat libraries and frameworks and use XCFramework instead.
- Delete fat library and framework scripts and templates.
- MoltenVK build package now only includes one XCFramework, and separate platform dylibs.
- Modify fetchDependencies and Makefile targets to not build fat libraries,
  and to build simulators separately than platforms instead.
- Script package_moltenvk.sh now copies dylibs for all built platforms.
- Consolidate package_all.sh and delete package_one_os.sh.
- Swap names of copy_lib_to_staging.sh and copy_to_staging.sh scripts.
- Cube demo now uses MoltenVK as XCFramework, and support Simulator builds.
- Hologram demo now uses MoltenVK as dylibs from new packaging location.
- API-Samples demo now uses MoltenVK as XCFramework.
- Update documentation.
2020-09-01 14:39:46 -04:00

28 lines
946 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}/${prod_name}.xcframework"
hdr_path="${MVK_XCFWK_STAGING_DIR}/Headers/${prod_name}"
xcfwk_cmd="xcodebuild -quiet -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"
if [[ -e "${prod_lib_path}" ]]; then
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
fi
done
rm -rf "${xcfwk_path}"
eval "${xcfwk_cmd}"
}