/// <summary> /// Selects which platforms and build configurations we want in the project file /// </summary> /// <param name="IncludeAllPlatforms">True if we should include ALL platforms that are supported on this machine. Otherwise, only desktop platforms will be included.</param> /// <param name="SupportedPlatformNames">Output string for supported platforms, returned as comma-separated values.</param> protected override void SetupSupportedPlatformsAndConfigurations(bool IncludeAllPlatforms, out string SupportedPlatformNames) { // Call parent implementation to figure out the actual platforms base.SetupSupportedPlatformsAndConfigurations(IncludeAllPlatforms, out SupportedPlatformNames); // If we have a non-default setting for visual studio, check the compiler exists. If not, revert to the default. if (ProjectFileFormat == VCProjectFileFormat.VisualStudio2015) { if (!WindowsPlatform.HasCompiler(WindowsCompiler.VisualStudio2015_DEPRECATED)) { Log.TraceWarning("Visual Studio C++ 2015 installation not found - ignoring preferred project file format."); ProjectFileFormat = VCProjectFileFormat.Default; } } else if (ProjectFileFormat == VCProjectFileFormat.VisualStudio2017) { if (!WindowsPlatform.HasCompiler(WindowsCompiler.VisualStudio2017)) { Log.TraceWarning("Visual Studio C++ 2017 installation not found - ignoring preferred project file format."); ProjectFileFormat = VCProjectFileFormat.Default; } } else if (ProjectFileFormat == VCProjectFileFormat.VisualStudio2019) { if (!WindowsPlatform.HasCompiler(WindowsCompiler.VisualStudio2019)) { Log.TraceWarning("Visual Studio C++ 2019 installation not found - ignoring preferred project file format."); ProjectFileFormat = VCProjectFileFormat.Default; } } // Certain platforms override the project file format because their debugger add-ins may not yet support the latest // version of Visual Studio. This is their chance to override that. // ...but only if the user didn't override this via the command-line. if (ProjectFileFormat == VCProjectFileFormat.Default) { // Pick the best platform installed by default if (WindowsPlatform.HasCompiler(WindowsCompiler.VisualStudio2017) && WindowsPlatform.HasIDE(WindowsCompiler.VisualStudio2017)) { ProjectFileFormat = VCProjectFileFormat.VisualStudio2017; } else if (WindowsPlatform.HasCompiler(WindowsCompiler.VisualStudio2015_DEPRECATED) && WindowsPlatform.HasIDE(WindowsCompiler.VisualStudio2015_DEPRECATED)) { ProjectFileFormat = VCProjectFileFormat.VisualStudio2015; } else if (WindowsPlatform.HasCompiler(WindowsCompiler.VisualStudio2019) && WindowsPlatform.HasIDE(WindowsCompiler.VisualStudio2019)) { ProjectFileFormat = VCProjectFileFormat.VisualStudio2019; } // Allow the SDKs to override foreach (UnrealTargetPlatform SupportedPlatform in SupportedPlatforms) { UEBuildPlatform BuildPlatform = UEBuildPlatform.GetBuildPlatform(SupportedPlatform, true); if (BuildPlatform != null) { // Don't worry about platforms that we're missing SDKs for if (BuildPlatform.HasRequiredSDKsInstalled() == SDKStatus.Valid) { VCProjectFileFormat ProposedFormat = BuildPlatform.GetRequiredVisualStudioVersion(); if (ProposedFormat != VCProjectFileFormat.Default) { // Reduce the Visual Studio version to the max supported by each platform we plan to include. if (ProjectFileFormat == VCProjectFileFormat.Default || ProposedFormat < ProjectFileFormat) { ProjectFileFormat = ProposedFormat; } } } } } } }