From e75e95033bb93848ed6fa189c08ea2b4c1619c1c Mon Sep 17 00:00:00 2001 From: phantom10111 Date: Mon, 5 Dec 2022 17:12:53 +0100 Subject: [PATCH] Fix locating dxc.exe during Windows build It appears that on some machines (including mine), the registry key which contains the installation path to Windows SDK is located under "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\...". Update renderdoc project files to search that key as well. --- renderdoc/renderdoc.vcxproj | 57 +++++++++++++++++++++++-------------- 1 file changed, 35 insertions(+), 22 deletions(-) diff --git a/renderdoc/renderdoc.vcxproj b/renderdoc/renderdoc.vcxproj index 1ed616abf..00f5843f6 100644 --- a/renderdoc/renderdoc.vcxproj +++ b/renderdoc/renderdoc.vcxproj @@ -745,34 +745,47 @@ using System.Runtime.CompilerServices; namespace DXCEnumerateAndCheck { public class GetDXCExecutable : Microsoft.Build.Utilities.Task { public override bool Execute() { - string[] dirs = System.IO.Directory.GetDirectories(SDKPath, "10.*"); - // sort and reverse so we try from latest to oldest - System.Array.Sort(dirs); - System.Array.Reverse(dirs); + string[] sdkPathsCheck = SDKPath.Split(';'); - // look for the latest dxc.exe available that works - foreach(string path in dirs) + foreach(string sdkPathCheck in sdkPathsCheck) { - string dxcCheck = System.IO.Path.Combine(path, "x64", "dxc.exe"); - if(System.IO.File.Exists(dxcCheck)) + try { - // check that dxc.exe is runnable, some dxc.exe are broken - try + string[] dirs = System.IO.Directory.GetDirectories(sdkPathCheck, "10.*"); + // sort and reverse so we try from latest to oldest + System.Array.Sort(dirs); + System.Array.Reverse(dirs); + + // look for the latest dxc.exe available that works + foreach(string path in dirs) { - ProcessStartInfo psi = new ProcessStartInfo(); - psi.UseShellExecute = false; - psi.FileName = dxcCheck; - psi.CreateNoWindow = true; - Process.Start(psi); - DXC = dxcCheck; - return true; - } - catch(Exception ex) - { - // keep going, maybe we'll find one that works + string dxcCheck = System.IO.Path.Combine(path, "x64", "dxc.exe"); + if(System.IO.File.Exists(dxcCheck)) + { + // check that dxc.exe is runnable, some dxc.exe are broken + try + { + ProcessStartInfo psi = new ProcessStartInfo(); + psi.UseShellExecute = false; + psi.FileName = dxcCheck; + psi.CreateNoWindow = true; + Process.Start(psi); + DXC = dxcCheck; + return true; + } + catch(Exception ex) + { + // keep going, maybe we'll find one that works + } + } } } + catch(Exception ex) + { + // try next SDK path + } } + // always succeed even if we don't find dxc return true; } @@ -785,7 +798,7 @@ namespace DXCEnumerateAndCheck { - +