summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTriang3l <triang3l@yandex.ru>2025-08-19 20:48:26 +0300
committerTriang3l <triang3l@yandex.ru>2025-08-19 20:48:26 +0300
commit3b4b04c371967cb739c17d934e6032042e7c1bbe (patch)
tree1e43786978d996f26f1cb9eb0ac270488b9e50dc
parent42344406810692c1192078b90300d8826314511d (diff)
[Build] Locate FXC among Windows SDK architectures and versions
-rwxr-xr-xxenia-build42
1 files changed, 29 insertions, 13 deletions
diff --git a/xenia-build b/xenia-build
index 130032323..0e0b32269 100755
--- a/xenia-build
+++ b/xenia-build
@@ -11,6 +11,7 @@ from datetime import datetime
from multiprocessing import Pool
from functools import partial
import argparse
+import glob
import json
import os
import re
@@ -917,23 +918,38 @@ class BuildShadersCommand(Command):
if sys.platform == 'win32':
print('Building Direct3D 12 Shader Model 5.1 DXBC shaders...')
- # Get the FXC path.
- # TODO(Triang3l): Find FXC in the most recent Windows SDK.
- program_files_path = os.environ['ProgramFiles(x86)']
- if not os.path.exists(program_files_path):
- print('ERROR: could not find 32-bit Program Files')
+ # Get the path to FXC from the latest Windows SDK version.
+
+ # Assume native or emulated 32-bit x86 if not one of the
+ # architectures listed here.
+ windows_sdk_architecture = 'x86'
+ processor_architecture = os.environ.get(
+ 'PROCESSOR_ARCHITECTURE')
+ if processor_architecture == 'AMD64':
+ windows_sdk_architecture = 'x64'
+ elif processor_architecture == 'ARM64':
+ windows_sdk_architecture = 'arm64'
+ program_files_path = os.environ.get('ProgramFiles(x86)')
+ if program_files_path is None:
+ program_files_path = os.environ.get('ProgramFiles')
+ if (program_files_path is None or
+ not os.path.exists(program_files_path)):
+ print('ERROR: could not find the Program Files folder with '
+ 'the Windows SDK')
return 1
- windows_sdk_bin_path = os.path.join(
- program_files_path, 'Windows Kits/10/bin/10.0.22000.0/x64')
- if not os.path.exists(windows_sdk_bin_path):
- print('ERROR: could not find Windows 10 SDK binaries')
- return 1
- fxc = os.path.join(windows_sdk_bin_path, 'fxc')
- if not has_bin(fxc):
- print('ERROR: could not find fxc')
+ fxc_paths = glob.glob(
+ os.path.join(program_files_path, 'Windows Kits/10/bin/*',
+ windows_sdk_architecture, 'fxc.exe'))
+ if not fxc_paths:
+ print('ERROR: could not find the Windows 10/11 SDK with '
+ 'the Effect-Compiler Tool (FXC)')
return 1
+ # TODO(Triang3l): Sort by version number, not alphabetically.
+ fxc_paths.sort()
+ fxc = fxc_paths[-1]
# Build DXBC.
+
dxbc_stages = ['vs', 'hs', 'ds', 'gs', 'ps', 'cs']
for src_path in src_paths:
src_name = os.path.basename(src_path)