mirror of
https://github.com/xenia-project/xenia.git
synced 2025-12-06 07:12:03 +01:00
[Build] Locate FXC among Windows SDK architectures and versions
This commit is contained in:
parent
4234440681
commit
3b4b04c371
42
xenia-build
42
xenia-build
|
|
@ -11,6 +11,7 @@ from datetime import datetime
|
||||||
from multiprocessing import Pool
|
from multiprocessing import Pool
|
||||||
from functools import partial
|
from functools import partial
|
||||||
import argparse
|
import argparse
|
||||||
|
import glob
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
|
@ -917,23 +918,38 @@ class BuildShadersCommand(Command):
|
||||||
if sys.platform == 'win32':
|
if sys.platform == 'win32':
|
||||||
print('Building Direct3D 12 Shader Model 5.1 DXBC shaders...')
|
print('Building Direct3D 12 Shader Model 5.1 DXBC shaders...')
|
||||||
|
|
||||||
# Get the FXC path.
|
# Get the path to FXC from the latest Windows SDK version.
|
||||||
# TODO(Triang3l): Find FXC in the most recent Windows SDK.
|
|
||||||
program_files_path = os.environ['ProgramFiles(x86)']
|
# Assume native or emulated 32-bit x86 if not one of the
|
||||||
if not os.path.exists(program_files_path):
|
# architectures listed here.
|
||||||
print('ERROR: could not find 32-bit Program Files')
|
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
|
return 1
|
||||||
windows_sdk_bin_path = os.path.join(
|
fxc_paths = glob.glob(
|
||||||
program_files_path, 'Windows Kits/10/bin/10.0.22000.0/x64')
|
os.path.join(program_files_path, 'Windows Kits/10/bin/*',
|
||||||
if not os.path.exists(windows_sdk_bin_path):
|
windows_sdk_architecture, 'fxc.exe'))
|
||||||
print('ERROR: could not find Windows 10 SDK binaries')
|
if not fxc_paths:
|
||||||
return 1
|
print('ERROR: could not find the Windows 10/11 SDK with '
|
||||||
fxc = os.path.join(windows_sdk_bin_path, 'fxc')
|
'the Effect-Compiler Tool (FXC)')
|
||||||
if not has_bin(fxc):
|
|
||||||
print('ERROR: could not find fxc')
|
|
||||||
return 1
|
return 1
|
||||||
|
# TODO(Triang3l): Sort by version number, not alphabetically.
|
||||||
|
fxc_paths.sort()
|
||||||
|
fxc = fxc_paths[-1]
|
||||||
|
|
||||||
# Build DXBC.
|
# Build DXBC.
|
||||||
|
|
||||||
dxbc_stages = ['vs', 'hs', 'ds', 'gs', 'ps', 'cs']
|
dxbc_stages = ['vs', 'hs', 'ds', 'gs', 'ps', 'cs']
|
||||||
for src_path in src_paths:
|
for src_path in src_paths:
|
||||||
src_name = os.path.basename(src_path)
|
src_name = os.path.basename(src_path)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue