From 1d29fb08536758918e5d7c38ee1d5f3ecd7a40c7 Mon Sep 17 00:00:00 2001 From: Andreia Gaita Date: Mon, 12 Feb 2024 16:39:58 +0100 Subject: [PATCH] VS: Fix user workflows with custom user VS configurations Users can add additional VS project configurations with their own custom settings, but to support this workflow, we can't rely directly on $(Platform) and $(Configuration), because VS needs those to be both unique Configuration|Platform combos, and we need to allow for different combos of Configuration|Platform to point to the same scons build configuration. GodotPlatform and GodotConfiguration properties lets us decouple from the magic VS properties that we don't control, so users can add however many Platform|Configuration combos they want and still point to a specific GodotPlatform|GodotConfiguration build config. --- methods.py | 20 +++++++++++++++++++- misc/msvs/props.template | 2 +- misc/msvs/vcxproj.template | 10 ++++------ 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/methods.py b/methods.py index c22b1f11e467..69d8df1d72f4 100644 --- a/methods.py +++ b/methods.py @@ -1367,7 +1367,7 @@ def format_key_value(v): vsconf = f'{target}|{a["platform"]}' break - condition = "'$(Configuration)|$(Platform)'=='" + vsconf + "'" + condition = "'$(GodotConfiguration)|$(GodotPlatform)'=='" + vsconf + "'" properties.append(";" + ";".join(activeItems) + ";") output = f'bin\\godot{env["PROGSUFFIX"]}' @@ -1482,6 +1482,13 @@ def format_key_value(v): "", ] + properties += [ + f"", + f" {godot_target}", + f" {proj_plat}", + "", + ] + if godot_platform != "windows": configurations += [ f'', @@ -1490,6 +1497,13 @@ def format_key_value(v): "", ] + properties += [ + f"", + f" editor", + f" {proj_plat}", + "", + ] + p = f"{project_name}.{godot_platform}.{godot_target}.{godot_arch}.generated.props" imports += [ f'' @@ -1502,6 +1516,10 @@ def format_key_value(v): f"{{{proj_uuid}}}.{godot_target}|{sln_plat}.Build.0 = {godot_target}|{proj_plat}", ] + # Add an extra import for a local user props file at the end, so users can add more overrides. + imports += [ + f'' + ] section1 = sorted(section1) section2 = sorted(section2) diff --git a/misc/msvs/props.template b/misc/msvs/props.template index 9ecd49a25ee1..8facaf7f36e2 100644 --- a/misc/msvs/props.template +++ b/misc/msvs/props.template @@ -1,6 +1,6 @@ - + %%BUILD%% %%REBUILD%% %%CLEAN%% diff --git a/misc/msvs/vcxproj.template b/misc/msvs/vcxproj.template index a1cf22bfb9b8..30f29a55f876 100644 --- a/misc/msvs/vcxproj.template +++ b/misc/msvs/vcxproj.template @@ -9,23 +9,21 @@ MakeFileProj NoUpgrade - - %%PROPERTIES%% - + %%PROPERTIES%% Makefile false v143 - $(SolutionDir)\bin\$(Platform)\$(Configuration)\ - obj\$(Platform)\$(Configuration)\ + $(SolutionDir)\bin\$(GodotPlatform)\$(GodotConfiguration)\ + obj\$(GodotPlatform)\$(GodotConfiguration)\ $(OutDir)\Layout - +