Merge branch 'rider_vcpp_fix' of https://github.com/GoaLitiuM/FlaxEngine into GoaLitiuM-rider_vcpp_fix
This commit is contained in:
@@ -36,7 +36,7 @@ namespace
|
||||
// Load product info
|
||||
Array<byte> productInfoData;
|
||||
const String productInfoPath = directory / TEXT("product-info.json");
|
||||
if (File::ReadAllBytes(productInfoPath, productInfoData))
|
||||
if (!FileSystem::FileExists(productInfoPath) || File::ReadAllBytes(productInfoPath, productInfoData))
|
||||
return;
|
||||
rapidjson_flax::Document document;
|
||||
document.Parse((char*)productInfoData.Get(), productInfoData.Count());
|
||||
@@ -193,6 +193,7 @@ void RiderCodeEditor::FindEditors(Array<CodeEditor*>* output)
|
||||
// TODO: detect Snap installations
|
||||
// TODO: detect by reading the jetbrains-rider.desktop file from ~/.local/share/applications and /usr/share/applications?
|
||||
|
||||
SearchDirectory(&installations, TEXT("/usr/share/rider/"));
|
||||
FileSystem::GetChildDirectories(subDirectories, TEXT("/usr/share/rider"));
|
||||
|
||||
// Default suggested location for standalone installations
|
||||
|
||||
@@ -105,8 +105,9 @@ namespace Flax.Build.Projects.VisualStudio
|
||||
vcProjectFileContent.AppendLine(" <Keyword>MakeFileProj</Keyword>");
|
||||
if (Version >= VisualStudioVersion.VisualStudio2022)
|
||||
vcProjectFileContent.AppendLine(" <ResolveNuGetPackages>false</ResolveNuGetPackages>");
|
||||
vcProjectFileContent.AppendLine(" <VCTargetsPath Condition=\"$(Configuration.Contains('Linux'))\">./</VCTargetsPath>");
|
||||
vcProjectFileContent.AppendLine(" </PropertyGroup>");
|
||||
|
||||
|
||||
// Default properties
|
||||
vcProjectFileContent.AppendLine(" <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />");
|
||||
|
||||
@@ -343,6 +344,32 @@ namespace Flax.Build.Projects.VisualStudio
|
||||
|
||||
vcUserFileContent.AppendLine("</Project>");
|
||||
|
||||
if (platforms.Any(x => x.Target == TargetPlatform.Linux))
|
||||
{
|
||||
// Override MSBuild .targets file with one that runs NMake commands (workaround for Rider on Linux)
|
||||
var cppTargetsFileContent = new StringBuilder();
|
||||
cppTargetsFileContent.AppendLine("<Project xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\" TreatAsLocalProperty=\"Platform\">");
|
||||
cppTargetsFileContent.AppendLine(" <Target Name=\"Build\">");
|
||||
cppTargetsFileContent.AppendLine(" <Exec Command='$(NMakeBuildCommandLine)'/>");
|
||||
cppTargetsFileContent.AppendLine(" </Target>");
|
||||
cppTargetsFileContent.AppendLine(" <Target Name=\"Rebuild\">");
|
||||
cppTargetsFileContent.AppendLine(" <Exec Command='$(NMakeReBuildCommandLine)'/>");
|
||||
cppTargetsFileContent.AppendLine(" </Target>");
|
||||
cppTargetsFileContent.AppendLine(" <Target Name=\"Clean\">");
|
||||
cppTargetsFileContent.AppendLine(" <Exec Command='$(NMakeCleanCommandLine)'/>");
|
||||
cppTargetsFileContent.AppendLine(" </Target>");
|
||||
cppTargetsFileContent.AppendLine(" <PropertyGroup>");
|
||||
cppTargetsFileContent.AppendLine(" <TargetExt></TargetExt>");
|
||||
cppTargetsFileContent.AppendLine(" <TargetName>$(RootNamespace)$(Configuration.Split('.')[0])</TargetName>");
|
||||
cppTargetsFileContent.AppendLine(" <TargetPath>$(OutDir)/$(TargetName)$(TargetExt)</TargetPath>");
|
||||
cppTargetsFileContent.AppendLine(" </PropertyGroup>");
|
||||
cppTargetsFileContent.AppendLine("</Project>");
|
||||
|
||||
Utilities.WriteFileIfChanged(Path.Combine(projectDirectory, "Microsoft.Cpp.targets"), cppTargetsFileContent.ToString());
|
||||
Utilities.WriteFileIfChanged(Path.Combine(projectDirectory, "Microsoft.Cpp.Default.props"), vcUserFileContent.ToString());
|
||||
Utilities.WriteFileIfChanged(Path.Combine(projectDirectory, "Microsoft.Cpp.props"), vcUserFileContent.ToString());
|
||||
}
|
||||
|
||||
// Save the files
|
||||
Utilities.WriteFileIfChanged(project.Path, vcProjectFileContent.ToString());
|
||||
Utilities.WriteFileIfChanged(project.Path + ".filters", vcFiltersFileContent.ToString());
|
||||
|
||||
Reference in New Issue
Block a user