Skip to content

Commit 7e109d4

Browse files
authored
Merge pull request #3 from humbletim/humbletim-patch-1
add support for sdk-x.y.z branch names
2 parents bf47d4f + b990054 commit 7e109d4

File tree

4 files changed

+68
-16
lines changed

4 files changed

+68
-16
lines changed

.github/workflows/ci.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,19 @@ jobs:
4444
echo "VULKAN_SDK=='$VULKAN_SDK'"
4545
test -n "$VULKAN_SDK_VERSION"
4646
47+
setup-ubuntu-with-sdk-version:
48+
runs-on: ubuntu-latest
49+
steps:
50+
- uses: actions/checkout@v2
51+
- uses: ./
52+
with:
53+
vulkan-version: sdk-1.1.101
54+
- name: Test Vulkan SDK Install
55+
run: |
56+
echo "Vulkan SDK Version=='$VULKAN_SDK_VERSION'"
57+
echo "VULKAN_SDK=='$VULKAN_SDK'"
58+
test -n "$VULKAN_SDK_VERSION"
59+
4760
setup-windows-without-version:
4861
runs-on: windows-latest
4962
steps:

README.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# setup-vulkan-sdk v1.0.1
1+
# setup-vulkan-sdk v1.0.2
22

33
<p align="left">
44
<a href="https://github.com/humbletim/setup-vulkan-sdk"><img alt="GitHub Actions status" src="https://github.com/humbletim/setup-vulkan-sdk/workflows/Setup/badge.svg"></a>
@@ -13,26 +13,35 @@ This action builds a subset of the Vulkan SDK from source and makes the results
1313
To build against the latest Vulkan SDK:
1414
```yaml
1515
-name: Install Vulkan SDK
16-
uses: humbletim/[email protected].1
16+
uses: humbletim/[email protected].2
1717
```
1818
1919
## Parameters
2020
2121
- `vulkan-version`:
22-
*(Optional)* valid SDK release number (eg: 1.2.161.1). Default: `latest`
22+
*(Optional)* valid SDK release number (eg: 1.2.161.1) or git branch (eg: sdk-1.2.161). Default: `latest`
2323
- Available release numbers can be found here: https://vulkan.lunarg.com/sdk/home
24+
- Note: sdk-x.y.z branches are used directly whereas release numbers get resolved through Vulkan SDK webservices
2425

25-
## Specifying an exact SDK version:
26+
## Specifying an exact SDK by *packaged release number*:
2627
```yaml
2728
-name: Install Vulkan SDK
28-
uses: humbletim/[email protected].1
29+
uses: humbletim/[email protected].2
2930
with:
3031
vulkan-version: 1.2.161.1
3132
```
3233

34+
## Specifying an exact SDK by *khronos git branch*:
35+
```yaml
36+
-name: Install Vulkan SDK
37+
uses: humbletim/[email protected]
38+
with:
39+
vulkan-version: sdk-1.1.108
40+
```
41+
3342
## How it works
3443

