From 39f3fa7d5b890941ca7fb2beea92e43a5ad2a951 Mon Sep 17 00:00:00 2001 From: Ralph Sennhauser Date: Mon, 16 Sep 2024 20:07:58 +0200 Subject: [PATCH] Package spirv-reflect for building shaders Usually not available in Linux Distributions as it isn't customary to package the SDK but only the bits needed as separate packages. Signed-off-by: Ralph Sennhauser --- .gitignore | 1 + libraries/build-source-libs.sh | 5 ++++ libraries/source/spirv-reflect/build.sh | 35 +++++++++++++++++++++++++ 3 files changed, 41 insertions(+) create mode 100755 libraries/source/spirv-reflect/build.sh diff --git a/.gitignore b/.gitignore index 5494d4fe16..acd1146d6f 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,7 @@ libraries/source/cxxtest-4.4/* libraries/source/fcollada/* libraries/source/nvtt/* libraries/source/spidermonkey/* +libraries/source/spirv-reflect/* !libraries/source/**/build.sh !libraries/source/**/patches/ diff --git a/libraries/build-source-libs.sh b/libraries/build-source-libs.sh index b37d76f3d1..d735563b36 100755 --- a/libraries/build-source-libs.sh +++ b/libraries/build-source-libs.sh @@ -24,6 +24,7 @@ esac without_nvtt=false with_system_nvtt=false with_system_mozjs=false +with_spirv_reflect=false JOBS=${JOBS:="-j2"} @@ -32,6 +33,7 @@ for i in "$@"; do --without-nvtt) without_nvtt=true ;; --with-system-nvtt) with_system_nvtt=true ;; --with-system-mozjs) with_system_mozjs=true ;; + --with-spirv-reflect) with_spirv_reflect=true ;; -j*) JOBS=$i ;; esac done @@ -67,5 +69,8 @@ if [ "$with_system_mozjs" = "false" ]; then cp source/spidermonkey/bin/* ../binaries/system/ fi echo +if [ "$with_spirv_reflect" = "true" ]; then + ./source/spirv-reflect/build.sh || die "spirv-reflect build failed" +fi echo "Done." diff --git a/libraries/source/spirv-reflect/build.sh b/libraries/source/spirv-reflect/build.sh new file mode 100755 index 0000000000..916b4ee032 --- /dev/null +++ b/libraries/source/spirv-reflect/build.sh @@ -0,0 +1,35 @@ +#!/bin/sh +set -e + +cd "$(dirname "$0")" + +PV=1.3.290.0 +LIB_VERSION=${PV} + +if [ -e .already-built ] && [ "$(cat .already-built || true)" = "${LIB_VERSION}" ]; then + echo "spirv-reflect is already up to date." + exit +fi + +# fetch +if [ ! -e "vulkan-sdk-${PV}.tar.gz" ]; then + curl -fLo "vulkan-sdk-${PV}.tar.gz" \ + "https://github.com/KhronosGroup/SPIRV-Reflect/archive/refs/tags/vulkan-sdk-${PV}.tar.gz" +fi + +# unpack +rm -Rf "SPIRV-Reflect-vulkan-sdk-${PV}" +tar xf "vulkan-sdk-${PV}.tar.gz" + +# configure +cmake -B build -S "SPIRV-Reflect-vulkan-sdk-${PV}" \ + -DCMAKE_INSTALL_PREFIX="$(realpath . || true)" + +# build +cmake --build build + +# install +rm -Rf bin +cmake --install build + +echo "${LIB_VERSION}" >.already-built