Update build-shaderc to properly build on VS2022 with x64

* Add a helper script to build demos with VS2022 in release for shipping that
  link to shaderc. By default VS2015 won't link to it.
This commit is contained in:
baldurk
2025-05-15 09:58:13 +01:00
parent 1564c7f44e
commit ea19a5d20b
4 changed files with 29 additions and 10 deletions
+6 -8
View File
@@ -43,19 +43,17 @@ pushd shaderc
git pull
./utils/git-sync-deps
rm -rf build64 build32
if [[ "$PLATFORM" == "Windows" ]]; then
if [[ "$CMAKE_GENERATOR" == "" ]]; then
CMAKE_GENERATOR="Visual Studio 17 2022"
fi
# CMake configure if the folders don't exist
cmake -DSHADERC_SKIP_TESTS=ON -DSHADERC_ENABLE_SPVC=OFF -DCMAKE_INSTALL_PREFIX="$INSTALL_PATH"/x64 -DCMAKE_BUILD_TYPE=Release -G "$CMAKE_GENERATOR Win64" -Bbuild64 -H.
cmake -DSHADERC_SKIP_TESTS=ON -DSHADERC_ENABLE_SPVC=OFF -DCMAKE_INSTALL_PREFIX="$INSTALL_PATH"/x86 -DCMAKE_BUILD_TYPE=Release -G "$CMAKE_GENERATOR" -Bbuild32 -H.
cmake -DSHADERC_SKIP_TESTS=ON -DSHADERC_SKIP_EXAMPLES=ON -DCMAKE_INSTALL_PREFIX="$INSTALL_PATH"/x64 -DCMAKE_BUILD_TYPE=Release -G "Visual Studio 17 2022" -A x64 -Bbuild64 -H. || exit
cmake -DSHADERC_SKIP_TESTS=ON -DSHADERC_SKIP_EXAMPLES=ON -DCMAKE_INSTALL_PREFIX="$INSTALL_PATH"/x86 -DCMAKE_BUILD_TYPE=Release -G "Visual Studio 17 2022" -A Win32 -Bbuild32 -H. || exit
# Build and install
cmake --build build64 --config Release --target install --parallel 8
cmake --build build32 --config Release --target install --parallel 8
cmake --build build64 --config Release --target install --parallel 8 || exit
cmake --build build32 --config Release --target install --parallel 8 || exit
else
@@ -0,0 +1,7 @@
#!/bin/bash
# find new msbuild
MSBUILD="$(/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio/Installer/vswhere.exe -requires Microsoft.Component.MSBuild -find 'MSBuild\**\Bin\MSBuild.exe')"
# build with new enough toolset to link shaderc
"$MSBUILD" -p:'Configuration=Release;Platform=x64' -p:'PlatformToolset=v143'
+10 -2
View File
@@ -100,7 +100,13 @@
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="$(Platform)=='x64' and exists('3rdparty/shaderc/x64/lib/shaderc_combined.lib')">
<PropertyGroup Condition="$(Platform)=='x64' and exists('3rdparty/shaderc/x64/lib/shaderc_combined.lib') and $(PlatformToolset)=='v143'">
<HaveShaderc>1</HaveShaderc>
</PropertyGroup>
<PropertyGroup Condition="$(Platform)=='x86' and exists('3rdparty/shaderc/x86/lib/shaderc_combined.lib') and $(PlatformToolset)=='v143'">
<HaveShaderc>1</HaveShaderc>
</PropertyGroup>
<ItemDefinitionGroup Condition="$(Platform)=='x64' and $(HaveShaderc)=='1'">
<ClCompile>
<AdditionalIncludeDirectories>3rdparty/shaderc/x64/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>HAVE_SHADERC=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -109,7 +115,7 @@
<AdditionalDependencies>3rdparty/shaderc/x64/lib/shaderc_combined.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="$(Platform)=='x86' and exists('3rdparty/shaderc/x86/lib/shaderc_combined.lib')">
<ItemDefinitionGroup Condition="$(Platform)=='x86' and $(HaveShaderc)=='1'">
<ClCompile>
<AdditionalIncludeDirectories>3rdparty/shaderc/x86/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>HAVE_SHADERC=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -529,6 +535,8 @@ namespace DXCEnumerateAndCheck {
<Output TaskParameter="DebugOut" PropertyName="DebugOutDXC" />
</GetDXCDLL>
<Message Condition="$(DXCDLLFolder.Length) &gt; 0" Importance="high" Text="Using DXC/D3DCompiler dlls from $(DXCDLLFolder)." />
<Message Condition="$(HaveShaderc)=='1'" Importance="high" Text="Built with linked shaderc." />
<Message Condition="$(HaveShaderc)!='1'" Importance="high" Text="Not built with linked shaderc." />
<PropertyGroup Condition="$(DXCDLLFolder.Length) &gt; 0">
<DXCDLLSourceLocation>$(DXCDLLFolder)</DXCDLLSourceLocation>
</PropertyGroup>
+6
View File
@@ -531,6 +531,12 @@ void GraphicsTest::Prepare(int argc, char **argv)
if(prepared)
return;
#if USE_LINKED_SHADERC
TEST_LOG("Using linked shaderc");
#else
TEST_LOG("Requires glslc/shaderc for Vulkan tests");
#endif
prepared = true;
dataRoot = GetEnvVar("RENDERDOC_DEMOS_DATA");