35-
First [action.yml](action.yml) installs the minimum dependencies needed to compile Vulkan SDK from source. It then delegates to [install_vulkan_sdk.sh](install_vulkan_sdk.sh), which resolves `vulkan-version` into a corresponding git branch using the official Vulkan SDK [web services](https://vulkan.lunarg.com/content/view/latest-sdk-version-api).
44+
First [action.yml](action.yml) installs the minimum dependencies needed to compile Vulkan SDK from source. It then delegates to [install_vulkan_sdk.sh](install_vulkan_sdk.sh), which if needed resolves `vulkan-version` into a corresponding git branch using the official Vulkan SDK [web services](https://vulkan.lunarg.com/content/view/latest-sdk-version-api).
3645

3746
[KhronosGroup/Vulkan-Headers](https://github.com/KhronosGroup/Vulkan-Headers) and [KhronosGroup/Vulkan-Loader](https://github.com/KhronosGroup/Vulkan-Loader) repos are then cloned locally to that branch point, built, and installed into `$PWD/VULKAN_SDK`. And finally a `VULKAN_SDK` environment variable is exported for later build tools to discover the SDK's location through.
3847

action.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ branding:
55
color: 'red'
66
inputs:
77
vulkan-version:
8-
description: 'specify a Vulkan SDK release version, e.g. 1.2.162.1'
8+
description: 'specify a Vulkan SDK release version, e.g. 1.2.162.1 (or git branch like sdk-1.2.162)'
99
default: 'latest'
1010
required: false
1111
vulkan-version-linux:
12-
description: 'specify a linux-specific Vulkan SDK release version, e.g. 1.2.162.1'
12+
description: 'specify a linux-specific Vulkan SDK release version, e.g. 1.2.162.1 (or git branch like sdk-1.2.162)'
1313
default: ''
1414
required: false
1515
vulkan-version-windows:
16-
description: 'specify a windows-specific Vulkan SDK release version, e.g. 1.2.162.1'
16+
description: 'specify a windows-specific Vulkan SDK release version, e.g. 1.2.162.1 (or git branch like sdk-1.2.162)'
1717
default: ''
1818
required: false
1919
runs:

install_vulkan_sdk.sh

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
# currently outputs into VULKAN_SDK in the current directory
44
# 2021.02 humbletim -- released under the MIT license
55

6-
# usage: ./install_vulkan_sdk.sh <SDK_release_version>
7-
# eg: ./install_vulkan_sdk.sh 1.2.162.1
6+
# usage: ./install_vulkan_sdk.sh <SDK_release_version | sdk-x.y.z>
7+
# eg: ./install_vulkan_sdk.sh 1.2.162.1 # branch resolved via service
8+
# eg: ./install_vulkan_sdk.sh sdk-1.2.162 # branch used directly
89

910
# log messages will be printed to STDERR (>&2)
1011
# these sourcable environment variables will be printed to STDOUT on success:
@@ -34,18 +35,45 @@ case `uname -s` in
3435
esac
3536
echo os=$os >&2
3637

37-
# convert an official SDK Release Number into an actual git commit tag (eg: 1.2.162.1 => sdk-1.2.162)
38-
BRANCH=$(curl https://vulkan.lunarg.com/sdk/config/$VK_VERSION/$os/config.json | jq '.repos["Vulkan-Headers"].branch' --raw-output)
38+
# resolve latest into an actual SDK release number (currently only used for troubleshooting / debug output)
39+
REAL_VK_VERSION=$VK_VERSION
40+
if [[ $VK_VERSION == latest ]] ; then
41+
REAL_VK_VERSION=$(curl -s https://vulkan.lunarg.com/sdk/latest.json | jq .$os --raw-output)
42+
echo "resolved $VK_VERSION=$REAL_VK_VERSION" >&2
43+
fi
44+
45+
if [[ $VK_VERSION == sdk-*.*.* ]] ; then
46+
echo "using specified branch/tag name as-is: $VK_VERSION" >&2
47+
BRANCH=$VK_VERSION
48+
else
49+
# convert an official SDK Release Number into an actual git commit tag (eg: 1.2.162.1 => sdk-1.2.162)
50+
BRANCH=$(curl -s https://vulkan.lunarg.com/sdk/config/$VK_VERSION/$os/config.json | jq '.repos["Vulkan-Headers"].branch' --raw-output)
51+
fi
52+
3953
echo BRANCH=$BRANCH >&2
4054

41-
mkdir VULKAN_SDK/_build
55+
if [[ $BRANCH == null ]] ; then
56+
echo "error: could not resolve $VK_VERSION ($REAL_VK_VERSION) into a git branch via Vulkan SDK service" >&2
57+
echo "raw CURL output (https://vulkan.lunarg.com/sdk/config/$VK_VERSION/$os/config.json)" >&2
58+
echo "-------------------------------------------------------" >&2
59+
curl -i https://vulkan.lunarg.com/sdk/config/$VK_VERSION/$os/config.json >&2
60+
echo -e "\n-------------------------------------------------------" >&2
61+
echo "NOTE -- according to the web service, these versions are available for os=$os:" >&2
62+
curl -s https://vulkan.lunarg.com/sdk/versions/$os.json | jq --raw-output '.[]' >&2
63+
echo -e "\n... aborting" >&2
64+
exit 1
65+
fi
66+
67+
test -d VULKAN_SDK/_build || mkdir VULKAN_SDK/_build
4268
pushd VULKAN_SDK/_build >&2
69+
4370
git clone https://github.com/KhronosGroup/Vulkan-Headers.git --branch $BRANCH >&2
4471
pushd Vulkan-Headers >&2
4572
cmake -DCMAKE_INSTALL_PREFIX=../.. -DCMAKE_BUILD_TYPE=Release . >&2
4673
cmake --build . --config Release >&2
4774
cmake --install . >&2
4875
popd >&2
76+
4977
git clone https://github.com/KhronosGroup/Vulkan-Loader.git --branch $BRANCH >&2
5078
pushd Vulkan-Loader >&2
5179
cmake -DVULKAN_HEADERS_INSTALL_DIR=../.. -DCMAKE_INSTALL_PREFIX=../.. -DCMAKE_BUILD_TYPE=Release . >&2
@@ -54,6 +82,8 @@ pushd VULKAN_SDK/_build >&2
5482
popd >&2
5583
popd >&2
5684

85+
echo "" >&2
86+
5787
# export these so that "sourcing" this file directly also works
5888
export VULKAN_SDK_VERSION=$BRANCH
5989
export VULKAN_SDK=$PWD/VULKAN_SDK
@@ -65,6 +95,6 @@ echo VULKAN_SDK=$VULKAN_SDK
6595
# cleanup _build artifacts which are no longer needed after cmake --installs above
6696
rm -rf VULKAN_SDK/_build >&2
6797

68-
echo "VULKAN_SDK/" >&2
69-
ls VULKAN_SDK >&2
98+
# echo "VULKAN_SDK/" >&2
99+
# ls VULKAN_SDK >&2
70100
du -hs VULKAN_SDK >&2

0 commit comments

Comments
 (0)