Update dependencies in D3D12 SDK installer script

- Add colored console output.
This commit is contained in:
Hugo Locurcio 2024-05-01 17:13:57 +02:00
parent 7cdad33311
commit 47ac22486d
No known key found for this signature in database
GPG key ID: 39E8F8BE30B0A49C
3 changed files with 35 additions and 13 deletions

38
misc/scripts/install_d3d12_sdk_windows.py Normal file → Executable file
View file

@ -4,6 +4,18 @@ import os
import urllib.request
import shutil
import subprocess
import sys
# Enable ANSI escape code support on Windows 10 and later (for colored console output).
# <https://github.com/python/cpython/issues/73245>
if sys.platform == "win32":
from ctypes import windll, c_int, byref
stdout_handle = windll.kernel32.GetStdHandle(c_int(-11))
mode = c_int(0)
windll.kernel32.GetConsoleMode(c_int(stdout_handle), byref(mode))
mode = c_int(mode.value | 4)
windll.kernel32.SetConsoleMode(c_int(stdout_handle), mode)
# Base Godot dependencies path
# If cross-compiling (no LOCALAPPDATA), we install in `bin`
@ -14,21 +26,27 @@ else:
deps_folder = os.path.join("bin", "build_deps")
# DirectX Shader Compiler
dxc_version = "v1.7.2308"
dxc_filename = "dxc_2023_08_14.zip"
# Check for latest version: https://github.com/microsoft/DirectXShaderCompiler/releases/latest
dxc_version = "v1.8.2403.2"
dxc_filename = "dxc_2024_03_29.zip"
dxc_archive = os.path.join(deps_folder, dxc_filename)
dxc_folder = os.path.join(deps_folder, "dxc")
# Mesa NIR
# Check for latest version: https://github.com/godotengine/godot-nir-static/releases/latest
mesa_version = "23.1.9"
mesa_filename = "godot-nir-23.1.9.zip"
mesa_archive = os.path.join(deps_folder, mesa_filename)
mesa_folder = os.path.join(deps_folder, "mesa")
# WinPixEventRuntime
pix_version = "1.0.231030001"
# Check for latest version: https://www.nuget.org/api/v2/package/WinPixEventRuntime (check downloaded filename)
pix_version = "1.0.240308001"
pix_archive = os.path.join(deps_folder, f"WinPixEventRuntime_{pix_version}.nupkg")
pix_folder = os.path.join(deps_folder, "pix")
# DirectX 12 Agility SDK
agility_sdk_version = "1.610.4"
# Check for latest version: https://www.nuget.org/api/v2/package/Microsoft.Direct3D.D3D12 (check downloaded filename)
# After updating this, remember to change the default value of the `rendering/rendering_device/d3d12/agility_sdk_version`
# project setting to match the minor version (e.g. for `1.613.3`, it should be `613`).
agility_sdk_version = "1.613.3"
agility_sdk_archive = os.path.join(deps_folder, f"Agility_SDK_{agility_sdk_version}.nupkg")
agility_sdk_folder = os.path.join(deps_folder, "agility_sdk")
@ -37,7 +55,7 @@ if not os.path.exists(deps_folder):
os.makedirs(deps_folder)
# DirectX Shader Compiler
print("[1/4] DirectX Shader Compiler")
print("\x1b[1m[1/4] DirectX Shader Compiler\x1b[0m")
if os.path.isfile(dxc_archive):
os.remove(dxc_archive)
print(f"Downloading DirectX Shader Compiler {dxc_filename} ...")
@ -54,7 +72,7 @@ os.remove(dxc_archive)
print(f"DirectX Shader Compiler {dxc_filename} installed successfully.\n")
# Mesa NIR
print("[2/4] Mesa NIR")
print("\x1b[1m[2/4] Mesa NIR\x1b[0m")
if os.path.isfile(mesa_archive):
os.remove(mesa_archive)
print(f"Downloading Mesa NIR {mesa_filename} ...")
@ -81,7 +99,7 @@ if dlltool == "":
dlltool = shutil.which("x86_64-w64-mingw32-dlltool") or ""
has_mingw = gendef != "" and dlltool != ""
print("[3/4] WinPixEventRuntime")
print("\x1b[1m[3/4] WinPixEventRuntime\x1b[0m")
if os.path.isfile(pix_archive):
os.remove(pix_archive)
print(f"Downloading WinPixEventRuntime {pix_version} ...")
@ -112,7 +130,7 @@ else:
print(f"WinPixEventRuntime {pix_version} installed successfully.\n")
# DirectX 12 Agility SDK
print("[4/4] DirectX 12 Agility SDK")
print("\x1b[1m[4/4] DirectX 12 Agility SDK\x1b[0m")
if os.path.isfile(agility_sdk_archive):
os.remove(agility_sdk_archive)
print(f"Downloading DirectX 12 Agility SDK {agility_sdk_version} ...")
@ -128,5 +146,5 @@ os.remove(agility_sdk_archive)
print(f"DirectX 12 Agility SDK {agility_sdk_version} installed successfully.\n")
# Complete message
print(f'All Direct3D 12 SDK components were installed to "{deps_folder}" successfully!')
print('You can now build Godot with Direct3D 12 support enabled by running "scons d3d12=yes".')
print(f'\x1b[92mAll Direct3D 12 SDK components were installed to "{deps_folder}" successfully!\x1b[0m')
print('\x1b[92mYou can now build Godot with Direct3D 12 support enabled by running "scons d3d12=yes".\x1b[0m')