Beispiel #1
0
        /// <summary>
        /// Executes the tool with the given arguments
        /// </summary>
        /// <param name="Arguments">Command line arguments</param>
        /// <returns>Exit code</returns>
        public override int Execute(CommandLineArguments Arguments)
        {
            // Output a message if there are any arguments that are still unused
            Arguments.ApplyTo(this);
            Arguments.CheckAllArgumentsUsed();

            // If the -AllPlatforms argument is specified, add all the known platforms into the list
            if (bAllPlatforms)
            {
                Platforms.UnionWith(UnrealTargetPlatform.GetValidPlatforms());
            }

            // Output a line for each registered platform
            foreach (UnrealTargetPlatform Platform in Platforms)
            {
                UEBuildPlatform BuildPlatform = UEBuildPlatform.GetBuildPlatform(Platform, true);
                if (BuildPlatform != null && BuildPlatform.HasRequiredSDKsInstalled() == SDKStatus.Valid)
                {
                    Log.TraceInformation("##PlatformValidate: {0} VALID", Platform.ToString());
                }
                else
                {
                    Log.TraceInformation("##PlatformValidate: {0} INVALID", Platform.ToString());
                }
            }
            return(0);
        }
        /// <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;
                                }
                            }
                        }
                    }
                }
            }
        }
Beispiel #3
0
        /// <summary>
        /// Register the given platforms UEBuildPlatform instance
        /// </summary>
        /// <param name="InBuildPlatform"> The UEBuildPlatform instance to use for the InPlatform</param>
        public static void RegisterBuildPlatform(UEBuildPlatform InBuildPlatform)
        {
            Log.TraceVerbose("        Registering build platform: {0} - buildable: {1}", InBuildPlatform.Platform, InBuildPlatform.HasRequiredSDKsInstalled() == SDKStatus.Valid);

            if (BuildPlatformDictionary.ContainsKey(InBuildPlatform.Platform) == true)
            {
                Log.TraceWarning("RegisterBuildPlatform Warning: Registering build platform {0} for {1} when it is already set to {2}",
                                 InBuildPlatform.ToString(), InBuildPlatform.Platform.ToString(), BuildPlatformDictionary[InBuildPlatform.Platform].ToString());
                BuildPlatformDictionary[InBuildPlatform.Platform] = InBuildPlatform;
            }
            else
            {
                BuildPlatformDictionary.Add(InBuildPlatform.Platform, InBuildPlatform);
            }
        }