Deps: Build shaderc

This commit is contained in:
Stenzek 2024-04-04 21:11:13 +10:00
parent 69c9133cd4
commit e245884d16
No known key found for this signature in database
8 changed files with 315 additions and 2 deletions

View file

@ -28,6 +28,7 @@ fi
export MACOSX_DEPLOYMENT_TARGET=11.0 export MACOSX_DEPLOYMENT_TARGET=11.0
NPROCS="$(getconf _NPROCESSORS_ONLN)" NPROCS="$(getconf _NPROCESSORS_ONLN)"
SCRIPTDIR=$(realpath $(dirname "${BASH_SOURCE[0]}"))
INSTALLDIR="$1" INSTALLDIR="$1"
if [ "${INSTALLDIR:0:1}" != "/" ]; then if [ "${INSTALLDIR:0:1}" != "/" ]; then
INSTALLDIR="$PWD/$INSTALLDIR" INSTALLDIR="$PWD/$INSTALLDIR"
@ -44,6 +45,11 @@ LIBWEBP=1.3.2
MOLTENVK=1.2.8 MOLTENVK=1.2.8
QT=6.7.0 QT=6.7.0
SHADERC=2024.0
SHADERC_GLSLANG=d73712b8f6c9047b09e99614e20d456d5ada2390
SHADERC_SPIRVHEADERS=8b246ff75c6615ba4532fe4fde20f1be090c3764
SHADERC_SPIRVTOOLS=04896c462d9f3f504c99a4698605b6524af813c1
mkdir -p deps-build mkdir -p deps-build
cd deps-build cd deps-build
@ -76,6 +82,10 @@ cat > SHASUMS <<EOF
1518f40e08ff5e6153a6e26e5b95b033413ac143b70795dc1317e7f73ebf922d qtsvg-everywhere-src-$QT.tar.xz 1518f40e08ff5e6153a6e26e5b95b033413ac143b70795dc1317e7f73ebf922d qtsvg-everywhere-src-$QT.tar.xz
c8da6b239e82fe1e23465cbf0936c0da5a334438d3fb433e19c503cbb1abee7b qttools-everywhere-src-$QT.tar.xz c8da6b239e82fe1e23465cbf0936c0da5a334438d3fb433e19c503cbb1abee7b qttools-everywhere-src-$QT.tar.xz
26fc8047062ca4bacd1bd953be86fd39c6e0a5f5e9920c72ba9d40876cea4b56 qttranslations-everywhere-src-$QT.tar.xz 26fc8047062ca4bacd1bd953be86fd39c6e0a5f5e9920c72ba9d40876cea4b56 qttranslations-everywhere-src-$QT.tar.xz
c761044e4e204be8e0b9a2d7494f08671ca35b92c4c791c7049594ca7514197f shaderc-$SHADERC.tar.gz
d27f7359156a92749f8fd4681d1d518c736864213c431cf8144ecc2fb6689a2d shaderc-glslang-$SHADERC_GLSLANG.tar.gz
cfeed5f9a97d12a9761a26e7f5bd10fedb1a8ce92033075151ae3bc7206fc229 shaderc-spirv-headers-$SHADERC_SPIRVHEADERS.tar.gz
c0d01e758a543b3a358cb97af02c6817ebd3f5ff13a2edf9fb220646a3d67999 shaderc-spirv-tools-$SHADERC_SPIRVTOOLS.tar.gz
EOF EOF
curl -L \ curl -L \
@ -92,7 +102,11 @@ curl -L \
-O "https://download.qt.io/official_releases/qt/${QT%.*}/$QT/submodules/qtimageformats-everywhere-src-$QT.tar.xz" \ -O "https://download.qt.io/official_releases/qt/${QT%.*}/$QT/submodules/qtimageformats-everywhere-src-$QT.tar.xz" \
-O "https://download.qt.io/official_releases/qt/${QT%.*}/$QT/submodules/qtsvg-everywhere-src-$QT.tar.xz" \ -O "https://download.qt.io/official_releases/qt/${QT%.*}/$QT/submodules/qtsvg-everywhere-src-$QT.tar.xz" \
-O "https://download.qt.io/official_releases/qt/${QT%.*}/$QT/submodules/qttools-everywhere-src-$QT.tar.xz" \ -O "https://download.qt.io/official_releases/qt/${QT%.*}/$QT/submodules/qttools-everywhere-src-$QT.tar.xz" \
-O "https://download.qt.io/official_releases/qt/${QT%.*}/$QT/submodules/qttranslations-everywhere-src-$QT.tar.xz" -O "https://download.qt.io/official_releases/qt/${QT%.*}/$QT/submodules/qttranslations-everywhere-src-$QT.tar.xz" \
-o "shaderc-$SHADERC.tar.gz" "https://github.com/google/shaderc/archive/refs/tags/v$SHADERC.tar.gz" \
-o "shaderc-glslang-$SHADERC_GLSLANG.tar.gz" "https://github.com/KhronosGroup/glslang/archive/$SHADERC_GLSLANG.tar.gz" \
-o "shaderc-spirv-headers-$SHADERC_SPIRVHEADERS.tar.gz" "https://github.com/KhronosGroup/SPIRV-Headers/archive/$SHADERC_SPIRVHEADERS.tar.gz" \
-o "shaderc-spirv-tools-$SHADERC_SPIRVTOOLS.tar.gz" "https://github.com/KhronosGroup/SPIRV-Tools/archive/$SHADERC_SPIRVTOOLS.tar.gz"
shasum -a 256 --check SHASUMS shasum -a 256 --check SHASUMS
@ -301,6 +315,24 @@ make "-j$NPROCS"
make install make install
cd ../.. cd ../..
echo "Building shaderc..."
rm -fr "shaderc-$SHADERC"
tar xf "shaderc-$SHADERC.tar.gz"
cd "shaderc-$SHADERC"
cd third_party
tar xf "../../shaderc-glslang-$SHADERC_GLSLANG.tar.gz"
mv "glslang-$SHADERC_GLSLANG" "glslang"
tar xf "../../shaderc-spirv-headers-$SHADERC_SPIRVHEADERS.tar.gz"
mv "SPIRV-Headers-$SHADERC_SPIRVHEADERS" "spirv-headers"
tar xf "../../shaderc-spirv-tools-$SHADERC_SPIRVTOOLS.tar.gz"
mv "SPIRV-Tools-$SHADERC_SPIRVTOOLS" "spirv-tools"
cd ..
patch -p1 < "$SCRIPTDIR/shaderc-install.patch"
cmake "${CMAKE_COMMON[@]}" "$CMAKE_ARCH_UNIVERSAL" -DSHADERC_SKIP_TESTS=ON -DSHADERC_SKIP_EXAMPLES=ON -DSHADERC_ENABLE_SHARED_CRT=ON -B build
make -C build "-j$NPROCS"
make -C build install
cd ..
echo "Cleaning up..." echo "Cleaning up..."
cd .. cd ..
rm -rf deps-build rm -rf deps-build

