Path: blob/master/misc/scripts/install_vulkan_sdk_macos.sh
9896 views
#!/usr/bin/env sh12set -euo pipefail3IFS=$'\n\t'4new_ver_full=''56# Check currently installed and latest available Vulkan SDK versions.7if command -v jq 2>&1 >/dev/null; then8curl -L "https://sdk.lunarg.com/sdk/download/latest/mac/config.json" -o /tmp/vulkan-sdk.json910new_ver_full=`jq -r '.version' /tmp/vulkan-sdk.json`11new_ver=`echo "$new_ver_full" | awk -F. '{ printf("%d%02d%04d%02d\n", $1,$2,$3,$4); }';`1213rm -f /tmp/vulkan-sdk.json1415for f in $HOME/VulkanSDK/*; do16if [ -d "$f" ]; then17f=`echo "${f##*/}" | awk -F. '{ printf("%d%02d%04d%02d\n", $1,$2,$3,$4); }';`18if [ $f -ge $new_ver ]; then19echo 'Latest or newer Vulkan SDK is already installed. Skipping installation.'20exit 021fi22fi23done24else25echo 'Error: Could not find 'jq' command. Is jq installed? Try running "brew install jq" or "port install jq" and rerunning this script.'26exit 127fi2829# Download and install the Vulkan SDK.30curl -L "https://sdk.lunarg.com/sdk/download/latest/mac/vulkan-sdk.zip" -o /tmp/vulkan-sdk.zip31unzip /tmp/vulkan-sdk.zip -d /tmp3233if [ -d "/tmp/vulkansdk-macOS-$new_ver_full.app" ]; then34/tmp/vulkansdk-macOS-$new_ver_full.app/Contents/MacOS/vulkansdk-macOS-$new_ver_full --accept-licenses --default-answer --confirm-command install35rm -rf /tmp/vulkansdk-macOS-$new_ver_full.app36else37echo "Couldn't install the Vulkan SDK, the unzipped contents may no longer match what this script expects."38exit 139fi4041rm -f /tmp/vulkan-sdk.zip4243echo 'Vulkan SDK installed successfully! You can now build Godot by running "scons".'444546