Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .sln/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# JetBrains Rider C++ support files (.sln folder)

Rider uses these files to resolve C++, provide code insight, and create/run build configs. They also supply MSBuild/NMake metadata so projects index and build correctly.

- godot-cpp-example.sln
- Solution that groups the C++ projects and lists all Configuration|Platform pairs shown in the Solution Configuration selector.

- gdext.vcxproj
- GDExtension C++ project. Rider reads compiler options/defines/includes and also calls scons to build the extension library (.dll/.so/.dylib).

- targets/JetBrains.Rider.Cpp.targets (for non-Windows)
- MSBuild target that resolves C++ standard library headers.

- targets/nmake.substitution.props (for non-Windows)
- Substitutes Build/Rebuild/Clean targets.
- Reference: [godot/misc/msvs/nmake.substitution.props](https://github.com/godotengine/godot/blob/master/misc/msvs/nmake.substitution.props)


Sln to vcxproj relation:
- The .sln file lists all Configuration|Platform pairs in SolutionConfigurationPlatforms (e.g., Debug|linux-x86_64).
- The same pairs are mapped to the gdext project in ProjectConfigurationPlatforms, so the project gets the exact Configuration and Platform selected in the IDE.
- In gdext.vcxproj, $(Configuration) toggles Debug/Release props, while $(Platform) is matched by Condition blocks to set GodotPlatform and Arch.
- Those values feed the NMake commands, which call scons with platform=$(GodotPlatform) arch=$(Arch) target=$(GodotTemplate).
- Result: choosing a Solution configuration in Rider/VS selects the matching vcxproj config and builds the right target for your OS/arch.
- sln and vcxproj are meant to be manually edited in Rider.

Notes:
- Full `godot-cpp-template` folder can be linked by context menu of the solution root (Add | Existing folder)
- Auxiliary project linking `demo` game contents can be added optionally in the `demo` folder. Rider plugins for Godot would provide language support, run configurations and other features for such projects.
- Theoretically there is an option to use non-msvc toolchain on Windows, but there are known problems with it in Rider debugger [RIDER-106816], so for now for this project on Windows MSBuild with MSVC toolchain is a requirement to work in Rider.
18 changes: 18 additions & 0 deletions .sln/targets/JetBrains.Rider.Cpp.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- do not rename this target, Rider calls it on the properties evaluation -->
<Target Name="ResolveFrameworkReferences" Condition="'$(DesignTimeBuild)' == 'true'">
<Message Text="Resolving toolchain..." Importance="High"/>

<!-- Query clang include paths -->
<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">
<Output TaskParameter="ConsoleOutput" PropertyName="ClangIncludeDirs"/>
</Exec>

<PropertyGroup>
<NMakeIncludeSearchPath>$(ClangIncludeDirs);$(NMakeIncludeSearchPath)</NMakeIncludeSearchPath>
</PropertyGroup>

<Message Text="NMakeIncludeSearchPath: $(NMakeIncludeSearchPath)"/>
</Target>

</Project>
28 changes: 28 additions & 0 deletions .sln/targets/nmake.substitution.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Build/Rebuild/Clean targets for NMake are defined in MSVC, so we need to provide them, when using MSBuild without MSVC targets -->
<Target Name="Build">
<Exec Command="$(NMakeBuildCommandLine)"
WorkingDirectory="$(NMakeWorkingDirectory)"/>
</Target>
<Target Name="Rebuild">
<Exec Command="$(NMakeReBuildCommandLine)"
WorkingDirectory="$(NMakeWorkingDirectory)"/>
</Target>
<Target Name="Clean">
<Exec Command="$(NMakeCleanCommandLine)"
WorkingDirectory="$(NMakeWorkingDirectory)"/>
</Target>
<ItemDefinitionGroup>
<!-- Reflects what Platform.Common.props does. -->
<Link Condition="'$(Arch)' == 'arm64'">
<TargetMachine>MachineARM64</TargetMachine>
</Link>
<Link Condition="'$(Arch)' == 'x86_64'">
<TargetMachine>MachineX64</TargetMachine>
</Link>
<Link Condition="'$(Arch)' == 'x86_32'">
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
</Project>
135 changes: 135 additions & 0 deletions gdext.vcxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<RepoRoot>$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)'))</RepoRoot>
</PropertyGroup>

