Skip to content

Commit

Permalink
Merge pull request #84593 from brno32/vs-venv-fix
Browse files Browse the repository at this point in the history
Use Python venv if detected when building VS project
  • Loading branch information
akien-mga committed Dec 4, 2023
2 parents 2b913cc + 3f22c1b commit 81a30b6
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -907,9 +907,16 @@ def __getitem__(self, k: str):
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"
Expand Down

0 comments on commit 81a30b6

Please sign in to comment.