Skip to content

Commit 372bab6

Browse files
committed
fixes
1 parent 4b48664 commit 372bab6

File tree

5 files changed

+232
-291
lines changed

5 files changed

+232
-291
lines changed

.sln/readme.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# JetBrains Rider C++ support files (.sln folder)
2+
3+
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.
4+
5+
- godot-cpp-example.sln
6+
- Solution that groups the C++ projects and lists all Configuration|Platform pairs shown in the Solution Configuration selector.
7+
8+
- gdext.vcxproj
9+
- GDExtension C++ project. Rider reads compiler options/defines/includes and also calls scons to build the extension library (.dll/.so/.dylib).
10+
11+
- targets/JetBrains.Rider.Cpp.targets (for non-Windows)
12+
- MSBuild target that resolves C++ standard library headers.
13+
14+
- targets/nmake.substitution.props (for non-Windows)
15+
- Substitutes Build/Rebuild/Clean targets.
16+
- Reference: [godot/misc/msvs/nmake.substitution.props](https://github.com/godotengine/godot/blob/master/misc/msvs/nmake.substitution.props)
17+
18+
19+
Sln to vcxproj relation:
20+
- The .sln file lists all Configuration|Platform pairs in SolutionConfigurationPlatforms (e.g., Debug|linux-x86_64).
21+
- The same pairs are mapped to the gdext project in ProjectConfigurationPlatforms, so the project gets the exact Configuration and Platform selected in the IDE.
22+
- In gdext.vcxproj, $(Configuration) toggles Debug/Release props, while $(Platform) is matched by Condition blocks to set GodotPlatform and Arch.
23+
- Those values feed the NMake commands, which call scons with platform=$(GodotPlatform) arch=$(Arch) target=$(GodotTemplate).
24+
- Result: choosing a Solution configuration in Rider/VS selects the matching vcxproj config and builds the right target for your OS/arch.
25+
- sln and vcxproj are meant to be manually edited in Rider.
26+
27+
Notes:
28+
- Full `godot-cpp-template` folder can be linked by context menu of the solution root (Add | Existing folder)
29+
- 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.
30+
- 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.
Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<!-- do not rename this target, Rider calls it on the properties evaluation -->
3+
<Target Name="ResolveFrameworkReferences" Condition="'$(DesignTimeBuild)' == 'true'">
4+
<Message Text="Resolving toolchain..." Importance="High"/>
25

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

12-
<PropertyGroup>
13-
<NMakeIncludeSearchPath>$(ClangIncludeDirs)$(NMakeIncludeSearchPath)</NMakeIncludeSearchPath>
14-
</PropertyGroup>
11+
<PropertyGroup>
12+
<NMakeIncludeSearchPath>$(ClangIncludeDirs);$(NMakeIncludeSearchPath)</NMakeIncludeSearchPath>
13+
</PropertyGroup>
1514

16-
<Message Text="NMakeIncludeSearchPath: $(NMakeIncludeSearchPath)"/>
17-
</Target>
15+
<Message Text="NMakeIncludeSearchPath: $(NMakeIncludeSearchPath)"/>
16+
</Target>
1817

1918
</Project>
Lines changed: 25 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,28 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<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-
<!-- Reflects what Platform.Common.props does. -->
27-
<Link Condition="'$(Arch)' == 'arm64'">
28-
<TargetMachine>MachineARM64</TargetMachine>
29-
</Link>
30-
<Link Condition="'$(Arch)' == 'x86_64'">
31-
<TargetMachine>MachineX64</TargetMachine>
32-
</Link>
33-
<Link Condition="'$(Arch)' == 'x86_32'">
34-
<TargetMachine>MachineX86</TargetMachine>
35-
</Link>
36-
</ItemDefinitionGroup>
3+
<!-- Build/Rebuild/Clean targets for NMake are defined in MSVC, so we need to provide them, when using MSBuild without MSVC targets -->
4+
<Target Name="Build">
5+
<Exec Command="$(NMakeBuildCommandLine)"
6+
WorkingDirectory="$(NMakeWorkingDirectory)"/>
7+
</Target>
8+
<Target Name="Rebuild">
9+
<Exec Command="$(NMakeReBuildCommandLine)"
10+
WorkingDirectory="$(NMakeWorkingDirectory)"/>
11+
</Target>
12+
<Target Name="Clean">
13+
<Exec Command="$(NMakeCleanCommandLine)"
14+
WorkingDirectory="$(NMakeWorkingDirectory)"/>
15+
</Target>
16+
<ItemDefinitionGroup>
17+
<!-- Reflects what Platform.Common.props does. -->
18+
<Link Condition="'$(Arch)' == 'arm64'">
19+
<TargetMachine>MachineARM64</TargetMachine>
20+
</Link>
21+
<Link Condition="'$(Arch)' == 'x86_64'">
22+
<TargetMachine>MachineX64</TargetMachine>
23+
</Link>
24+
<Link Condition="'$(Arch)' == 'x86_32'">
25+
<TargetMachine>MachineX86</TargetMachine>
26+
</Link>
27+
</ItemDefinitionGroup>
3728
</Project>

0 commit comments

Comments
 (0)