Skip to content

Commit 19732dd

Browse files
committed
Fix macos build
1 parent 3b1e48d commit 19732dd

File tree

1 file changed

+34
-8
lines changed

1 file changed

+34
-8
lines changed

install_vulkan_sdk_macos.sh

+34-8
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,45 @@
1+
12
#!/usr/bin/env sh
23

34
set -euo pipefail
45
IFS=$'\n\t'
6+
new_ver_full=''
7+
8+
# Check currently installed and latest available Vulkan SDK versions.
9+
if command -v jq 2>&1 >/dev/null; then
10+
curl -L "https://sdk.lunarg.com/sdk/download/latest/mac/config.json" -o /tmp/vulkan-sdk.json
11+
12+
new_ver_full=`jq -r '.version' /tmp/vulkan-sdk.json`
13+
new_ver=`echo "$new_ver_full" | awk -F. '{ printf("%d%02d%04d%02d\n", $1,$2,$3,$4); }';`
14+
15+
rm -f /tmp/vulkan-sdk.json
16+
17+
for f in $HOME/VulkanSDK/*; do
18+
if [ -d "$f" ]; then
19+
f=`echo "${f##*/}" | awk -F. '{ printf("%d%02d%04d%02d\n", $1,$2,$3,$4); }';`
20+
if [ $f -ge $new_ver ]; then
21+
echo 'Latest or newer Vulkan SDK is already installed. Skipping installation.'
22+
exit 0
23+
fi
24+
fi
25+
done
26+
else
27+
echo 'Error: Could not find 'jq' command. Is jq installed? Try running "brew install jq" or "port install jq" and rerunning this script.'
28+
exit 1
29+
fi
530

631
# Download and install the Vulkan SDK.
732
curl -L "https://sdk.lunarg.com/sdk/download/latest/mac/vulkan-sdk.zip" -o /tmp/vulkan-sdk.zip
8-
unzip -l /tmp/vulkan-sdk.zip | grep 'InstallVulkan.*\.app' | head -n 1 | awk '{print $4}' | tr -d '/' > /tmp/install_app_name
9-
1033
unzip /tmp/vulkan-sdk.zip -d /tmp
11-
install_app_name=$(cat /tmp/install_app_name)
12-
/tmp/$install_app_name/Contents/MacOS/${install_app_name%\.app} \
13-
--accept-licenses --default-answer --confirm-command install
1434

15-
rm -rf /tmp/$install_app_name
35+
if [ -d "/tmp/vulkansdk-macOS-$new_ver_full.app" ]; then
36+
/tmp/vulkansdk-macOS-$new_ver_full.app/Contents/MacOS/vulkansdk-macOS-$new_ver_full --accept-licenses --default-answer --confirm-command install
37+
rm -rf /tmp/vulkansdk-macOS-$new_ver_full.app
38+
else
39+
echo "Couldn't install the Vulkan SDK, the unzipped contents may no longer match what this script expects."
40+
exit 1
41+
fi
42+
1643
rm -f /tmp/vulkan-sdk.zip
17-
rm -f /tmp/install_app_name
1844

19-
echo 'Vulkan SDK installed successfully! You can now build Godot by running "scons".'
45+
echo 'Vulkan SDK installed successfully! You can now build Godot by running "scons".'

0 commit comments

Comments
 (0)