<PropertyGroup Label="Globals">
<ProjectGuid>{9A2FB295-38D9-4994-9497-26FF91C85465}</ProjectGuid>
<RootNamespace>godot</RootNamespace>
<Keyword>MakeFileProj</Keyword>
<VCProjectUpgraderObjectName>NoUpgrade</VCProjectUpgraderObjectName>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)'=='Debug'">
<GodotTemplate>template_debug</GodotTemplate>
<BuildType>dev_build=yes</BuildType>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)'=='Release'">
<GodotTemplate>template_release</GodotTemplate>
</PropertyGroup>

<!-- Windows, MSVC wants Platform specific Win32 or x64 -->
<PropertyGroup Condition="'$(Platform)'=='Win32'">
<GodotPlatform>windows</GodotPlatform>
<Arch>x86_32</Arch>
</PropertyGroup>
<PropertyGroup Condition="'$(Platform)'=='x64'">
<GodotPlatform>windows</GodotPlatform>
<Arch>x86_64</Arch>
</PropertyGroup>

<!-- Linux -->
<PropertyGroup Condition="'$(Platform)'=='linux-x86_64'">
<GodotPlatform>linux</GodotPlatform>
<Arch>x86_64</Arch>
</PropertyGroup>
<PropertyGroup Condition="'$(Platform)'=='linux-arm64'">
<GodotPlatform>linux</GodotPlatform>
<Arch>arm64</Arch>
</PropertyGroup>
<PropertyGroup Condition="'$(Platform)'=='linux-rv64'">
<GodotPlatform>linux</GodotPlatform>
<Arch>rv64</Arch>
</PropertyGroup>

<!-- macOS (no arch in config) -->
<PropertyGroup Condition="'$(Platform)'=='macos'">
<GodotPlatform>macos</GodotPlatform>
<Arch></Arch> <!-- no arch in example.gdextension -->
</PropertyGroup>

<!-- iOS -->
<PropertyGroup Condition="'$(Platform)'=='ios-arm64'">
<GodotPlatform>ios</GodotPlatform>
<Arch>arm64</Arch>
</PropertyGroup>

<!-- Android -->
<PropertyGroup Condition="'$(Platform)'=='android-x86_64'">
<GodotPlatform>android</GodotPlatform>
<Arch>x86_64</Arch>
</PropertyGroup>
<PropertyGroup Condition="'$(Platform)'=='android-arm64'">
<GodotPlatform>android</GodotPlatform>
<Arch>arm64</Arch>
</PropertyGroup>

<!-- Web (wasm32) -->
<PropertyGroup Condition="'$(Platform)'=='web-wasm32'">
<GodotPlatform>web</GodotPlatform>
<Arch>wasm32</Arch>
</PropertyGroup>

<PropertyGroup>
<IsWindows>$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))</IsWindows>
<IsMac>$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))</IsMac>
<IsLinux>$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))</IsLinux>
</PropertyGroup>
<Import Project="$(VCTargetsPath)/Microsoft.Cpp.Default.props" Condition="$(IsWindows)"/>
<Import Project="$(MSBuildProjectDirectory)/.sln/targets/JetBrains.Rider.Cpp.targets" Condition="$(IsMac) OR $(IsLinux)"/>

