Merge branch 'fix_csharp_proj_sdk' of https://github.com/GoaLitiuM/FlaxEngine into GoaLitiuM-fix_csharp_proj_sdk

This commit is contained in:
Wojtek Figat
2025-04-13 20:26:38 +02:00

View File

@@ -121,17 +121,28 @@ namespace Flax.Build
string configurationName = configuration.ToString(); string configurationName = configuration.ToString();
foreach (var architecture in target.GetArchitectures(targetPlatform)) foreach (var architecture in target.GetArchitectures(targetPlatform))
{ {
string configurationText = targetName + '.' + platformName + '.' + configurationName;
if (!Platform.IsPlatformSupported(targetPlatform, architecture)) if (!Platform.IsPlatformSupported(targetPlatform, architecture))
continue; continue;
var platform = Platform.GetPlatform(targetPlatform, true); var platform = Platform.GetPlatform(targetPlatform, true);
if (platform == null) if (platform == null)
continue; continue;
if (!platform.HasRequiredSDKsInstalled && (!projectInfo.IsCSharpOnlyProject || platform != Platform.BuildPlatform)) if (!platform.HasRequiredSDKsInstalled && (!projectInfo.IsCSharpOnlyProject || platform != Platform.BuildPlatform))
{
Log.Verbose($"Skipping configuration {configurationText} for {architecture}: Missing platform SDK");
continue; continue;
if (!platform.CanBuildArchitecture(architecture)) }
if (!projectInfo.IsCSharpOnlyProject && !platform.CanBuildArchitecture(architecture))
{
Log.Verbose($"Skipping configuration {configurationText} for {architecture}: Unsupported target architecture");
continue; continue;
}
if (projectInfo.IsCSharpOnlyProject && !Platform.IsPlatformSupported(platform.Target, architecture))
{
Log.Verbose($"Skipping configuration {configurationText} for {architecture}: Unsupported target architecture");
continue;
}
string configurationText = targetName + '.' + platformName + '.' + configurationName;
string architectureName = architecture.ToString(); string architectureName = architecture.ToString();
if (platform is IProjectCustomizer customizer) if (platform is IProjectCustomizer customizer)
customizer.GetProjectArchitectureName(project, platform, architecture, ref architectureName); customizer.GetProjectArchitectureName(project, platform, architecture, ref architectureName);
@@ -255,6 +266,7 @@ namespace Flax.Build
if (targetGroup.Project == null && target is ProjectTarget projectTarget) if (targetGroup.Project == null && target is ProjectTarget projectTarget)
targetGroup.Project = projectTarget.Project; targetGroup.Project = projectTarget.Project;
targetGroup.Targets.Add(target); targetGroup.Targets.Add(target);
Log.Verbose($"Found target {target}");
} }
foreach (var targetGroup in targetGroups) foreach (var targetGroup in targetGroups)
{ {
@@ -283,6 +295,7 @@ namespace Flax.Build
var projectInfo = e.Project; var projectInfo = e.Project;
// Create project // Create project
Log.Verbose($"Found project {projectName}");
Project mainProject; Project mainProject;
var binaryModules = new Dictionary<string, HashSet<Module>>(); var binaryModules = new Dictionary<string, HashSet<Module>>();
var modulesBuildOptions = new Dictionary<Module, BuildOptions>(); var modulesBuildOptions = new Dictionary<Module, BuildOptions>();
@@ -390,11 +403,17 @@ namespace Flax.Build
// Skip bindings projects for prebuilt targets (eg. no sources to build/view - just binaries) // Skip bindings projects for prebuilt targets (eg. no sources to build/view - just binaries)
if (targets[0].IsPreBuilt) if (targets[0].IsPreBuilt)
{
Log.Verbose($"Skipping prebuilt module {binaryModuleName}");
continue; continue;
}
// Skip if project of that name has been already added // Skip if project of that name has been already added
if (projects.Any(x => x.OutputType == TargetOutputType.Library && x.Type == TargetType.DotNetCore && x.BaseName == binaryModuleName)) if (projects.Any(x => x.OutputType == TargetOutputType.Library && x.Type == TargetType.DotNetCore && x.BaseName == binaryModuleName))
{
Log.Verbose($"Skipping already added module {binaryModuleName}");
continue; continue;
}
using (new ProfileEventScope(binaryModuleName)) using (new ProfileEventScope(binaryModuleName))
{ {
@@ -543,6 +562,7 @@ namespace Flax.Build
} }
if (flaxDependencyToRemove != null) if (flaxDependencyToRemove != null)
{ {
Log.Verbose($"Removing project reference {flaxDependencyToRemove.Name}");
projects.Remove(flaxDependencyToRemove); projects.Remove(flaxDependencyToRemove);
foreach (var project in projects) foreach (var project in projects)
project.Dependencies.Remove(flaxDependencyToRemove); project.Dependencies.Remove(flaxDependencyToRemove);
@@ -558,7 +578,7 @@ namespace Flax.Build
{ {
foreach (var project in projects) foreach (var project in projects)
{ {
Log.Verbose(project.Name + " -> " + project.Path); Log.Verbose($"Project {project.Name} -> {project.Path}");
project.Generate(solutionPath, project == mainSolutionProject); project.Generate(solutionPath, project == mainSolutionProject);
} }
} }
@@ -637,7 +657,7 @@ namespace Flax.Build
// Generate project // Generate project
using (new ProfileEventScope("GenerateProject")) using (new ProfileEventScope("GenerateProject"))
{ {
Log.Verbose("Project " + rulesProjectName + " -> " + project.Path); Log.Verbose($"Project {rulesProjectName} -> {project.Path}");
dotNetProjectGenerator.GenerateProject(project, solutionPath, project == mainSolutionProject); dotNetProjectGenerator.GenerateProject(project, solutionPath, project == mainSolutionProject);
} }