summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-12-04 23:04:25 +0100
committerRémi Verschelde <rverschelde@gmail.com>2023-12-04 23:04:25 +0100
commit81a30b6ea0277692b51eb129058e9fe3b67fd444 (patch)
tree54b8c8bd5e4bf0053bba73c4f99b8e560d1a83f6
parent2b913cc84ad03668586b6abe75dafc83a22bff94 (diff)
parent3f22c1bfb6ff6d6aa6e60c041ab2d9677da8cd51 (diff)
downloadredot-engine-81a30b6ea0277692b51eb129058e9fe3b67fd444.tar.gz
Merge pull request #84593 from brno32/vs-venv-fix
Use Python venv if detected when building VS project
-rw-r--r--methods.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/methods.py b/methods.py
index 83fb0445f0..7c511af930 100644
--- a/methods.py
+++ b/methods.py
@@ -907,9 +907,16 @@ def generate_vs_project(env, original_args, project_name="godot"):
defines=mono_defines,
)
- env["MSVSBUILDCOM"] = module_configs.build_commandline("scons")
- env["MSVSREBUILDCOM"] = module_configs.build_commandline("scons vsproj=yes")
- env["MSVSCLEANCOM"] = module_configs.build_commandline("scons --clean")
+ scons_cmd = "scons"
+
+ path_to_venv = os.getenv("VIRTUAL_ENV")
+ path_to_scons_exe = Path(str(path_to_venv)) / "Scripts" / "scons.exe"
+ if path_to_venv and path_to_scons_exe.exists():
+ scons_cmd = str(path_to_scons_exe)
+
+ env["MSVSBUILDCOM"] = module_configs.build_commandline(scons_cmd)
+ env["MSVSREBUILDCOM"] = module_configs.build_commandline(f"{scons_cmd} vsproj=yes")
+ env["MSVSCLEANCOM"] = module_configs.build_commandline(f"{scons_cmd} --clean")
if not env.get("MSVS"):
env["MSVS"]["PROJECTSUFFIX"] = ".vcxproj"
env["MSVS"]["SOLUTIONSUFFIX"] = ".sln"