<PropertyGroup Label="UserMacros">
<!-- can be overridden in godot.user.props -->
<Precision Condition="'$(Precision)' == ''">single</Precision> <!--single or double-->
<Threads Condition="'$(Threads)' == ''">threads</Threads>
</PropertyGroup>
<Import Project="$(MSBuildProjectDirectory)/.sln/targets/godot.user.props" Condition="Exists('$(MSBuildProjectDirectory)/.sln/targets/godot.user.props')"/>

<PropertyGroup Label="Configuration">
<ConfigurationType>Makefile</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<!-- Possible values: V143, Clang_Mac, Clang_Linux, llvm, Clang, ClangCL, MSFS, Unknown-->
<!-- Select toolset based on target GodotPlatform. Switches Cpp dialect a bit -->
<PlatformToolset Condition="'$(GodotPlatform)'=='windows'">v143</PlatformToolset>
<PlatformToolset Condition="'$(GodotPlatform)'=='macos' or '$(GodotPlatform)'=='ios'">Clang_Mac</PlatformToolset>
<PlatformToolset Condition="'$(GodotPlatform)'=='linux'">Clang_Linux</PlatformToolset>
<PlatformToolset Condition="'$(GodotPlatform)'=='android'">Clang_Linux</PlatformToolset>
<PlatformToolset Condition="'$(GodotPlatform)'=='web'">Clang_Linux</PlatformToolset>
<!-- Fallback when platform is not matched -->
<PlatformToolset Condition="'$(PlatformToolset)'==''">v143</PlatformToolset>
<DefaultPlatformToolset>$(PlatformToolset)</DefaultPlatformToolset>

<NMakeWorkingDirectory>$(RepoRoot)</NMakeWorkingDirectory>
<NMakeOutput Condition="'$(NMakeOutput)' == ''">dylib</NMakeOutput> <!--any non empty value required for automatic run configuration generation in Rider -->
<LocalDebuggerWorkingDirectory Condition="'$(LocalDebuggerWorkingDirectory)' == ''">$(NMakeWorkingDirectory)/demo</LocalDebuggerWorkingDirectory>
<LocalDebuggerCommandArguments>--editor</LocalDebuggerCommandArguments>
<NMakeIncludeSearchPath>$(RepoRoot)/godot-cpp/gen/include;$(RepoRoot)/godot-cpp/include;$(RepoRoot)/godot-cpp/gdextension;$(NMakeIncludeSearchPath);</NMakeIncludeSearchPath>
</PropertyGroup>

<PropertyGroup Condition="!$(IsWindows)" Label="Configuration">
<!-- Commands executed by Build/Rebuild/Clean in the IDE (Rider, VS) -->
<NMakeBuildCommandLine>scons platform=$(GodotPlatform) arch=$(Arch) target=$(GodotTemplate) $(BuildType)</NMakeBuildCommandLine>
<NMakeReBuildCommandLine>scons --clean platform=$(GodotPlatform) arch=$(Arch) target=$(GodotTemplate) &amp;&amp; scons platform=$(GodotPlatform) arch=$(Arch) target=$(GodotTemplate)</NMakeReBuildCommandLine>
<NMakeCleanCommandLine>scons --clean platform=$(GodotPlatform) arch=$(Arch) target=$(GodotTemplate)</NMakeCleanCommandLine>
</PropertyGroup>

<PropertyGroup Condition="$(IsWindows)" Label="Configuration">
<NMakeBuildCommandLine>cmd /V /C set "PATH=$(PATH)" ^&amp; scons platform=$(GodotPlatform) arch=$(Arch) target=$(GodotTemplate) $(BuildType)</NMakeBuildCommandLine>
<NMakeReBuildCommandLine>cmd /V /C set "PATH=$(PATH)" ^&amp; scons --clean platform=$(GodotPlatform) arch=$(Arch) target=$(GodotTemplate) ^&amp; scons platform=$(GodotPlatform) arch=$(Arch) target=$(GodotTemplate)</NMakeReBuildCommandLine>
<NMakeCleanCommandLine>cmd /V /C set "PATH=$(PATH)" ^&amp; scons --clean platform=$(GodotPlatform) arch=$(Arch) target=$(GodotTemplate)</NMakeCleanCommandLine>
</PropertyGroup>

