Skip to content

Commit d3ee594

Browse files
committed
sln, vcxproj, props and targets for Rider to work on all OS and automatically resolve C++ standard libraries
1 parent 4327435 commit d3ee594

File tree

5 files changed

+148
-0
lines changed

5 files changed

+148
-0
lines changed

godot-cpp-example.sln

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Microsoft Visual Studio Solution File, Format Version 12.00
2+
# Visual Studio Version 17
3+
VisualStudioVersion = 17.7.34221.43
4+
MinimumVisualStudioVersion = 10.0.40219.1
5+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "godot", "godot.vcxproj", "{9A2FB295-38D9-4994-9497-26FF91C85465}"
6+
EndProject
7+
Global
8+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
9+
Debug|x64 = Debug|x64
10+
Debug|arm64 = Debug|arm64
11+
Debug|Win32 = Debug|Win32
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{9A2FB295-38D9-4994-9497-26FF91C85465}.debug|x64.ActiveCfg = debug|x64
15+
{9A2FB295-38D9-4994-9497-26FF91C85465}.debug|x64.Build.0 = debug|x64
16+
{9A2FB295-38D9-4994-9497-26FF91C85465}.debug|arm64.ActiveCfg = debug|arm64
17+
{9A2FB295-38D9-4994-9497-26FF91C85465}.debug|arm64.Build.0 = debug|arm64
18+
{9A2FB295-38D9-4994-9497-26FF91C85465}.debug|Win32.ActiveCfg = debug|Win32
19+
{9A2FB295-38D9-4994-9497-26FF91C85465}.debug|Win32.Build.0 = debug|Win32
20+
EndGlobalSection
21+
GlobalSection(SolutionProperties) = preSolution
22+
HideSolutionNode = FALSE
23+
EndGlobalSection
24+
GlobalSection(ExtensibilityGlobals) = postSolution
25+
SolutionGuid = {75408944-4e38-4094-a91b-4730439ab8ee}
26+
EndGlobalSection
27+
EndGlobal

godot.vcxproj

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup Label="Globals">
4+
<ProjectGuid>{9A2FB295-38D9-4994-9497-26FF91C85465}</ProjectGuid>
5+
<RootNamespace>godot</RootNamespace>
6+
<Keyword>MakeFileProj</Keyword>
7+
<VCProjectUpgraderObjectName>NoUpgrade</VCProjectUpgraderObjectName>
8+
</PropertyGroup>
9+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|arm64'">
10+
<GodotConfiguration>Debug</GodotConfiguration>
11+
<GodotPlatform>arm64</GodotPlatform>
12+
</PropertyGroup>
13+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
14+
<GodotConfiguration>Debug</GodotConfiguration>
15+
<GodotPlatform>x64</GodotPlatform>
16+
</PropertyGroup>
17+
<PropertyGroup>
18+
<IsWindows>$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))</IsWindows>
19+
<IsMac>$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))</IsMac>
20+
<IsLinux>$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))</IsLinux>
21+
</PropertyGroup>
22+
<Import Project="$(VCTargetsPath)/Microsoft.Cpp.Default.props" Condition="$(IsWindows)"/>
23+
<Import Project="$(MSBuildProjectDirectory)/targets/JetBrains.Rider.Cpp.targets" Condition="$(IsMac) OR $(IsLinux)"/>
24+
<PropertyGroup Label="Configuration">
25+
<ConfigurationType>Makefile</ConfigurationType>
26+
<UseOfMfc>false</UseOfMfc>
27+
<PlatformToolset>v143</PlatformToolset> <!--Might be overridden in the platform specific import or Microsoft.Cpp.$(GodotPlatform).user.props -->
28+
<DefaultPlatformToolset Condition="'$(DefaultPlatformToolset)'==''"/> <!--Workaround until https://youtrack.jetbrains.com/issue/RIDER-123783 is resolved. -->
29+
<OutDir>$(SolutionDir)/bin</OutDir>
30+
<IntDir>obj/</IntDir>
31+
<LayoutDir>$(OutDir)/Layout</LayoutDir>
32+
<NMakeIncludeSearchPath>godot-cpp/gen/include;godot-cpp/include;godot-cpp/gdextension;$(NMakeIncludeSearchPath);</NMakeIncludeSearchPath>
33+
</PropertyGroup>
34+
<Import Project="$(VCTargetsPath)/Microsoft.Cpp.props" Condition="$(IsWindows)"/>
35+
<ImportGroup Label="ExtensionSettings">
36+
</ImportGroup>
37+
<PropertyGroup Label="UserMacros" />
38+
<Import Project="$(MSBuildProjectDirectory)/targets/godot.props"/>
39+
<Import Project="$(MSBuildProjectDirectory)/targets/godot.user.props" Condition="Exists('$(MSBuildProjectDirectory)/targets/godot.user.props')"/>
40+
<ItemGroup>
41+
<ClInclude Include="godot-cpp/**/*.h"/>
42+
<ClInclude Include="godot-cpp/**/*.hpp"/>
43+
<ClInclude Include="src/**/*.h"/>
44+
<ClCompile Include="godot-cpp/**/*.cpp"/>
45+
<ClCompile Include="src/**/*.cpp"/>
46+
</ItemGroup>
47+
<!-- Build/Rebuild/Clean targets for NMake are defined in MSVC, so we need to provide them, when using MSBuild without MSVC targets -->
48+
<Import Project="$(MSBuildProjectDirectory)/targets/nmake.substitution.props" Condition="!Exists('$(VCTargetsPath)/Microsoft.Cpp.targets')" />
49+
50+
<Import Project="$(VCTargetsPath)/Microsoft.Cpp.targets" Condition="$(IsWindows)"/>
51+
</Project>

