Add scripts to build SPIR-V plugins

* These are the shader tools we ship with official builds. Most people don't
  need these scripts, but here they are just in case (and so I don't lose them).
This commit is contained in:
baldurk
2018-11-23 13:34:27 +00:00
parent f75b5e235e
commit ef34c13ea2
3 changed files with 107 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
# SPIR-V open source plugins build
These scripts are used to build the latest versions of glslang, SPIRV-Cross and SPIRV-Tools for distribution as plugins. On windows this is just a regular build really, on linux it will build in the renderdoc docker with static linking, to ensure maximum compatibility.
**Most users don't need to build this.**. The pre-built latest plugins packages are provided online which are included in every build, that you can download yourself:
* Windows: https://renderdoc.org/plugins.zip
* Linux: https://renderdoc.org/plugins.tgz
These scripts are just here so that a RenderDoc developer can update the plugins when needed.
+68
View File
@@ -0,0 +1,68 @@
#!/bin/bash
PLATFORM=$1
OUT=$2
set -ex
# Freshly clone repositories
rm -rf glslang SPIRV-Cross
git clone https://github.com/KhronosGroup/glslang
git clone https://github.com/KhronosGroup/SPIRV-Cross
GENERATOR="Unix Makefiles"
if [ "$PLATFORM" == "win64" ]; then
GENERATOR="Visual Studio 15 2017 Win64";
elif [ "$PLATFORM" == "win32" ]; then
GENERATOR="Visual Studio 15 2017";
else
export CC=clang CXX=clang++ CFLAGS="-fPIC -fvisibility=hidden" LDFLAGS="-static-libstdc++"
fi
##### SPIRV-Cross
pushd SPIRV-Cross
mkdir build
pushd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="${OUT}"
if [ "${PLATFORM:0:3}" == "win" ]; then
cmake --build . --config Release --target install
else
make -j$(nproc) install
fi
popd #build
popd # SPIRV-Cross
##### glslang (and bonus SPIRV-Tools for free)
pushd glslang
# Update external sources
python update_glslang_sources.py
# Now build
mkdir build
pushd build
# Hack for now until there's a cmake option to turn this off.
export CXXFLAGS="-USPIRV_TIMER_ENABLED"
cmake .. -DSPIRV_SKIP_TESTS=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="${OUT}"
if [ "${PLATFORM:0:3}" == "win" ]; then
cmake --build . --config Release --target install
else
make -j$(nproc) install
fi
popd #build
popd # glslang
+29
View File
@@ -0,0 +1,29 @@
#!/bin/bash
if [ ! -f build_spirv_plugins.sh ]; then
echo "Run this script from its folder like './build_spirv_plugins.sh'";
exit 1;
fi
if uname -a | grep -qiE 'win|msys|cygwin|microsoft'; then
# Windows build
echo "Building for win32";
./_build.sh win32 $(pwd)/spirv-plugins-win32
echo "Building for win64";
./_build.sh win64 $(pwd)/spirv-plugins-win64
else
# Linux build
if docker image ls | grep -q renderdoc-build; then
echo "Building for linux";
docker run --rm -v $(pwd):/script:ro -v $(pwd)/spirv-plugins-linux64:/out renderdoc-build bash /script/_build.sh linux64 /out
strip --strip-unneeded spirv-plugins-linux64/bin/*
else
echo "Run normal RenderDoc build first to generate renderdoc-build image";
exit 1;
fi
fi