<Import Project="$(VCTargetsPath)/Microsoft.Cpp.props" Condition="$(IsWindows)"/>
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ItemGroup>
<None Include="src/**/*.h"/>
<None Include="src/**/*.cpp"/>
</ItemGroup>

<!-- Build/Rebuild/Clean targets for NMake are defined in MSVC, so we need to provide them, when using MSBuild without MSVC targets -->
<Import Project="$(MSBuildProjectDirectory)/.sln/targets/nmake.substitution.props" Condition="!Exists('$(VCTargetsPath)/Microsoft.Cpp.targets')" />
<Import Project="$(VCTargetsPath)/Microsoft.Cpp.targets" Condition="$(IsWindows)"/>
</Project>
2 changes: 1 addition & 1 deletion godot-cpp
Submodule godot-cpp updated 125 files
83 changes: 83 additions & 0 deletions godot-cpp-example.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.7.34221.43
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gdext", "gdext.vcxproj", "{9A2FB295-38D9-4994-9497-26FF91C85465}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|windows-x86_32 = Debug|windows-x86_32
Release|windows-x86_32 = Release|windows-x86_32
Debug|windows-x86_64 = Debug|windows-x86_64
Release|windows-x86_64 = Release|windows-x86_64

Debug|linux-x86_64 = Debug|linux-x86_64
Release|linux-x86_64 = Release|linux-x86_64
Debug|linux-arm64 = Debug|linux-arm64
Release|linux-arm64 = Release|linux-arm64
Debug|linux-rv64 = Debug|linux-rv64
Release|linux-rv64 = Release|linux-rv64

Debug|macos = Debug|macos
Release|macos = Release|macos

Debug|ios-arm64 = Debug|ios-arm64
Release|ios-arm64 = Release|ios-arm64

Debug|android-x86_64 = Debug|android-x86_64
Release|android-x86_64 = Release|android-x86_64
Debug|android-arm64 = Debug|android-arm64
Release|android-arm64 = Release|android-arm64

