Remove EXCLUDED_ARCHS from all Xcode projects to allow fat platform libraries to be built. Script copy_lib_to_staging.sh no longer breaks fat libraries into single-architecture libraries, and simply copies fat file to XCFramework staging area. This permits support for arm64 on macOS, and arm64e on iOS and tvOS. Creating a Simulator dylib containing both x86_64 and arm64 (Apple Silicon) architectures is not currently supported by Xcode, so Simulator dylibs are skipped.
42 lines
1.2 KiB
Bash
Executable File
42 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
# Copy dylibs only if the source directory exists.
|
|
# Takes two args: source build path OS suffix and destination path OS directory name
|
|
function copy_dylib() {
|
|
src_dir="${BUILD_DIR}/${CONFIGURATION}${1}/dynamic"
|
|
dst_dir="${MVK_PKG_PROD_PATH}/dylib/${2}"
|
|
|
|
# If dylib file exists, copy it, any debug symbol file, and the Vulkan layer JSON file
|
|
src_file="${src_dir}/lib${MVK_PROD_NAME}.dylib"
|
|
if [[ -e "${src_file}" ]]; then
|
|
rm -rf "${dst_dir}"
|
|
mkdir -p "${dst_dir}"
|
|
|
|
cp -a "${src_file}" "${dst_dir}"
|
|
|
|
src_file+=".dSYM"
|
|
if [[ -e "${src_file}" ]]; then
|
|
cp -a "${src_file}" "${dst_dir}"
|
|
fi
|
|
|
|
cp -a "${MVK_PROD_PROJ_PATH}/icd/${MVK_PROD_NAME}_icd.json" "${dst_dir}"
|
|
|
|
fi
|
|
}
|
|
|
|
export MVK_PROD_NAME="MoltenVK"
|
|
export MVK_PROD_PROJ_PATH="${PROJECT_DIR}/${MVK_PROD_NAME}"
|
|
export MVK_PKG_PROD_PATH="${PROJECT_DIR}/Package/${CONFIGURATION}/${MVK_PROD_NAME}"
|
|
|
|
copy_dylib "" "macOS"
|
|
copy_dylib "-iphoneos" "iOS"
|
|
copy_dylib "-iphonesimulator" "iOS-simulator"
|
|
copy_dylib "-appletvos" "tvOS"
|
|
copy_dylib "-appletvsimulator" "tvOS-simulator"
|
|
|
|
# Remove and replace header include folder
|
|
rm -rf "${MVK_PKG_PROD_PATH}/include"
|
|
cp -pRL "${MVK_PROD_PROJ_PATH}/include" "${MVK_PKG_PROD_PATH}"
|