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 <ralph.sennhauser@gmail.com>
This commit is contained in:
Ralph Sennhauser 2024-09-16 20:07:58 +02:00
parent cf909a81db
commit 39f3fa7d5b
3 changed files with 41 additions and 0 deletions

1
.gitignore vendored
View File

@ -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/

View File

@ -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."

View File

@ -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