Debug|web-wasm32 = Debug|web-wasm32
Release|web-wasm32 = Release|web-wasm32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{9A2FB295-38D9-4994-9497-26FF91C85465}.Debug|windows-x86_32.ActiveCfg = Debug|Win32
{9A2FB295-38D9-4994-9497-26FF91C85465}.Debug|windows-x86_32.Build.0 = Debug|Win32
{9A2FB295-38D9-4994-9497-26FF91C85465}.Release|windows-x86_32.ActiveCfg = Release|Win32
{9A2FB295-38D9-4994-9497-26FF91C85465}.Release|windows-x86_32.Build.0 = Release|Win32
{9A2FB295-38D9-4994-9497-26FF91C85465}.Debug|windows-x86_64.ActiveCfg = Debug|x64
{9A2FB295-38D9-4994-9497-26FF91C85465}.Debug|windows-x86_64.Build.0 = Debug|x64
{9A2FB295-38D9-4994-9497-26FF91C85465}.Release|windows-x86_64.ActiveCfg = Release|x64
{9A2FB295-38D9-4994-9497-26FF91C85465}.Release|windows-x86_64.Build.0 = Release|x64
{9A2FB295-38D9-4994-9497-26FF91C85465}.Debug|linux-x86_64.ActiveCfg = Debug|linux-x86_64
{9A2FB295-38D9-4994-9497-26FF91C85465}.Debug|linux-x86_64.Build.0 = Debug|linux-x86_64
{9A2FB295-38D9-4994-9497-26FF91C85465}.Release|linux-x86_64.ActiveCfg = Release|linux-x86_64
{9A2FB295-38D9-4994-9497-26FF91C85465}.Release|linux-x86_64.Build.0 = Release|linux-x86_64
{9A2FB295-38D9-4994-9497-26FF91C85465}.Debug|linux-arm64.ActiveCfg = Debug|linux-arm64
{9A2FB295-38D9-4994-9497-26FF91C85465}.Debug|linux-arm64.Build.0 = Debug|linux-arm64
{9A2FB295-38D9-4994-9497-26FF91C85465}.Release|linux-arm64.ActiveCfg = Release|linux-arm64
{9A2FB295-38D9-4994-9497-26FF91C85465}.Release|linux-arm64.Build.0 = Release|linux-arm64
{9A2FB295-38D9-4994-9497-26FF91C85465}.Debug|linux-rv64.ActiveCfg = Debug|linux-rv64
{9A2FB295-38D9-4994-9497-26FF91C85465}.Debug|linux-rv64.Build.0 = Debug|linux-rv64
{9A2FB295-38D9-4994-9497-26FF91C85465}.Release|linux-rv64.ActiveCfg = Release|linux-rv64
{9A2FB295-38D9-4994-9497-26FF91C85465}.Release|linux-rv64.Build.0 = Release|linux-rv64
{9A2FB295-38D9-4994-9497-26FF91C85465}.Debug|macos.ActiveCfg = Debug|macos
{9A2FB295-38D9-4994-9497-26FF91C85465}.Debug|macos.Build.0 = Debug|macos
{9A2FB295-38D9-4994-9497-26FF91C85465}.Release|macos.ActiveCfg = Release|macos
{9A2FB295-38D9-4994-9497-26FF91C85465}.Release|macos.Build.0 = Release|macos
{9A2FB295-38D9-4994-9497-26FF91C85465}.Debug|ios-arm64.ActiveCfg = Debug|ios-arm64
{9A2FB295-38D9-4994-9497-26FF91C85465}.Debug|ios-arm64.Build.0 = Debug|ios-arm64
{9A2FB295-38D9-4994-9497-26FF91C85465}.Release|ios-arm64.ActiveCfg = Release|ios-arm64
{9A2FB295-38D9-4994-9497-26FF91C85465}.Release|ios-arm64.Build.0 = Release|ios-arm64
{9A2FB295-38D9-4994-9497-26FF91C85465}.Debug|android-x86_64.ActiveCfg = Debug|android-x86_64
{9A2FB295-38D9-4994-9497-26FF91C85465}.Debug|android-x86_64.Build.0 = Debug|android-x86_64
{9A2FB295-38D9-4994-9497-26FF91C85465}.Release|android-x86_64.ActiveCfg = Release|android-x86_64
{9A2FB295-38D9-4994-9497-26FF91C85465}.Release|android-x86_64.Build.0 = Release|android-x86_64
{9A2FB295-38D9-4994-9497-26FF91C85465}.Debug|android-arm64.ActiveCfg = Debug|android-arm64
{9A2FB295-38D9-4994-9497-26FF91C85465}.Debug|android-arm64.Build.0 = Debug|android-arm64
{9A2FB295-38D9-4994-9497-26FF91C85465}.Release|android-arm64.ActiveCfg = Release|android-arm64
{9A2FB295-38D9-4994-9497-26FF91C85465}.Release|android-arm64.Build.0 = Release|android-arm64
{9A2FB295-38D9-4994-9497-26FF91C85465}.Debug|web-wasm32.ActiveCfg = Debug|web-wasm32
{9A2FB295-38D9-4994-9497-26FF91C85465}.Debug|web-wasm32.Build.0 = Debug|web-wasm32
{9A2FB295-38D9-4994-9497-26FF91C85465}.Release|web-wasm32.ActiveCfg = Release|web-wasm32
{9A2FB295-38D9-4994-9497-26FF91C85465}.Release|web-wasm32.Build.0 = Release|web-wasm32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {75408944-4e38-4094-a91b-4730439ab8ee}
EndGlobalSection
EndGlobal