Skip to content

Commit f20ef37

Browse files
committed
Merge pull request #109912 from Repiteo/ci/d3d12-dependency-fix
CI: Fix detection of Windows D3D12 dependencies
2 parents 6281245 + 106c23e commit f20ef37

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

misc/scripts/install_d3d12_sdk_windows.py

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#!/usr/bin/env python
22

3+
if __name__ != "__main__":
4+
raise SystemExit(f'Utility script "{__file__}" should not be used as a module!')
5+
6+
import argparse
37
import os
48
import shutil
59
import subprocess
@@ -10,6 +14,14 @@
1014

1115
from misc.utility.color import Ansi, color_print
1216

17+
parser = argparse.ArgumentParser(description="Install D3D12 dependencies for Windows platforms.")
18+
parser.add_argument(
19+
"--mingw_prefix",
20+
default=os.getenv("MINGW_PREFIX", ""),
21+
help="Explicitly specify a path containing the MinGW bin folder.",
22+
)
23+
args = parser.parse_args()
24+
1325
# Base Godot dependencies path
1426
# If cross-compiling (no LOCALAPPDATA), we install in `bin`
1527
deps_folder = os.getenv("LOCALAPPDATA")
@@ -74,10 +86,11 @@
7486
# MinGW needs DLLs converted with dlltool.
7587
# We rely on finding gendef/dlltool to detect if we have MinGW.
7688
# Check existence of needed tools for generating mingw library.
77-
gendef = shutil.which("gendef") or ""
78-
dlltool = shutil.which("dlltool") or ""
79-
if dlltool == "":
80-
dlltool = shutil.which("x86_64-w64-mingw32-dlltool") or ""
89+
pathstr = os.environ.get("PATH", "")
90+
if args.mingw_prefix:
91+
pathstr = os.path.join(args.mingw_prefix, "bin") + os.pathsep + pathstr
92+
gendef = shutil.which("x86_64-w64-mingw32-gendef", path=pathstr) or shutil.which("gendef", path=pathstr) or ""
93+
dlltool = shutil.which("x86_64-w64-mingw32-dlltool", path=pathstr) or shutil.which("dlltool", path=pathstr) or ""
8194
has_mingw = gendef != "" and dlltool != ""
8295

8396
color_print(f"{Ansi.BOLD}[2/3] WinPixEventRuntime")
@@ -107,7 +120,9 @@
107120
)
108121
os.chdir(cwd)
109122
else:
110-
print("MinGW wasn't found, so only MSVC support is provided for WinPixEventRuntime.")
123+
print(
124+
'MinGW support requires "dlltool" and "gendef" dependencies, so only MSVC support is provided for WinPixEventRuntime. Did you forget to provide a `--mingw_prefix`?'
125+
)
111126
print(f"WinPixEventRuntime {pix_version} installed successfully.\n")
112127

113128
# DirectX 12 Agility SDK

0 commit comments

Comments
 (0)