install_vulkan_sdk_macos.sh 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/usr/bin/env sh
  2. set -euo pipefail
  3. IFS=$'\n\t'
  4. new_ver_full=''
  5. # Check currently installed and latest available Vulkan SDK versions.
  6. if command -v jq 2>&1 >/dev/null; then
  7. curl -L "https://sdk.lunarg.com/sdk/download/latest/mac/config.json" -o /tmp/vulkan-sdk.json
  8. new_ver_full=`jq -r '.version' /tmp/vulkan-sdk.json`
  9. new_ver=`echo "$new_ver_full" | awk -F. '{ printf("%d%02d%04d%02d\n", $1,$2,$3,$4); }';`
  10. rm -f /tmp/vulkan-sdk.json
  11. for f in $HOME/VulkanSDK/*; do
  12. if [ -d "$f" ]; then
  13. f=`echo "${f##*/}" | awk -F. '{ printf("%d%02d%04d%02d\n", $1,$2,$3,$4); }';`
  14. if [ $f -ge $new_ver ]; then
  15. echo 'Latest or newer Vulkan SDK is already installed. Skipping installation.'
  16. exit 0
  17. fi
  18. fi
  19. done
  20. fi
  21. # Download and install the Vulkan SDK.
  22. curl -L "https://sdk.lunarg.com/sdk/download/latest/mac/vulkan-sdk.zip" -o /tmp/vulkan-sdk.zip
  23. unzip /tmp/vulkan-sdk.zip -d /tmp
  24. if [ -d "/tmp/InstallVulkan-$new_ver_full.app" ]; then
  25. /tmp/InstallVulkan-$new_ver_full.app/Contents/MacOS/InstallVulkan-$new_ver_full --accept-licenses --default-answer --confirm-command install
  26. rm -rf /tmp/InstallVulkan-$new_ver_full.app
  27. elif [ -d "/tmp/InstallVulkan.app" ]; then
  28. /tmp/InstallVulkan.app/Contents/MacOS/InstallVulkan --accept-licenses --default-answer --confirm-command install
  29. rm -rf /tmp/InstallVulkan.app
  30. fi
  31. rm -f /tmp/vulkan-sdk.zip
  32. echo 'Vulkan SDK installed successfully! You can now build Godot by running "scons".'