Skip to content

Rider IDE project model support #248

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 37 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
6849d31
Add rider project model generator
SmelJey Jul 26, 2021
3a4f3b4
Add Rider Json documentation
SmelJey Jul 27, 2021
05296e4
Change Rider-related files naming
SmelJey Jul 28, 2021
6cd9476
[RiderJson] Change root.json file format: add solution configuration …
SmelJey Jul 29, 2021
7b95ba4
[RiderJson] Add solution name specifier for RiderJson generator
SmelJey Jul 29, 2021
06e0948
[RiderJson] Change EnvironmentDefinitions source to IPlatformVcxproj.…
SmelJey Jul 30, 2021
8f141dc
[RiderJson] Add sample for RiderJson, add output directory specifier.
SmelJey Aug 2, 2021
da41113
[RiderJson] Extract build commands from toolchain to separate object.…
SmelJey Aug 9, 2021
1bd69a5
[RiderJson] Add PrivateDependencyModules, SourceRoot and SourceExtens…
SmelJey Aug 9, 2021
da92139
[RiderJson] Change RiderJson solution file extension, extract solutio…
SmelJey Aug 16, 2021
34c4741
[RiderJson] Resolve $(ProjectDir) variable in build commands, add mis…
SmelJey Aug 17, 2021
77fb6dd
[RiderJson] Add "TargetPath" to configuration json for fastbuild, ren…
SmelJey Aug 19, 2021
3f994fc
[RiderJson] Fix incorrect IntermediateDirectory and OutputDirectory o…
SmelJey Aug 20, 2021
4440a0e
[RiderJson] Add $(ProjectDir) and $(SolutionName) resolving in fastbu…
SmelJey Aug 20, 2021
f8d828f
[RiderJson] Add Architecture field to ToolchainInfo.
SmelJey Aug 23, 2021
8fb09f6
[RiderJson] Make RiderJson generation accessible via command line arg…
SmelJey Oct 13, 2021
9207f62
[RiderJson] Add rdjson files to output log
SmelJey Oct 19, 2021
fdc6245
[RiderJson] Fix projects dependencies calculating (at the same way as…
SmelJey Oct 22, 2021
bbb91c8
[RiderJson] Add msbuild commands to output json
SmelJey Oct 25, 2021
2615444
[RiderJson] Fix invalid ProjectDirectory in RiderGenerationContext
SmelJey Oct 26, 2021
288e87c
[RiderJson] Fix clean command for FastBuild
SmelJey Oct 26, 2021
6d26fb4
[RiderJson] Add SolutionFolder to RdJson output
SmelJey Oct 27, 2021
188eda4
[RiderJson] Fix rdjson generation for non-generate projects
SmelJey Nov 3, 2021
3d6cff3
[RiderJson] Fix defines, change Compiler option
SmelJey Nov 10, 2021
e7d4954
[RiderJson] Make distinguishable [Generate] and other projects.
SmelJey Nov 10, 2021
20d92c3
[RiderJson] Update RdJson format (source files and output type)
SmelJey Nov 10, 2021
97f13c8
[RiderJson] Fix clang compiler detection
SmelJey Nov 11, 2021
570a552
[RiderJson] Add RiderJson generation params as command line args
SmelJey Nov 15, 2021
5f0afbe
[RiderJson] Add source regexes and filters info to the output
SmelJey Nov 29, 2021
4828c38
[RiderJson] Rename OutputType
SmelJey Apr 17, 2022
dae5772
[RiderJson] Fix start arguments in RiderJsonProject
SmelJey Apr 17, 2022
d9154ad
[RiderJson] Fix RiderJson generation when there are non-cpp projects
SmelJey Jun 27, 2022
1e19ea1
Extract FastBuild build arguments to FastBuildMakeCommandGenerator
SmelJey Jun 29, 2022
1e7d149
[RiderJson] Fix system include paths for win32
SmelJey Sep 16, 2022
62991c0
[RiderJson] Move RiderJson classes to separate folder
SmelJey Jan 26, 2023
747f63e
Add C++20 flag
DecoyRS Jan 31, 2023
ed90d61
[RiderJson] Add DevEnv value for Rider and cleanup
SmelJey Mar 9, 2023
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
1 change: 1 addition & 0 deletions Sharpmake.Application/CommandLineArguments.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.IO;
using System.Runtime.Serialization;
using System.Text.RegularExpressions;
using Sharpmake.Generators.Rider;

namespace Sharpmake.Application
{
Expand Down
1 change: 1 addition & 0 deletions Sharpmake.Application/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using System.Threading;
using System.Threading.Tasks;
using Sharpmake.Generators;
using Sharpmake.Generators.Rider;
using Sharpmake.Generators.VisualStudio;

namespace Sharpmake.Application
Expand Down
5 changes: 5 additions & 0 deletions Sharpmake.Application/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@
"commandLineArgs": "/sources(@\u0027QTFileCustomBuild.sharpmake.cs\u0027)",
"workingDirectory": "$(ProjectDir)\\..\\samples\\QTFileCustomBuild"
},
"Sample (RiderJson)": {
"commandName": "Project",
"commandLineArgs": "/sources(@\u0027RiderJson.sharpmake.cs\u0027)",
"workingDirectory": "$(ProjectDir)\\..\\samples\\RiderJson"
},
"Sample (SimpleExeLibDependency)": {
"commandName": "Project",
"commandLineArgs": "/sources(@\u0027SimpleExeLibDependency.sharpmake.cs\u0027)",
Expand Down
20 changes: 20 additions & 0 deletions Sharpmake.Generators/GeneratorManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Sharpmake.Generators.Apple;
using Sharpmake.Generators.FastBuild;
using Sharpmake.Generators.Generic;
using Sharpmake.Generators.Rider;
using Sharpmake.Generators.VisualStudio;

namespace Sharpmake.Generators
Expand All @@ -25,6 +26,9 @@ public class GeneratorManager : IGeneratorManager
private MakeApplication _makeApplicationGenerator = null;
public MakeApplication MakeApplicationGenerator => _makeApplicationGenerator ?? (_makeApplicationGenerator = new MakeApplication());

public RiderJson _riderJsonGenerator = null;
public RiderJson RiderJsonGenerator => _riderJsonGenerator ?? (_riderJsonGenerator = new RiderJson());

// Project generators
private CSproj _csprojGenerator = null;
public CSproj CsprojGenerator => _csprojGenerator ?? (_csprojGenerator = new CSproj());
Expand Down Expand Up @@ -104,6 +108,11 @@ public void Generate(Builder builder,
BffGenerator.Generate(builder, project, configurations, projectFile, generatedFiles, skipFiles);
break;
}
case DevEnv.rider:
{
BffGenerator.Generate(builder, project, configurations, projectFile, generatedFiles, skipFiles);
break;
}
default:
{
throw new Error("Generate called with unknown DevEnv: " + devEnv);
Expand Down Expand Up @@ -158,6 +167,17 @@ public void Generate(Builder builder,
SlnGenerator.Generate(builder, solution, configurations, solutionFile, generatedFiles, skipFiles);
break;
}
case DevEnv.rider:
{
if (UtilityMethods.HasFastBuildConfig(configurations))
{
var masterBff = new MasterBff();
masterBff.Generate(builder, solution, configurations, solutionFile, generatedFiles, skipFiles);
}

RiderJsonGenerator.Generate(builder, solution, configurations, solutionFile, generatedFiles, skipFiles);
break;
}
default:
{
throw new Error("Generate called with unknown DevEnv: " + devEnv);
Expand Down
57 changes: 57 additions & 0 deletions Sharpmake.Generators/Generic/RiderJson.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
## Introduction

Rider Json has project files of 2 levels:
+ ```root.json``` - "solution"-wide file which contains information about all projects
and their configurations;
+ ```<project>_<platform>_<configuration>.json``` - contains information about single configuration of the project.

The following is the mapping of Sharpmake properties to Rider Json.

## Relations between Sharpmake and Rider Json properties
### Solution
| Sharpmake | Rider Json |
| --------- | ---------- |
| ``Solution.Configuration.IncludedProjectInfo.Configuration`` | ``ProjectConfig`` |
| ``Solution.Configuration`` | ``SolutionConfig`` |
| ``Solution.Configuration.IncludedProjectInfo.ToBuild`` | ``DoBuild`` |

### Project
| Sharpmake | Rider Json |
| --------- | ---------- |
| ``Project.Configuration.ProjectName`` | ``Name`` |
| ``Project.Configuration.Name`` | ``Configuration`` |
| ``Configuration.Platform`` | ``Platform`` |
| ``IPlatformVcxproj.GetPlatformIncludePaths()`` | ``EnvironmentIncludePaths`` |
| ``IPlatformVcxproj.GetImplicitlyDefinedSymbols()`` | ``EnvironmentDefinitions`` |
| ``Project.Configuration.ResolvedDependencies`` | ``Modules`` |

### Toolchain Info
| Sharpmake | Rider Json |
| --------- | ---------- |
| ``Options.<DevEnv>.Compiler.CppLanguageStandard``| ``ToolchainInfo.CppStandart`` |
| ``Options.<DevEnv>.Compiler.RTTI`` | ``ToolchainInfo.RTTI`` |
| ``Options.<DevEnv>.Compiler.Exceptions`` | ``ToolchainInfo.bUseExceptions`` |
| ``Project.Configuration.OutputType`` | ``ToolchainInfo.bIsBuildingLibrary`` <br/> ``ToolchainInfo.bIsBuildingDll``|
| ``Options.<DevEnv>.Compiler.Optimization`` | ``ToolchainInfo.bOptimizeCode`` |
| ``Options.Vc.Compiler.Inline`` | ``ToolchainInfo.bUseInlining`` |
| ``Project.Configuration.IsBlobbed`` <br/> ``Project.Configuration.FastBuildBlobbed`` | ``ToolchainInfo.bUseUnity`` |
| ``Options.Vc.General.DebugInformation`` <br/> ``Options.<Makefile / Clang>.Compiler.GenerateDebugInformation`` <br/> ``Options.XCode.Compiler.GenerateDebuggingSymbols`` <br/> ``Options.Android.Compiler.DebugInformationFormat`` | ``ToolchainInfo.bCreateDebugInfo`` |
| ``Options.Vc.Compiler.EnhancedInstructionSet`` | ``ToolchainInfo.bUseAVX`` |
| ``Configuration.Compiler`` | ``ToolchainInfo.Compiler`` |
| ``Options.Vc.Compiler.ConformanceMode`` | ``ToolchainInfo.bStrictConformanceMode`` |
| ``Options.Vc.SourceFile.PrecompiledHeader`` <br/> ``IPlatformVcxproj.HasPrecomp()`` | ``ToolchainInfo.PrecompiledHeaderAction`` |
| ``FastBuildMakeCommandGenerator.GetCommand()`` | ``ToolchainInfo.BuildCmd`` <br/> ``ToolchainInfo.ReBuildCmd`` <br/> ``ToolchainInfo.CleanCmd`` |

### Modules info
| Sharpmake | Rider Json |
| --------- | ---------- |
| ``Project.SourceRootPath`` | ``SourcePath`` |
| ``Project.SourceFilesExtensions`` | ``SourceExtensions`` |
| ``Project.Configuration.ResolvedPublicDependencies`` | ``PublicDependencyModules`` |
| ``Project.Configuration.ResolvedPrivateDependencies`` | ``PrivateDependencyModules`` |
| ``Project.Configuration.IncludePaths`` | ``PublicIncludePaths`` |
| ``Project.Configuration.IncludePrivatePaths`` | ``PrivateIncludePaths`` |
| ``Project.Configuration.ExportDefines`` | ``PublicDefinitions`` |
| ``Project.Configuration.Defines`` | ``PrivateDefinitions`` |


32 changes: 32 additions & 0 deletions Sharpmake.Generators/Rider/RiderJson.Template.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright (c) Ubisoft. All Rights Reserved.
// Licensed under the Apache 2.0 License. See LICENSE.md in the project root for license information.

namespace Sharpmake.Generators.Rider
{
public partial class RiderJson
{

// See Sharpmake.BasePlatform.GenerateProjectConfigurationFastBuildMakeFile()
public static class Template
{
public static string FastBuildBuildCommand = @"cd [SolutionDir]
[BeforeBuildCommand]
[BuildCommand]";

public static string FastBuildCleanCommand = @"del ""[IntermediateDirectory]\*unity*.cpp"" >NUL 2>NUL
del ""[IntermediateDirectory]\*.obj"" >NUL 2>NUL
del ""[IntermediateDirectory]\*.a"" >NUL 2>NUL
del ""[IntermediateDirectory]\*.lib"" >NUL 2>NUL
del ""[IntermediateDirectory]\*.pch"" >NUL 2>NUL
del ""[IntermediateDirectory]\*.pdb"" >NUL 2>NUL
del ""[OutputDirectory]\[TargetFileFullName].exe"" >NUL 2>NUL
del ""[OutputDirectory]\[TargetFileFullName].elf"" >NUL 2>NUL
del ""[OutputDirectory]\[TargetFileFullName].exp"" >NUL 2>NUL
del ""[OutputDirectory]\[TargetFileFullName].ilk"" >NUL 2>NUL
del ""[OutputDirectory]\[TargetFileFullName].lib"" >NUL 2>NUL
del ""[OutputDirectory]\[TargetFileFullName].pdb"" >NUL 2>NUL";

public static string MsBuildBuildCommand = @"$(MsBuildPath) ""[ProjectFile]"" -t:[Command] -p:Configuration=""[ConfigurationName]"" -p:Platform=""[PlatformName]""";
}
}
}
Loading