summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-02-13 11:25:10 +0100
committerRémi Verschelde <rverschelde@gmail.com>2024-02-13 11:25:10 +0100
commit2db4dd42cf76ab2c8f398c3253f9f4290e1d1d35 (patch)
tree6856e5a9bdface56b08ad429cc1525d00b0dc61b
parent8b72165b5f89ad40f2d099b32bf224b1a09435f5 (diff)
parent1d29fb08536758918e5d7c38ee1d5f3ecd7a40c7 (diff)
downloadredot-engine-2db4dd42cf76ab2c8f398c3253f9f4290e1d1d35.tar.gz
Merge pull request #88253 from shana/vs-add-custom-config-support
Visual Studio: Fix user workflows with custom user VS configurations
-rw-r--r--methods.py20
-rw-r--r--misc/msvs/props.template2
-rw-r--r--misc/msvs/vcxproj.template10
3 files changed, 24 insertions, 8 deletions
diff --git a/methods.py b/methods.py
index c22b1f11e4..69d8df1d72 100644
--- a/methods.py
+++ b/methods.py
@@ -1367,7 +1367,7 @@ def generate_vs_project(env, original_args, project_name="godot"):
vsconf = f'{target}|{a["platform"]}'
break
- condition = "'$(Configuration)|$(Platform)'=='" + vsconf + "'"
+ condition = "'$(GodotConfiguration)|$(GodotPlatform)'=='" + vsconf + "'"
properties.append("<ActiveProjectItemList>;" + ";".join(activeItems) + ";</ActiveProjectItemList>")
output = f'bin\\godot{env["PROGSUFFIX"]}'
@@ -1482,6 +1482,13 @@ def generate_vs_project(env, original_args, project_name="godot"):
"</ProjectConfiguration>",
]
+ properties += [
+ f"<PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='{godot_target}|{proj_plat}'\">",
+ f" <GodotConfiguration>{godot_target}</GodotConfiguration>",
+ f" <GodotPlatform>{proj_plat}</GodotPlatform>",
+ "</PropertyGroup>",
+ ]
+
if godot_platform != "windows":
configurations += [
f'<ProjectConfiguration Include="editor|{proj_plat}">',
@@ -1490,6 +1497,13 @@ def generate_vs_project(env, original_args, project_name="godot"):
"</ProjectConfiguration>",
]
+ properties += [
+ f"<PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='editor|{proj_plat}'\">",
+ f" <GodotConfiguration>editor</GodotConfiguration>",
+ f" <GodotPlatform>{proj_plat}</GodotPlatform>",
+ "</PropertyGroup>",
+ ]
+
p = f"{project_name}.{godot_platform}.{godot_target}.{godot_arch}.generated.props"
imports += [
f'<Import Project="$(MSBuildProjectDirectory)\\{p}" Condition="Exists(\'$(MSBuildProjectDirectory)\\{p}\')"/>'
@@ -1502,6 +1516,10 @@ def generate_vs_project(env, original_args, project_name="godot"):
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'<Import Project="$(MSBuildProjectDirectory)\\{project_name}.vs.user.props" Condition="Exists(\'$(MSBuildProjectDirectory)\\{project_name}.vs.user.props\')"/>'
+ ]
section1 = sorted(section1)
section2 = sorted(section2)
diff --git a/misc/msvs/props.template b/misc/msvs/props.template
index 9ecd49a25e..8facaf7f36 100644
--- a/misc/msvs/props.template
+++ b/misc/msvs/props.template
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="17.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='%%VSCONF%%'">
+ <PropertyGroup Condition="'$(GodotConfiguration)|$(GodotPlatform)'=='%%VSCONF%%'">
<NMakeBuildCommandLine>%%BUILD%%</NMakeBuildCommandLine>
<NMakeReBuildCommandLine>%%REBUILD%%</NMakeReBuildCommandLine>
<NMakeCleanCommandLine>%%CLEAN%%</NMakeCleanCommandLine>
diff --git a/misc/msvs/vcxproj.template b/misc/msvs/vcxproj.template
index a1cf22bfb9..30f29a55f8 100644
--- a/misc/msvs/vcxproj.template
+++ b/misc/msvs/vcxproj.template
@@ -9,23 +9,21 @@
<Keyword>MakeFileProj</Keyword>
<VCProjectUpgraderObjectName>NoUpgrade</VCProjectUpgraderObjectName>
</PropertyGroup>
- <PropertyGroup>
- %%PROPERTIES%%
- </PropertyGroup>
+ %%PROPERTIES%%
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Label="Configuration">
<ConfigurationType>Makefile</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<PlatformToolset>v143</PlatformToolset>
- <OutDir>$(SolutionDir)\bin\$(Platform)\$(Configuration)\</OutDir>
- <IntDir>obj\$(Platform)\$(Configuration)\</IntDir>
+ <OutDir>$(SolutionDir)\bin\$(GodotPlatform)\$(GodotConfiguration)\</OutDir>
+ <IntDir>obj\$(GodotPlatform)\$(GodotConfiguration)\</IntDir>
<LayoutDir>$(OutDir)\Layout</LayoutDir>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(GodotPlatform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(GodotPlatform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>