Use properties consistently for custom dependency paths on windows

* This removes the (now undocumented) python env vars, and the never documented
  Qt env vars. We add new build script arguments to specify these paths.
This commit is contained in:
baldurk
2026-08-13 21:05:12 +01:00
parent 5b90b75b79
commit 1416d92b09
6 changed files with 100 additions and 23 deletions
+4 -6
View File
@@ -31,10 +31,6 @@
As a result we use the existance of the .lib, .h and .zip as a key to
ensure we only use a valid install -->
<!-- We want to keep supporting the old environment variable path for compatibility
but encourage users to use the new property page method. So we check for that first
to determine PythonOverride, and only fall back to env vars if it's not set. -->
<!-- MSBuild doesn't implement a simple loop so just do this by hand by
taking advantage of MSBuild evaluating these in-order.
First we set the number we're testing, then see if we find the files. If
@@ -46,8 +42,6 @@
<!-- first define the override prefix we're searching against -->
<PropertyGroup>
<PythonOverride>$(VSPythonOverridePath)</PythonOverride>
<PythonOverride Condition="'$(VSPythonOverridePath)'=='' AND '$(Platform)'=='Win32'">$(RENDERDOC_PYTHON_PREFIX32)</PythonOverride>
<PythonOverride Condition="'$(VSPythonOverridePath)'=='' AND '$(Platform)'=='x64'">$(RENDERDOC_PYTHON_PREFIX64)</PythonOverride>
</PropertyGroup>
<PropertyGroup><PythonMajorMinorTest>318</PythonMajorMinorTest></PropertyGroup>
@@ -128,6 +122,10 @@
<Message Importance="high" Text="PySide2 found and used from $(PythonOverride)" />
</Target>
<Target Name="PythonNotOverridden" AfterTargets="Build" Condition="'$(CustomPythonUsed)'=='0' AND $(PythonOverride)==''">
<Message Importance="high" Text="Built against default bundled python" />
</Target>
<Target Name="PythonFailedOverridden" AfterTargets="Build" Condition="'$(CustomPythonUsed)'=='0' AND $(PythonOverride)!=''">
<Message Importance="high" Text="** Could not use python version $(PythonOverride) due to missing requirements." />
<Message Importance="high" Text="** Check for $(PythonOverride)\include\Python.h, $(PythonOverride)\pythonMAJMIN.zip, and either $(PythonOverride)\pythonMAJMIN.lib or $(PythonOverride)\libs\pythonMAJMIN.lib" />
+38
View File
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!-- QtBaseDir would be used for everything, except in our local repository copy of Qt
we only have one include and split the bin/lib by platform. Since include doesn't
vary by platform and can be deduplicated on disk. -->
<QtBaseDir>$(ProjectDir)3rdparty\qt\$(Platform)</QtBaseDir>
<QtIncludeDir>$(ProjectDir)3rdparty\qt\include</QtIncludeDir>
<!-- pick subfolder from single override, if it exists and is set up right -->
<QtCustomPath Condition="'$(Platform)'=='x64' AND Exists('$(QtOverridePath)\msvc2019_64')">$(QtOverridePath)\msvc2019_64</QtCustomPath>
<QtCustomPath Condition="'$(Platform)'=='Win32' AND Exists('$(QtOverridePath)\msvc2019')">$(QtOverridePath)\msvc2019</QtCustomPath>
<!-- if we didn't find one, use the platform-specific paths -->
<QtCustomPath Condition="'$(Platform)'=='x64' AND $(QtOverridePath)==''">$(Qt64OverridePath)</QtCustomPath>
<QtCustomPath Condition="'$(Platform)'=='Win32' AND $(QtOverridePath)==''">$(Qt32OverridePath)</QtCustomPath>
<!-- only use override if we find what we expect from above -->
<QtBaseDir Condition="Exists('$(QtCustomPath)\bin\moc.exe')">$(QtCustomPath)</QtBaseDir>
<QtIncludeDir Condition="Exists('$(QtCustomPath)\bin\moc.exe')">$(QtCustomPath)\include</QtIncludeDir>
<CustomQtUsed>0</CustomQtUsed>
<CustomQtUsed Condition="Exists('$(QtCustomPath)\bin\moc.exe')">1</CustomQtUsed>
<!-- bin and lib are relative to the base dir, wherever it is -->
<QtBinDir>$(QtBaseDir)\bin</QtBinDir>
<QtLibDir>$(QtBaseDir)\lib</QtLibDir>
<QtPluginsDir>$(QtBaseDir)\plugins</QtPluginsDir>
</PropertyGroup>
<Target Name="QtBuildLoc" AfterTargets="Build" Condition="'$(CustomQtUsed)'=='0'">
<Message Importance="high" Text="Built against default bundled Qt" />
</Target>
<Target Name="QtBuildLoc" AfterTargets="Build" Condition="'$(CustomQtUsed)'!='0'">
<Message Importance="high" Text="Built against Qt from $(QtBaseDir)" />
</Target>
</Project>
+40
View File
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<ProjectSchemaDefinitions xmlns="http://schemas.microsoft.com/build/2009/properties" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sys="clr-namespace:System;assembly=mscorlib">
<Rule Name="qt_sheet"
DisplayName="Qt Configuration"
PageTemplate="generic"
Description="Configuring where Qt is obtained from"
xmlns="http://schemas.microsoft.com/build/2009/properties">
<Rule.Categories>
<Category Name="Build" DisplayName="Build" />
</Rule.Categories>
<Rule.DataSource>
<DataSource Persistence="UserFile" HasConfigurationCondition="true" />
</Rule.DataSource>
<StringProperty Name="QtOverridePath" DisplayName="Custom Qt Path" Description="Path to a Qt5 install with 'msvc2019' and 'msvc2019_64' subfolders." Category="Build" IncludeInCommandLine="false">
<StringProperty.ValueEditors>
<ValueEditor EditorType="DefaultStringPropertyEditor" DisplayName="&lt;Edit...&gt;"/>
<ValueEditor EditorType="DefaultFolderPropertyEditor" DisplayName="&lt;Browse...&gt;"/>
</StringProperty.ValueEditors>
</StringProperty>
<StringProperty Name="Qt32OverridePath" DisplayName="Individual 32-bit Qt Path" Description="Separate Path to a 32-bit Qt5 'msvc2019' folder." Category="Build" IncludeInCommandLine="false">
<StringProperty.ValueEditors>
<ValueEditor EditorType="DefaultStringPropertyEditor" DisplayName="&lt;Edit...&gt;"/>
<ValueEditor EditorType="DefaultFolderPropertyEditor" DisplayName="&lt;Browse...&gt;"/>
</StringProperty.ValueEditors>
</StringProperty>
<StringProperty Name="Qt64OverridePath" DisplayName="Individual 64-bit Qt Path" Description="Separate Path to a 64-bit Qt5 'msvc2019_64' folder." Category="Build" IncludeInCommandLine="false">
<StringProperty.ValueEditors>
<ValueEditor EditorType="DefaultStringPropertyEditor" DisplayName="&lt;Edit...&gt;"/>
<ValueEditor EditorType="DefaultFolderPropertyEditor" DisplayName="&lt;Browse...&gt;"/>
</StringProperty.ValueEditors>
</StringProperty>
</Rule>
</ProjectSchemaDefinitions>
+7 -15
View File
@@ -78,21 +78,6 @@
</ClCompile>
</ItemDefinitionGroup>
<Import Project="$(SolutionDir)\util\WindowsSDKFix.props" />
<PropertyGroup>
<!-- QtBaseDir would be used for everything, except in our local repository copy of Qt
we only have one include and split the bin/lib by platform. Since include doesn't
vary by platform and can be deduplicated on disk. -->
<QtBaseDir>$(ProjectDir)3rdparty\qt\$(Platform)</QtBaseDir>
<QtIncludeDir>$(ProjectDir)3rdparty\qt\include</QtIncludeDir>
<QtBaseDir Condition="Exists('$(RENDERDOC_QT_PREFIX64)\bin\moc.exe') AND '$(Platform)'=='x64'">$(RENDERDOC_QT_PREFIX64)</QtBaseDir>
<QtIncludeDir Condition="Exists('$(RENDERDOC_QT_PREFIX64)\bin\moc.exe') AND '$(Platform)'=='x64'">$(RENDERDOC_QT_PREFIX64)\include</QtIncludeDir>
<QtBaseDir Condition="Exists('$(RENDERDOC_QT_PREFIX32)\bin\moc.exe') AND '$(Platform)'=='Win32'">$(RENDERDOC_QT_PREFIX32)</QtBaseDir>
<QtIncludeDir Condition="Exists('$(RENDERDOC_QT_PREFIX32)\bin\moc.exe') AND '$(Platform)'=='Win32'">$(RENDERDOC_QT_PREFIX32)\include</QtIncludeDir>
<!-- bin and lib are relative to the base dir, wherever it is -->
<QtBinDir>$(QtBaseDir)\bin</QtBinDir>
<QtLibDir>$(QtBaseDir)\lib</QtLibDir>
<QtPluginsDir>$(QtBaseDir)\plugins</QtPluginsDir>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
@@ -2192,4 +2177,11 @@
</PropertyPageSchema>
</ItemGroup>
<Import Project="$(SolutionDir)\qrenderdoc\Code\pyrenderdoc\python.props" />
<ItemGroup>
<ProjectTools Include="custom_qt_sheet" />
<PropertyPageSchema Include="custom_qt_sheet.xml">
<Context>Project</Context>
</PropertyPageSchema>
</ItemGroup>
<Import Project="custom_qt.props" />
</Project>
+7
View File
@@ -166,6 +166,8 @@ usage() {
echo " --symstore <symbol store> [Windows only] Specify a path to a symbol store.";
echo " --llvm_arm32 <path> Give the path to an ARM32 build of LLVM, for android.";
echo " --llvm_arm64 <path> Give the path to an ARM64 build of LLVM, for android.";
echo " --python <path> Give the path to a Python root, for windows.";
echo " --qt <path> Give the path to a Qt root, for windows.";
echo " --skipcompile Skip compile steps, package already compiled binaries.";
echo " --strict Require all build steps to complete successfully,";
echo " including optional steps e.g. android/installer.";
@@ -283,6 +285,11 @@ PLATFORM=$(uname)
if uname -a | grep -qiE 'msys|cygwin|microsoft'; then
PLATFORM=Windows
echo "Using Python from '$PYTHON_ROOT' and Qt from '$QT_ROOT'"
export PYTHON_ROOT;
export QT_ROOT;
if [ -d /c/Windows ]; then
WIN_ROOT=/
elif [ -d /mnt/c/Windows ]; then
+4 -2
View File
@@ -5,8 +5,10 @@ mkdir -p "${REPO_ROOT}/dist"
# pushd into the git checkout
pushd "${REPO_ROOT}"
echo Using ${PYTHON_ROOT} and ${QT_ROOT} for build
# Build 32-bit Release
MSYS2_ARG_CONV_EXCL="*" msbuild.exe /nologo /m /fl4 /flp4':Verbosity=minimal;Encoding=ASCII;logfile=dist/build32.log' renderdoc.sln /t:Rebuild /p:'Configuration=Release;Platform=x86'
MSYS2_ARG_CONV_EXCL="*" msbuild.exe /p:VSPythonOverridePath="$(native_path "${PYTHON_ROOT}")" /p:QtOverridePath="$(native_path "${QT_ROOT}")" /nologo /m /fl4 /flp4':Verbosity=minimal;Encoding=ASCII;logfile=dist/build32.log' renderdoc.sln /t:Rebuild /p:'Configuration=Release;Platform=x86'
if [ ! -f ./Win32/Release/renderdoc.dll ] || [ ! -f ./Win32/Release/qrenderdoc.exe ] || [ ! -f ./Win32/Release/renderdoccmd.exe ] ; then
echo "Failed to build 32-bit release mode.";
@@ -14,7 +16,7 @@ if [ ! -f ./Win32/Release/renderdoc.dll ] || [ ! -f ./Win32/Release/qrenderdoc.e
fi
# Build 64-bit Release
MSYS2_ARG_CONV_EXCL="*" msbuild.exe /nologo /m /fl4 /flp4':Verbosity=minimal;Encoding=ASCII;logfile=dist/build64.log' renderdoc.sln /t:Rebuild /p:'Configuration=Release;Platform=x64'
MSYS2_ARG_CONV_EXCL="*" msbuild.exe /p:VSPythonOverridePath="$(native_path "${PYTHON_ROOT}")" /p:QtOverridePath="$(native_path "${QT_ROOT}")" /nologo /m /fl4 /flp4':Verbosity=minimal;Encoding=ASCII;logfile=dist/build64.log' renderdoc.sln /t:Rebuild /p:'Configuration=Release;Platform=x64'
if [ ! -f ./x64/Release/renderdoc.dll ] || [ ! -f ./x64/Release/qrenderdoc.exe ] || [ ! -f ./x64/Release/renderdoccmd.exe ] ; then
echo "Failed to build 64-bit release mode.";