SCons: Fix Windows cross-compilation from Linux after #86717

This commit is contained in:
Rémi Verschelde 2024-01-26 12:26:13 +01:00
parent 99ac3d332a
commit b4e519b07f
No known key found for this signature in database
GPG Key ID: C3336907360768E1
2 changed files with 22 additions and 3 deletions

View File

@ -5,7 +5,13 @@ import urllib.request
import shutil
# Base Godot dependencies path
deps_folder = os.path.join(f"{os.getenv('LOCALAPPDATA')}", "Godot", "build_deps")
# If cross-compiling (no LOCALAPPDATA), we install in `bin`
deps_folder = os.getenv("LOCALAPPDATA")
if deps_folder:
deps_folder = os.path.join(deps_folder, "Godot", "build_deps")
else:
deps_folder = os.path.join("bin", "build_deps")
# DirectX Shader Compiler
dxc_version = "v1.7.2308"
dxc_filename = "dxc_2023_08_14.zip"

View File

@ -164,8 +164,21 @@ def get_opts():
mingw = os.getenv("MINGW_PREFIX", "")
# Direct3D 12 SDK dependencies folder
d3d12_deps_folder = os.path.join(os.getenv("LOCALAPPDATA"), "Godot", "build_deps")
# Direct3D 12 SDK dependencies folder.
d3d12_deps_folder = os.getenv("LOCALAPPDATA")
if d3d12_deps_folder:
d3d12_deps_folder = os.path.join(d3d12_deps_folder, "Godot", "build_deps")
else:
# Cross-compiling, the deps install script puts things in `bin`.
# Getting an absolute path to it is a bit hacky in Python.
try:
import inspect
caller_frame = inspect.stack()[1]
caller_script_dir = os.path.dirname(os.path.abspath(caller_frame[1]))
d3d12_deps_folder = os.path.join(caller_script_dir, "bin", "build_deps")
except: # Give up.
d3d12_deps_folder = ""
return [
("mingw_prefix", "MinGW prefix", mingw),