Merge branch 'GoaLitiuM-rider_cpp_project_launch'
This commit is contained in:
@@ -115,6 +115,7 @@ namespace Flax.Build.Projects.VisualStudio
|
||||
if (Version >= VisualStudioVersion.VisualStudio2022)
|
||||
vcProjectFileContent.AppendLine(" <ResolveNuGetPackages>false</ResolveNuGetPackages>");
|
||||
vcProjectFileContent.AppendLine(" <VCTargetsPath Condition=\"$(Configuration.Contains('Linux'))\">./</VCTargetsPath>");
|
||||
vcProjectFileContent.AppendLine(" <VCTargetsPath Condition=\"$(Configuration.Contains('Mac'))\">./</VCTargetsPath>");
|
||||
vcProjectFileContent.AppendLine(" </PropertyGroup>");
|
||||
|
||||
// Default properties
|
||||
@@ -377,9 +378,13 @@ namespace Flax.Build.Projects.VisualStudio
|
||||
|
||||
vcUserFileContent.AppendLine("</Project>");
|
||||
|
||||
if (platforms.Any(x => x.Target == TargetPlatform.Linux))
|
||||
if (platforms.Any(x => x.Target == TargetPlatform.Linux || x.Target == TargetPlatform.Mac))
|
||||
{
|
||||
// Override MSBuild .targets file with one that runs NMake commands (workaround for Rider on Linux)
|
||||
var editorPath = Utilities.NormalizePath(Path.Combine(Globals.EngineRoot, Platform.GetEditorBinaryDirectory(), "$(Configuration.Split('.')[2])", $"FlaxEditor{Utilities.GetPlatformExecutableExt()}")).Replace('\\', '/');
|
||||
var debuggerProjectPath = Globals.Project.Name == "Flax" ? "" : Globals.Project.ProjectFolderPath;
|
||||
var debuggerWorkingDirectory = Globals.Project.ProjectFolderPath;
|
||||
|
||||
// Override MSBuild .targets file with one that runs NMake commands (workaround for Rider not finding "Microsoft.Cpp.Default.props" file)
|
||||
var cppTargetsFileContent = new StringBuilder();
|
||||
cppTargetsFileContent.AppendLine("<Project xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\" TreatAsLocalProperty=\"Platform\">");
|
||||
cppTargetsFileContent.AppendLine(" <Target Name=\"Build\">");
|
||||
@@ -395,6 +400,12 @@ namespace Flax.Build.Projects.VisualStudio
|
||||
cppTargetsFileContent.AppendLine(" <TargetExt></TargetExt>");
|
||||
cppTargetsFileContent.AppendLine(" <TargetName>$(RootNamespace)$(Configuration.Split('.')[0])</TargetName>");
|
||||
cppTargetsFileContent.AppendLine(" <TargetPath>$(OutDir)/$(TargetName)$(TargetExt)</TargetPath>");
|
||||
if (!string.IsNullOrEmpty(debuggerProjectPath))
|
||||
cppTargetsFileContent.AppendLine(string.Format(" <LocalDebuggerCommandArguments>-project \"{0}\"</LocalDebuggerCommandArguments>", debuggerProjectPath));
|
||||
else
|
||||
cppTargetsFileContent.AppendLine(" <LocalDebuggerCommandArguments></LocalDebuggerCommandArguments>");
|
||||
cppTargetsFileContent.AppendLine(string.Format(" <LocalDebuggerCommand>{0}</LocalDebuggerCommand>", editorPath));
|
||||
cppTargetsFileContent.AppendLine(string.Format(" <LocalDebuggerWorkingDirectory>{0}</LocalDebuggerWorkingDirectory>", debuggerWorkingDirectory));
|
||||
cppTargetsFileContent.AppendLine(" </PropertyGroup>");
|
||||
cppTargetsFileContent.AppendLine("</Project>");
|
||||
|
||||
|
||||
@@ -633,6 +633,7 @@ namespace Flax.Build.Projects.VisualStudio
|
||||
var configuration = "$(FlaxConfiguration)";
|
||||
var editorPath = Utilities.NormalizePath(Path.Combine(Globals.EngineRoot, Platform.GetEditorBinaryDirectory(), configuration, $"FlaxEditor{Utilities.GetPlatformExecutableExt()}")).Replace('\\', '/');
|
||||
var workspacePath = Utilities.NormalizePath(solutionDirectory).Replace('\\', '/');
|
||||
var args = Globals.Project.Name == "Flax" ? "" : $"-project \\\"{workspacePath}\\\"";
|
||||
foreach (var project in projects)
|
||||
{
|
||||
if (project.Type == TargetType.DotNetCore)
|
||||
@@ -645,7 +646,7 @@ namespace Flax.Build.Projects.VisualStudio
|
||||
profile.AppendLine(" \"commandName\": \"Executable\",");
|
||||
profile.AppendLine($" \"workingDirectory\": \"{workspacePath}\",");
|
||||
profile.AppendLine($" \"executablePath\": \"{editorPath}\",");
|
||||
profile.AppendLine($" \"commandLineArgs\": \"-project \\\"{workspacePath}\\\"\",");
|
||||
profile.AppendLine($" \"commandLineArgs\": \"{args}\",");
|
||||
profile.AppendLine(" \"nativeDebugging\": false");
|
||||
profile.Append(" }");
|
||||
if (profiles.ContainsKey(path))
|
||||
|
||||
Reference in New Issue
Block a user