View file

@ -54,6 +54,11 @@ set ZLIB=1.3.1
set ZLIBSHORT=131 set ZLIBSHORT=131
set ZSTD=1.5.5 set ZSTD=1.5.5
set SHADERC=2024.0
set SHADERC_GLSLANG=d73712b8f6c9047b09e99614e20d456d5ada2390
set SHADERC_SPIRVHEADERS=8b246ff75c6615ba4532fe4fde20f1be090c3764
set SHADERC_SPIRVTOOLS=04896c462d9f3f504c99a4698605b6524af813c1
call :downloadfile "freetype-%FREETYPE%.tar.gz" https://download.savannah.gnu.org/releases/freetype/freetype-%FREETYPE%.tar.gz 1ac27e16c134a7f2ccea177faba19801131116fd682efc1f5737037c5db224b5 || goto error call :downloadfile "freetype-%FREETYPE%.tar.gz" https://download.savannah.gnu.org/releases/freetype/freetype-%FREETYPE%.tar.gz 1ac27e16c134a7f2ccea177faba19801131116fd682efc1f5737037c5db224b5 || goto error
call :downloadfile "harfbuzz-%HARFBUZZ%.zip" https://github.com/harfbuzz/harfbuzz/archive/refs/tags/%HARFBUZZ%.zip b2bc56184ae37324bc4829fde7d3f9e6916866ad711ee85792e457547c9fd127 || goto error call :downloadfile "harfbuzz-%HARFBUZZ%.zip" https://github.com/harfbuzz/harfbuzz/archive/refs/tags/%HARFBUZZ%.zip b2bc56184ae37324bc4829fde7d3f9e6916866ad711ee85792e457547c9fd127 || goto error
call :downloadfile "lpng%LIBPNG%.zip" https://download.sourceforge.net/libpng/lpng1643.zip fc466a1e638e635d6c66363bdf3f38555b81b0141d0b06ba45b49ccca327436d || goto error call :downloadfile "lpng%LIBPNG%.zip" https://download.sourceforge.net/libpng/lpng1643.zip fc466a1e638e635d6c66363bdf3f38555b81b0141d0b06ba45b49ccca327436d || goto error
@ -68,6 +73,11 @@ call :downloadfile "libwebp-%WEBP%.tar.gz" "https://storage.googleapis.com/downl
call :downloadfile "zlib%ZLIBSHORT%.zip" "https://zlib.net/zlib%ZLIBSHORT%.zip" 72af66d44fcc14c22013b46b814d5d2514673dda3d115e64b690c1ad636e7b17 || goto error call :downloadfile "zlib%ZLIBSHORT%.zip" "https://zlib.net/zlib%ZLIBSHORT%.zip" 72af66d44fcc14c22013b46b814d5d2514673dda3d115e64b690c1ad636e7b17 || goto error
call :downloadfile "zstd-%ZSTD%.zip" "https://github.com/facebook/zstd/archive/refs/tags/v%ZSTD%.zip" c5c8daa1d40dabc51790c62a5b86af2b36dfc4e1a738ff10dc4a46ea4e68ee51 || goto error call :downloadfile "zstd-%ZSTD%.zip" "https://github.com/facebook/zstd/archive/refs/tags/v%ZSTD%.zip" c5c8daa1d40dabc51790c62a5b86af2b36dfc4e1a738ff10dc4a46ea4e68ee51 || goto error
call :downloadfile "shaderc-%SHADERC%.zip" "https://github.com/google/shaderc/archive/refs/tags/v%SHADERC%.zip" 5397160432fb5b780e9372327060b1be47acafcd0689fea44fd939e7305668ba || goto error
call :downloadfile "shaderc-glslang-%SHADERC_GLSLANG%.zip" "https://github.com/KhronosGroup/glslang/archive/%SHADERC_GLSLANG%.zip" 58a0d4b670986f8618c371b088f2ee11006596e8c71fe499ec044d5ea469d39b || goto error
call :downloadfile "shaderc-spirv-headers-%SHADERC_SPIRVHEADERS%.zip" "https://github.com/KhronosGroup/SPIRV-Headers/archive/%SHADERC_SPIRVHEADERS%.zip" 1385538d16f8875e76209388187b3814cb0b0e9cecc3bc440faa7665b570ff47 || goto error
call :downloadfile "shaderc-spirv-tools-%SHADERC_SPIRVTOOLS%.zip" "https://github.com/KhronosGroup/SPIRV-Tools/archive/%SHADERC_SPIRVTOOLS%.zip" 4eb9a3fc940ed1b05f968c181763dfdb8e637cbfbf57c625112b3ad0f76e2c28 || goto error
if %DEBUG%==1 ( if %DEBUG%==1 (
echo Building debug and release libraries... echo Building debug and release libraries...
) else ( ) else (
@ -218,6 +228,24 @@ cmake --build . --parallel || goto error
ninja install || goto error ninja install || goto error
cd ..\.. || goto error cd ..\.. || goto error
echo Building shaderc...
rmdir /S /Q "shaderc-%SHADERC%"
%SEVENZIP% x "shaderc-%SHADERC%.zip" || goto error
cd "shaderc-%SHADERC%" || goto error
cd third_party || goto error
%SEVENZIP% x "..\..\shaderc-glslang-%SHADERC_GLSLANG%.zip" || goto error
rename "glslang-%SHADERC_GLSLANG%" "glslang" || goto error
%SEVENZIP% x "..\..\shaderc-spirv-headers-%SHADERC_SPIRVHEADERS%.zip" || goto error
rename "SPIRV-Headers-%SHADERC_SPIRVHEADERS%" "spirv-headers" || goto error
%SEVENZIP% x "..\..\shaderc-spirv-tools-%SHADERC_SPIRVTOOLS%.zip" || goto error
rename "SPIRV-Tools-%SHADERC_SPIRVTOOLS%" "spirv-tools" || goto error
cd .. || goto error
%PATCH% -p1 < "%SCRIPTDIR%\shaderc-install.patch" || goto error
cmake %ARM64TOOLCHAIN% -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="%INSTALLDIR%" -DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" -DSHADERC_SKIP_TESTS=ON -DSHADERC_SKIP_EXAMPLES=ON -DSHADERC_ENABLE_SHARED_CRT=ON -B build -G Ninja || goto error
cmake --build build --parallel || goto error
ninja -C build install || goto error
cd .. || goto error
echo Cleaning up... echo Cleaning up...
cd .. cd ..
rd /S /Q deps-build rd /S /Q deps-build

View file

@ -52,6 +52,11 @@ set ZLIB=1.3.1
set ZLIBSHORT=131 set ZLIBSHORT=131
set ZSTD=1.5.5 set ZSTD=1.5.5
set SHADERC=2024.0
set SHADERC_GLSLANG=d73712b8f6c9047b09e99614e20d456d5ada2390
set SHADERC_SPIRVHEADERS=8b246ff75c6615ba4532fe4fde20f1be090c3764
set SHADERC_SPIRVTOOLS=04896c462d9f3f504c99a4698605b6524af813c1
call :downloadfile "freetype-%FREETYPE%.tar.gz" https://download.savannah.gnu.org/releases/freetype/freetype-%FREETYPE%.tar.gz 1ac27e16c134a7f2ccea177faba19801131116fd682efc1f5737037c5db224b5 || goto error call :downloadfile "freetype-%FREETYPE%.tar.gz" https://download.savannah.gnu.org/releases/freetype/freetype-%FREETYPE%.tar.gz 1ac27e16c134a7f2ccea177faba19801131116fd682efc1f5737037c5db224b5 || goto error
call :downloadfile "harfbuzz-%HARFBUZZ%.zip" https://github.com/harfbuzz/harfbuzz/archive/refs/tags/%HARFBUZZ%.zip b2bc56184ae37324bc4829fde7d3f9e6916866ad711ee85792e457547c9fd127 || goto error call :downloadfile "harfbuzz-%HARFBUZZ%.zip" https://github.com/harfbuzz/harfbuzz/archive/refs/tags/%HARFBUZZ%.zip b2bc56184ae37324bc4829fde7d3f9e6916866ad711ee85792e457547c9fd127 || goto error
call :downloadfile "lpng%LIBPNG%.zip" https://download.sourceforge.net/libpng/lpng1643.zip fc466a1e638e635d6c66363bdf3f38555b81b0141d0b06ba45b49ccca327436d || goto error call :downloadfile "lpng%LIBPNG%.zip" https://download.sourceforge.net/libpng/lpng1643.zip fc466a1e638e635d6c66363bdf3f38555b81b0141d0b06ba45b49ccca327436d || goto error
@ -66,6 +71,11 @@ call :downloadfile "libwebp-%WEBP%.tar.gz" "https://storage.googleapis.com/downl
call :downloadfile "zlib%ZLIBSHORT%.zip" "https://zlib.net/zlib%ZLIBSHORT%.zip" 72af66d44fcc14c22013b46b814d5d2514673dda3d115e64b690c1ad636e7b17 || goto error call :downloadfile "zlib%ZLIBSHORT%.zip" "https://zlib.net/zlib%ZLIBSHORT%.zip" 72af66d44fcc14c22013b46b814d5d2514673dda3d115e64b690c1ad636e7b17 || goto error
call :downloadfile "zstd-%ZSTD%.zip" "https://github.com/facebook/zstd/archive/refs/tags/v%ZSTD%.zip" c5c8daa1d40dabc51790c62a5b86af2b36dfc4e1a738ff10dc4a46ea4e68ee51 || goto error call :downloadfile "zstd-%ZSTD%.zip" "https://github.com/facebook/zstd/archive/refs/tags/v%ZSTD%.zip" c5c8daa1d40dabc51790c62a5b86af2b36dfc4e1a738ff10dc4a46ea4e68ee51 || goto error
call :downloadfile "shaderc-%SHADERC%.zip" "https://github.com/google/shaderc/archive/refs/tags/v%SHADERC%.zip" 5397160432fb5b780e9372327060b1be47acafcd0689fea44fd939e7305668ba || goto error
call :downloadfile "shaderc-glslang-%SHADERC_GLSLANG%.zip" "https://github.com/KhronosGroup/glslang/archive/%SHADERC_GLSLANG%.zip" 58a0d4b670986f8618c371b088f2ee11006596e8c71fe499ec044d5ea469d39b || goto error
call :downloadfile "shaderc-spirv-headers-%SHADERC_SPIRVHEADERS%.zip" "https://github.com/KhronosGroup/SPIRV-Headers/archive/%SHADERC_SPIRVHEADERS%.zip" 1385538d16f8875e76209388187b3814cb0b0e9cecc3bc440faa7665b570ff47 || goto error
call :downloadfile "shaderc-spirv-tools-%SHADERC_SPIRVTOOLS%.zip" "https://github.com/KhronosGroup/SPIRV-Tools/archive/%SHADERC_SPIRVTOOLS%.zip" 4eb9a3fc940ed1b05f968c181763dfdb8e637cbfbf57c625112b3ad0f76e2c28 || goto error
if %DEBUG%==1 ( if %DEBUG%==1 (
echo Building debug and release libraries... echo Building debug and release libraries...
) else ( ) else (
@ -215,6 +225,24 @@ cmake --build . --parallel || goto error
ninja install || goto error ninja install || goto error
cd ..\.. || goto error cd ..\.. || goto error
echo Building shaderc...
rmdir /S /Q "shaderc-%SHADERC%"
%SEVENZIP% x "shaderc-%SHADERC%.zip" || goto error
cd "shaderc-%SHADERC%" || goto error
cd third_party || goto error
%SEVENZIP% x "..\..\shaderc-glslang-%SHADERC_GLSLANG%.zip" || goto error
rename "glslang-%SHADERC_GLSLANG%" "glslang" || goto error
%SEVENZIP% x "..\..\shaderc-spirv-headers-%SHADERC_SPIRVHEADERS%.zip" || goto error
rename "SPIRV-Headers-%SHADERC_SPIRVHEADERS%" "spirv-headers" || goto error
%SEVENZIP% x "..\..\shaderc-spirv-tools-%SHADERC_SPIRVTOOLS%.zip" || goto error
rename "SPIRV-Tools-%SHADERC_SPIRVTOOLS%" "spirv-tools" || goto error
cd .. || goto error
%PATCH% -p1 < "%SCRIPTDIR%\shaderc-install.patch" || goto error
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="%INSTALLDIR%" -DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" -DSHADERC_SKIP_TESTS=ON -DSHADERC_SKIP_EXAMPLES=ON -DSHADERC_ENABLE_SHARED_CRT=ON -B build -G Ninja || goto error
cmake --build build --parallel || goto error
ninja -C build install || goto error
cd .. || goto error
echo Cleaning up... echo Cleaning up...
cd .. cd ..
rd /S /Q deps-build rd /S /Q deps-build

View file

@ -8,6 +8,7 @@ if [ "$#" -ne 1 ]; then
fi fi
INSTALLDIR="$1" INSTALLDIR="$1"
SCRIPTDIR=$(realpath $(dirname "${BASH_SOURCE[0]}"))
NPROCS="$(getconf _NPROCESSORS_ONLN)" NPROCS="$(getconf _NPROCESSORS_ONLN)"
FREETYPE=2.13.2 FREETYPE=2.13.2
@ -21,6 +22,11 @@ QT=6.7.0
ZLIB=1.3.1 ZLIB=1.3.1
ZSTD=1.5.5 ZSTD=1.5.5
SHADERC=2024.0
SHADERC_GLSLANG=d73712b8f6c9047b09e99614e20d456d5ada2390
SHADERC_SPIRVHEADERS=8b246ff75c6615ba4532fe4fde20f1be090c3764
SHADERC_SPIRVTOOLS=04896c462d9f3f504c99a4698605b6524af813c1
mkdir -p deps-build mkdir -p deps-build
cd deps-build cd deps-build
@ -40,6 +46,10 @@ fd6f417fe9e3a071cf1424a5152d926a34c4a3c5070745470be6cf12a404ed79 $LIBBACKTRACE.
c8da6b239e82fe1e23465cbf0936c0da5a334438d3fb433e19c503cbb1abee7b qttools-everywhere-src-$QT.tar.xz c8da6b239e82fe1e23465cbf0936c0da5a334438d3fb433e19c503cbb1abee7b qttools-everywhere-src-$QT.tar.xz
26fc8047062ca4bacd1bd953be86fd39c6e0a5f5e9920c72ba9d40876cea4b56 qttranslations-everywhere-src-$QT.tar.xz 26fc8047062ca4bacd1bd953be86fd39c6e0a5f5e9920c72ba9d40876cea4b56 qttranslations-everywhere-src-$QT.tar.xz
d73470e4217da388d8cd2a517ee8bb373853f33c569306e80f04397845157aea qtwayland-everywhere-src-$QT.tar.xz d73470e4217da388d8cd2a517ee8bb373853f33c569306e80f04397845157aea qtwayland-everywhere-src-$QT.tar.xz
c761044e4e204be8e0b9a2d7494f08671ca35b92c4c791c7049594ca7514197f shaderc-$SHADERC.tar.gz
d27f7359156a92749f8fd4681d1d518c736864213c431cf8144ecc2fb6689a2d shaderc-glslang-$SHADERC_GLSLANG.tar.gz
cfeed5f9a97d12a9761a26e7f5bd10fedb1a8ce92033075151ae3bc7206fc229 shaderc-spirv-headers-$SHADERC_SPIRVHEADERS.tar.gz
c0d01e758a543b3a358cb97af02c6817ebd3f5ff13a2edf9fb220646a3d67999 shaderc-spirv-tools-$SHADERC_SPIRVTOOLS.tar.gz
EOF EOF
curl -C - -L \ curl -C - -L \
@ -57,7 +67,11 @@ curl -C - -L \
-O "https://download.qt.io/official_releases/qt/${QT%.*}/$QT/submodules/qtsvg-everywhere-src-$QT.tar.xz" \ -O "https://download.qt.io/official_releases/qt/${QT%.*}/$QT/submodules/qtsvg-everywhere-src-$QT.tar.xz" \
-O "https://download.qt.io/official_releases/qt/${QT%.*}/$QT/submodules/qttools-everywhere-src-$QT.tar.xz" \ -O "https://download.qt.io/official_releases/qt/${QT%.*}/$QT/submodules/qttools-everywhere-src-$QT.tar.xz" \
-O "https://download.qt.io/official_releases/qt/${QT%.*}/$QT/submodules/qttranslations-everywhere-src-$QT.tar.xz" \ -O "https://download.qt.io/official_releases/qt/${QT%.*}/$QT/submodules/qttranslations-everywhere-src-$QT.tar.xz" \
-O "https://download.qt.io/official_releases/qt/${QT%.*}/$QT/submodules/qtwayland-everywhere-src-$QT.tar.xz" -O "https://download.qt.io/official_releases/qt/${QT%.*}/$QT/submodules/qtwayland-everywhere-src-$QT.tar.xz" \
-o "shaderc-$SHADERC.tar.gz" "https://github.com/google/shaderc/archive/refs/tags/v$SHADERC.tar.gz" \
-o "shaderc-glslang-$SHADERC_GLSLANG.tar.gz" "https://github.com/KhronosGroup/glslang/archive/$SHADERC_GLSLANG.tar.gz" \
-o "shaderc-spirv-headers-$SHADERC_SPIRVHEADERS.tar.gz" "https://github.com/KhronosGroup/SPIRV-Headers/archive/$SHADERC_SPIRVHEADERS.tar.gz" \
-o "shaderc-spirv-tools-$SHADERC_SPIRVTOOLS.tar.gz" "https://github.com/KhronosGroup/SPIRV-Tools/archive/$SHADERC_SPIRVTOOLS.tar.gz"
shasum -a 256 --check SHASUMS shasum -a 256 --check SHASUMS
@ -265,6 +279,24 @@ cmake --build . --parallel
ninja install ninja install
cd ../../ cd ../../
echo "Building shaderc..."
rm -fr "shaderc-$SHADERC"
tar xf "shaderc-$SHADERC.tar.gz"
cd "shaderc-$SHADERC"
cd third_party
tar xf "../../shaderc-glslang-$SHADERC_GLSLANG.tar.gz"
mv "glslang-$SHADERC_GLSLANG" "glslang"
tar xf "../../shaderc-spirv-headers-$SHADERC_SPIRVHEADERS.tar.gz"
mv "SPIRV-Headers-$SHADERC_SPIRVHEADERS" "spirv-headers"
tar xf "../../shaderc-spirv-tools-$SHADERC_SPIRVTOOLS.tar.gz"
mv "SPIRV-Tools-$SHADERC_SPIRVTOOLS" "spirv-tools"
cd ..
patch -p1 < "$SCRIPTDIR/shaderc-install.patch"
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$INSTALLDIR" -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -DSHADERC_SKIP_TESTS=ON -DSHADERC_SKIP_EXAMPLES=ON -DSHADERC_ENABLE_SHARED_CRT=ON -B build -G Ninja
cmake --build build --parallel
ninja -C build install
cd ..
echo "Cleaning up..." echo "Cleaning up..."
cd .. cd ..
rm -r deps-build rm -r deps-build

View file

@ -0,0 +1,50 @@
{
"name": "shaderc",
"buildsystem": "cmake-ninja",
"builddir": true,
"config-opts": [
"-DSHADERC_SKIP_TESTS=ON",
"-DSHADERC_SKIP_EXAMPLES=ON",
"-DSHADERC_ENABLE_SHARED_CRT=ON"
],
"build-options": {
"strip": true
},
"sources": [
{
"type": "git",
"url": "https://github.com/google/shaderc.git",
"commit": "d792558a8902cb39b1c237243cc4edab226513a5"
},
{
"type": "archive",
"url": "https://github.com/KhronosGroup/glslang/archive/d73712b8f6c9047b09e99614e20d456d5ada2390.tar.gz",
"sha256": "d27f7359156a92749f8fd4681d1d518c736864213c431cf8144ecc2fb6689a2d",
"dest": "third_party/glslang"
},
{
"type": "archive",
"url": "https://github.com/KhronosGroup/SPIRV-Headers/archive/8b246ff75c6615ba4532fe4fde20f1be090c3764.tar.gz",
"sha256": "cfeed5f9a97d12a9761a26e7f5bd10fedb1a8ce92033075151ae3bc7206fc229",
"dest": "third_party/spirv-headers"
},
{
"type": "archive",
"url": "https://github.com/KhronosGroup/SPIRV-Tools/archive/04896c462d9f3f504c99a4698605b6524af813c1.tar.gz",
"sha256": "c0d01e758a543b3a358cb97af02c6817ebd3f5ff13a2edf9fb220646a3d67999",
"dest": "third_party/spirv-tools"
},
{
"type": "patch",
"path": "shaderc-install.patch"
}
],
"cleanup": [
"/bin",
"/include",
"/lib/*.a",
"/lib/*.la",
"/lib/cmake",
"/lib/pkgconfig"
]
}

View file

@ -0,0 +1,71 @@
--- a/libshaderc_util/src/compiler.cc
+++ b/libshaderc_util/src/compiler.cc
@@ -341,6 +341,10 @@ std::tuple<bool, std::vector<uint32_t>, size_t> Compiler::Compile(
options.generateDebugInfo = generate_debug_info_;
options.disableOptimizer = true;
options.optimizeSize = false;
+ if (generate_debug_info_) {
+ options.emitNonSemanticShaderDebugInfo = true;
+ options.emitNonSemanticShaderDebugSource = true;
+ }
// Note the call to GlslangToSpv also populates compilation_output_data.
glslang::GlslangToSpv(*program.getIntermediate(used_shader_stage), spirv,
&options);
--- a/third_party/CMakeLists.txt
+++ b/third_party/CMakeLists.txt
@@ -20,9 +20,9 @@ set(SHADERC_TINT_DIR "${SHADERC_THIRD_PARTY_ROOT_DIR}/tint" CACHE STRING
set(SHADERC_ABSL_DIR "${SHADERC_THIRD_PARTY_ROOT_DIR}/abseil_cpp" CACHE STRING
"Location of re2 source")
-set( SKIP_GLSLANG_INSTALL ${SHADERC_SKIP_INSTALL} )
-set( SKIP_SPIRV_TOOLS_INSTALL ${SHADERC_SKIP_INSTALL} )
-set( SKIP_GOOGLETEST_INSTALL ${SHADERC_SKIP_INSTALL} )
+set( SKIP_GLSLANG_INSTALL ON )
+set( SKIP_SPIRV_TOOLS_INSTALL ON )
+set( SKIP_GOOGLETEST_INSTALL ON )
# Configure third party projects.
if(${SHADERC_ENABLE_TESTS})
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -117,6 +117,10 @@
endif()
endif(MSVC)
+if(NOT WIN32)
+ add_definitions("-fvisibility=hidden")
+endif()
+
# Configure subdirectories.
# We depend on these for later projects, so they should come first.
@@ -158,5 +162,4 @@
endfunction()
define_pkg_config_file(shaderc -lshaderc_shared)
-define_pkg_config_file(shaderc_static "-lshaderc ${EXTRA_STATIC_PKGCONFIG_LIBS} -lshaderc_util")
-define_pkg_config_file(shaderc_combined -lshaderc_combined)
+
--- a/libshaderc/CMakeLists.txt
+++ b/libshaderc/CMakeLists.txt
@@ -54,7 +54,7 @@
DESTINATION
${CMAKE_INSTALL_INCLUDEDIR}/shaderc)
- install(TARGETS shaderc shaderc_shared
+ install(TARGETS shaderc_shared
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR}
@@ -96,10 +96,6 @@
shaderc_combine_static_lib(shaderc_combined shaderc)
-if(SHADERC_ENABLE_INSTALL)
- install(TARGETS shaderc_combined DESTINATION ${CMAKE_INSTALL_LIBDIR})
-endif(SHADERC_ENABLE_INSTALL)
-
shaderc_add_tests(
TEST_PREFIX shaderc_combined
LINK_LIBS shaderc_combined ${CMAKE_THREAD_LIBS_INIT}

View file

@ -20,6 +20,7 @@
"modules": [ "modules": [
"modules/20-sdl2.json", "modules/20-sdl2.json",
"modules/21-libbacktrace.json", "modules/21-libbacktrace.json",
"modules/22-shaderc.json",
{ {
"name": "duckstation", "name": "duckstation",
"buildsystem": "cmake-ninja", "buildsystem": "cmake-ninja",

View file

@ -0,0 +1,71 @@
--- a/libshaderc_util/src/compiler.cc
+++ b/libshaderc_util/src/compiler.cc
@@ -341,6 +341,10 @@ std::tuple<bool, std::vector<uint32_t>, size_t> Compiler::Compile(
options.generateDebugInfo = generate_debug_info_;
options.disableOptimizer = true;
options.optimizeSize = false;
+ if (generate_debug_info_) {
+ options.emitNonSemanticShaderDebugInfo = true;
+ options.emitNonSemanticShaderDebugSource = true;
+ }
// Note the call to GlslangToSpv also populates compilation_output_data.
glslang::GlslangToSpv(*program.getIntermediate(used_shader_stage), spirv,
&options);
--- a/third_party/CMakeLists.txt
+++ b/third_party/CMakeLists.txt
@@ -20,9 +20,9 @@ set(SHADERC_TINT_DIR "${SHADERC_THIRD_PARTY_ROOT_DIR}/tint" CACHE STRING
set(SHADERC_ABSL_DIR "${SHADERC_THIRD_PARTY_ROOT_DIR}/abseil_cpp" CACHE STRING
"Location of re2 source")
-set( SKIP_GLSLANG_INSTALL ${SHADERC_SKIP_INSTALL} )
-set( SKIP_SPIRV_TOOLS_INSTALL ${SHADERC_SKIP_INSTALL} )
-set( SKIP_GOOGLETEST_INSTALL ${SHADERC_SKIP_INSTALL} )
+set( SKIP_GLSLANG_INSTALL ON )
+set( SKIP_SPIRV_TOOLS_INSTALL ON )
+set( SKIP_GOOGLETEST_INSTALL ON )
# Configure third party projects.
if(${SHADERC_ENABLE_TESTS})
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -117,6 +117,10 @@
endif()
endif(MSVC)
+if(NOT WIN32)
+ add_definitions("-fvisibility=hidden")
+endif()
+
# Configure subdirectories.
# We depend on these for later projects, so they should come first.
@@ -158,5 +162,4 @@
endfunction()
define_pkg_config_file(shaderc -lshaderc_shared)
-define_pkg_config_file(shaderc_static "-lshaderc ${EXTRA_STATIC_PKGCONFIG_LIBS} -lshaderc_util")
-define_pkg_config_file(shaderc_combined -lshaderc_combined)
+
--- a/libshaderc/CMakeLists.txt
+++ b/libshaderc/CMakeLists.txt
@@ -54,7 +54,7 @@
DESTINATION
${CMAKE_INSTALL_INCLUDEDIR}/shaderc)
- install(TARGETS shaderc shaderc_shared
+ install(TARGETS shaderc_shared
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR}
@@ -96,10 +96,6 @@
shaderc_combine_static_lib(shaderc_combined shaderc)
-if(SHADERC_ENABLE_INSTALL)
- install(TARGETS shaderc_combined DESTINATION ${CMAKE_INSTALL_LIBDIR})
-endif(SHADERC_ENABLE_INSTALL)
-
shaderc_add_tests(
TEST_PREFIX shaderc_combined
LINK_LIBS shaderc_combined ${CMAKE_THREAD_LIBS_INIT}