|
4 | 4 | import urllib.request |
5 | 5 | import shutil |
6 | 6 | import subprocess |
| 7 | +import sys |
| 8 | + |
| 9 | +# Enable ANSI escape code support on Windows 10 and later (for colored console output). |
| 10 | +# <https://github.com/python/cpython/issues/73245> |
| 11 | +if sys.platform == "win32": |
| 12 | + from ctypes import windll, c_int, byref |
| 13 | + |
| 14 | + stdout_handle = windll.kernel32.GetStdHandle(c_int(-11)) |
| 15 | + mode = c_int(0) |
| 16 | + windll.kernel32.GetConsoleMode(c_int(stdout_handle), byref(mode)) |
| 17 | + mode = c_int(mode.value | 4) |
| 18 | + windll.kernel32.SetConsoleMode(c_int(stdout_handle), mode) |
7 | 19 |
|
8 | 20 | # Base Godot dependencies path |
9 | 21 | # If cross-compiling (no LOCALAPPDATA), we install in `bin` |
|
14 | 26 | deps_folder = os.path.join("bin", "build_deps") |
15 | 27 |
|
16 | 28 | # DirectX Shader Compiler |
17 | | -dxc_version = "v1.7.2308" |
18 | | -dxc_filename = "dxc_2023_08_14.zip" |
| 29 | +# Check for latest version: https://github.com/microsoft/DirectXShaderCompiler/releases/latest |
| 30 | +dxc_version = "v1.8.2403.2" |
| 31 | +dxc_filename = "dxc_2024_03_29.zip" |
19 | 32 | dxc_archive = os.path.join(deps_folder, dxc_filename) |
20 | 33 | dxc_folder = os.path.join(deps_folder, "dxc") |
21 | 34 | # Mesa NIR |
| 35 | +# Check for latest version: https://github.com/godotengine/godot-nir-static/releases/latest |
22 | 36 | mesa_version = "23.1.9" |
23 | 37 | mesa_filename = "godot-nir-23.1.9.zip" |
24 | 38 | mesa_archive = os.path.join(deps_folder, mesa_filename) |
25 | 39 | mesa_folder = os.path.join(deps_folder, "mesa") |
26 | 40 | # WinPixEventRuntime |
27 | | -pix_version = "1.0.231030001" |
| 41 | +# Check for latest version: https://www.nuget.org/api/v2/package/WinPixEventRuntime (check downloaded filename) |
| 42 | +pix_version = "1.0.240308001" |
28 | 43 | pix_archive = os.path.join(deps_folder, f"WinPixEventRuntime_{pix_version}.nupkg") |
29 | 44 | pix_folder = os.path.join(deps_folder, "pix") |
30 | 45 | # DirectX 12 Agility SDK |
31 | | -agility_sdk_version = "1.610.4" |
| 46 | +# Check for latest version: https://www.nuget.org/api/v2/package/Microsoft.Direct3D.D3D12 (check downloaded filename) |
| 47 | +# After updating this, remember to change the default value of the `rendering/rendering_device/d3d12/agility_sdk_version` |
| 48 | +# project setting to match the minor version (e.g. for `1.613.3`, it should be `613`). |
| 49 | +agility_sdk_version = "1.613.3" |
32 | 50 | agility_sdk_archive = os.path.join(deps_folder, f"Agility_SDK_{agility_sdk_version}.nupkg") |
33 | 51 | agility_sdk_folder = os.path.join(deps_folder, "agility_sdk") |
34 | 52 |
|
|
37 | 55 | os.makedirs(deps_folder) |
38 | 56 |
|
39 | 57 | # DirectX Shader Compiler |
40 | | -print("[1/4] DirectX Shader Compiler") |
| 58 | +print("\x1b[1m[1/4] DirectX Shader Compiler\x1b[0m") |
41 | 59 | if os.path.isfile(dxc_archive): |
42 | 60 | os.remove(dxc_archive) |
43 | 61 | print(f"Downloading DirectX Shader Compiler {dxc_filename} ...") |
|
54 | 72 | print(f"DirectX Shader Compiler {dxc_filename} installed successfully.\n") |
55 | 73 |
|
56 | 74 | # Mesa NIR |
57 | | -print("[2/4] Mesa NIR") |
| 75 | +print("\x1b[1m[2/4] Mesa NIR\x1b[0m") |
58 | 76 | if os.path.isfile(mesa_archive): |
59 | 77 | os.remove(mesa_archive) |
60 | 78 | print(f"Downloading Mesa NIR {mesa_filename} ...") |
|
81 | 99 | dlltool = shutil.which("x86_64-w64-mingw32-dlltool") or "" |
82 | 100 | has_mingw = gendef != "" and dlltool != "" |
83 | 101 |
|
84 | | -print("[3/4] WinPixEventRuntime") |
| 102 | +print("\x1b[1m[3/4] WinPixEventRuntime\x1b[0m") |
85 | 103 | if os.path.isfile(pix_archive): |
86 | 104 | os.remove(pix_archive) |
87 | 105 | print(f"Downloading WinPixEventRuntime {pix_version} ...") |
|
112 | 130 | print(f"WinPixEventRuntime {pix_version} installed successfully.\n") |
113 | 131 |
|
114 | 132 | # DirectX 12 Agility SDK |
115 | | -print("[4/4] DirectX 12 Agility SDK") |
| 133 | +print("\x1b[1m[4/4] DirectX 12 Agility SDK\x1b[0m") |
116 | 134 | if os.path.isfile(agility_sdk_archive): |
117 | 135 | os.remove(agility_sdk_archive) |
118 | 136 | print(f"Downloading DirectX 12 Agility SDK {agility_sdk_version} ...") |
|
128 | 146 | print(f"DirectX 12 Agility SDK {agility_sdk_version} installed successfully.\n") |
129 | 147 |
|
130 | 148 | # Complete message |
131 | | -print(f'All Direct3D 12 SDK components were installed to "{deps_folder}" successfully!') |
132 | | -print('You can now build Godot with Direct3D 12 support enabled by running "scons d3d12=yes".') |
| 149 | +print(f'\x1b[92mAll Direct3D 12 SDK components were installed to "{deps_folder}" successfully!\x1b[0m') |
| 150 | +print('\x1b[92mYou can now build Godot with Direct3D 12 support enabled by running "scons d3d12=yes".\x1b[0m') |
0 commit comments