Build local llvm in new docker to support spirv-tools

This commit is contained in:
baldurk
2023-03-31 19:55:04 +01:00
parent 3ff12d4067
commit 65042f1e0d
5 changed files with 54 additions and 9 deletions
+4 -8
View File
@@ -5,13 +5,6 @@ OUT=$2
set -ex
# Get new cmake for glslang and spirv-tools
wget https://github.com/Kitware/CMake/releases/download/v3.26.2/cmake-3.26.2-linux-x86_64.tar.gz
tar -zxvf cmake-3.26.2-linux-x86_64.tar.gz
export PATH=$(pwd)/cmake-3.26.2-linux-x86_64/bin:$PATH
# Freshly clone repositories
rm -rf glslang SPIRV-Cross
git clone https://github.com/KhronosGroup/glslang
@@ -24,7 +17,10 @@ if [ "$PLATFORM" == "win64" ]; then
elif [ "$PLATFORM" == "win32" ]; then
GENERATOR="Visual Studio 15 2017";
else
export CC=clang CXX=clang++ CFLAGS="-fPIC -fvisibility=hidden" LDFLAGS="-static-libstdc++"
export CC=clang CXX=clang++ CFLAGS="-fPIC -fvisibility=hidden -stdlib=libc++" LDFLAGS="-nostdlib++ -Wl,--start-group /usr/lib/libc++.a /usr/lib/libc++abi.a -lpthread"
export CXXFLAGS="${CFLAGS}"
export PATH=$(pwd)/cmake-3.26.2-linux-x86_64/bin:$PATH
fi
##### SPIRV-Cross
+9 -1
View File
@@ -31,7 +31,15 @@ else
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
echo "Building renderdoc-spirv-build docker image";
pushd docker
docker build -t renderdoc-spirv-build . || exit 1
popd
echo "Docker image built. Running build"
docker run --rm -v $(pwd):/script:ro -v $(pwd)/spirv-plugins-linux64:/out renderdoc-spirv-build bash /script/_build.sh linux64 /out
else
echo "Run normal RenderDoc build first to generate renderdoc-build image";
+4
View File
@@ -0,0 +1,4 @@
FROM renderdoc-build
LABEL maintainer baldurk@baldurk.org
COPY prepare.sh /
RUN /prepare.sh
+3
View File
@@ -0,0 +1,3 @@
This folder creates a docker container pre-configured for compiling RenderDoc's SPIR-V plugins with the oldest possible distribution, for maximum compatibility of the binary build.
It doesn't contain anything RenderDoc-specific, apart from being tailored to its dependencies. It depends on renderdoc-build from the normal build scripts.
+34
View File
@@ -0,0 +1,34 @@
#!/bin/bash
set -e
set -x
# Get new cmake for glslang and spirv-tools
wget https://github.com/Kitware/CMake/releases/download/v3.26.2/cmake-3.26.2-linux-x86_64.tar.gz
tar -zxvf cmake-3.26.2-linux-x86_64.tar.gz
export PATH=$(pwd)/cmake-3.26.2-linux-x86_64/bin:$PATH
# Update to newer clang and libc++ for spirv-tools...
wget https://github.com/llvm/llvm-project/archive/refs/heads/release/6.x.tar.gz
tar -zxf 6.x.tar.gz
cd llvm-project-release-6.x/
cd llvm/projects/
ln -s ../../libcxx
ln -s ../../libcxxabi
cd ../../
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release ../llvm/
make install-cxx -j8
make install-cxxabi -j8
make install -j8
cd ..
mkdir clang-build
cd clang-build
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DLLVM_CONFIG_PATH=/usr/bin/llvm-config ../clang
make install -j8