Skip to content

Commit 5df9867

Browse files
authored
Merge pull request godotengine#85357 from mhilbrunner/fix-generate-vsproj
Fix generating vsproj with SCons 4.6.0+
2 parents 1ba920f + 7211013 commit 5df9867

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

methods.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -708,25 +708,28 @@ def detect_visual_c_compiler_version(tools_env):
708708

709709

710710
def find_visual_c_batch_file(env):
711-
from SCons.Tool.MSCommon.vc import (
712-
get_default_version,
713-
get_host_target,
714-
find_batch_file,
715-
)
711+
from SCons.Tool.MSCommon.vc import get_default_version, get_host_target, find_batch_file, find_vc_pdir
716712

717713
# Syntax changed in SCons 4.4.0.
718714
from SCons import __version__ as scons_raw_version
719715

720716
scons_ver = env._get_major_minor_revision(scons_raw_version)
721717

722-
version = get_default_version(env)
718+
msvc_version = get_default_version(env)
723719

724720
if scons_ver >= (4, 4, 0):
725-
(host_platform, target_platform, _) = get_host_target(env, version)
721+
(host_platform, target_platform, _) = get_host_target(env, msvc_version)
726722
else:
727723
(host_platform, target_platform, _) = get_host_target(env)
728724

729-
return find_batch_file(env, version, host_platform, target_platform)[0]
725+
if scons_ver < (4, 6, 0):
726+
return find_batch_file(env, msvc_version, host_platform, target_platform)[0]
727+
728+
# Scons 4.6.0+ removed passing env, so we need to get the product_dir ourselves first,
729+
# then pass that as the last param instead of env as the first param as before.
730+
# We should investigate if we can avoid relying on SCons internals here.
731+
product_dir = find_vc_pdir(env, msvc_version)
732+
return find_batch_file(msvc_version, host_platform, target_platform, product_dir)[0]
730733

731734

732735
def generate_cpp_hint_file(filename):

0 commit comments

Comments
 (0)