targets/JetBrains.Rider.Cpp.targets

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
3+
<!-- do not rename this target, Rider calls it on the properties evaluation -->
4+
<Target Name="CollectPackageReferences" Condition="'$(DesignTimeBuild)' == 'true'">
5+
<Message Text="Resolving toolchain..." Importance="High" />
6+
7+
<!-- Query clang include paths -->
8+
<Exec Command="clang++ -v -E -x c++ /dev/null 2&gt;&amp;1 | sed -n '/#include &lt;...&gt; search starts here:/,/End of search list/p' | tail -n +2 | grep -v 'End of search list' | xargs -I{} echo -n '{};'" ConsoleToMsBuild="true">
9+
<Output TaskParameter="ConsoleOutput" PropertyName="ClangIncludeDirs"/>
10+
</Exec>
11+
12+
<PropertyGroup>
13+
<NMakeIncludeSearchPath>$(ClangIncludeDirs)$(NMakeIncludeSearchPath)</NMakeIncludeSearchPath>
14+
</PropertyGroup>
15+
16+
<Message Text="NMakeIncludeSearchPath: $(NMakeIncludeSearchPath)"/>
17+
</Target>
18+
19+
</Project>

targets/godot.props

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="17.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<NMakeBuildCommandLine>echo Starting SCons &amp; scons --directory=&quot;$(ProjectDir.TrimEnd(&apos;\&apos;))&quot; dev_build=yes</NMakeBuildCommandLine>
5+
<NMakeReBuildCommandLine>echo Starting SCons &amp; scons --directory=&quot;$(ProjectDir.TrimEnd(&apos;\&apos;))&quot; dev_build=yes</NMakeReBuildCommandLine>
6+
<NMakeCleanCommandLine>echo Starting SCons &amp; scons --clean --directory=&quot;$(ProjectDir.TrimEnd(&apos;\&apos;))&quot; dev_build=yes</NMakeCleanCommandLine>
7+
<NMakeOutput Condition="'$(NMakeOutput)' == ''">bin/godot.macos.editor.dev</NMakeOutput>
8+
<NMakePreprocessorDefinitions>TOOLS_ENABLED;DEBUG_ENABLED;DEV_ENABLED;ENGINE_UPDATE_CHECK_ENABLED;NO_EDITOR_SPLASH;ACCESSKIT_DYNAMIC;ACCESSKIT_ENABLED;MACOS_ENABLED;UNIX_ENABLED;COREAUDIO_ENABLED;COREMIDI_ENABLED;GLES3_ENABLED;METAL_ENABLED;RD_ENABLED;VULKAN_ENABLED;MINIZIP_ENABLED;BROTLI_ENABLED;THREADS_ENABLED;CLIPPER2_ENABLED;ZLIB_DEBUG;ZSTD_STATIC_LINKING_ONLY;VK_USE_PLATFORM_MACOS_MVK;VK_USE_PLATFORM_METAL_EXT;GLAD_ENABLED;EGL_ENABLED;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>
9+
<NMakeForcedIncludes>$(NMakeForcedIncludes)</NMakeForcedIncludes>
10+
<NMakeAssemblySearchPath>$(NMakeAssemblySearchPath)</NMakeAssemblySearchPath>
11+
<NMakeForcedUsingAssemblies>$(NMakeForcedUsingAssemblies)</NMakeForcedUsingAssemblies>
12+
</PropertyGroup>
13+
</Project>

targets/nmake.substitution.props

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<!-- override the PlatformToolset, which is set in the godot.vcxproj-->
5+
<!-- Unknown matches to a set of conservative rules for the code analysis-->
6+
<PlatformToolset>Unknown</PlatformToolset>
7+
<LocalDebuggerCommand Condition="'$(LocalDebuggerCommand)' == ''">$(NMakeOutput)</LocalDebuggerCommand>
8+
</PropertyGroup>
9+
<!-- Build/Rebuild/Clean targets for NMake are defined in MSVC, so we need to provide them, when using MSBuild without MSVC targets -->
10+
<Target Name="Build">
11+
<Exec Command="$(NMakeBuildCommandLine)"/>
12+
</Target>
13+
<Target Name="Rebuild">
14+
<Exec Command="$(NMakeReBuildCommandLine)"/>
15+
</Target>
16+
<Target Name="Clean">
17+
<Exec Command="$(NMakeCleanCommandLine)"/>
18+
</Target>
19+
<ItemDefinitionGroup>
20+
<ClCompile>
21+
<AdditionalOptions>$(AdditionalOptions)</AdditionalOptions>
22+
<ForcedIncludeFiles>$(NMakeForcedIncludes)</ForcedIncludeFiles>
23+
<ForcedUsingFiles>$(NMakeForcedUsingAssemblies)</ForcedUsingFiles>
24+
<PreprocessorDefinitions>$(NMakePreprocessorDefinitions)</PreprocessorDefinitions>
25+
</ClCompile>
26+
<!-- check get_platforms in each msvs.py for possible value of those conditions -->
27+
<!-- MSVC Platform.Common.props for possible TargetMachine values -->
28+
<Link Condition="'$(Platform)' == 'arm64'">
29+
<TargetMachine>MachineARM64</TargetMachine>
30+
</Link>
31+
<Link Condition="'$(Platform)' == 'x64'">
32+
<TargetMachine>MachineX64</TargetMachine>
33+
</Link>
34+
<Link Condition="'$(Platform)' == 'Win32'">
35+
<TargetMachine>MachineX86</TargetMachine>
36+
</Link>
37+
</ItemDefinitionGroup>
38+
</Project>

0 commit comments

Comments
 (0)