Пример #1
0
        /// <summary>
        /// Register the platform with the UEBuildPlatform class
        /// </summary>
        protected override void RegisterBuildPlatforms(SDKOutputLevel OutputLevel)
        {
            LinuxPlatformSDK SDK = new LinuxPlatformSDK();

            SDK.ManageAndValidateSDK(OutputLevel);

            if ((ProjectFileGenerator.bGenerateProjectFiles == true) || (SDK.HasRequiredSDKsInstalled() == SDKStatus.Valid))
            {
                FileReference LinuxTargetPlatformFile = FileReference.Combine(UnrealBuildTool.EngineSourceDirectory, "Developer", "Linux", "LinuxTargetPlatform", "LinuxTargetPlatform.Build.cs");
                if (FileReference.Exists(LinuxTargetPlatformFile))
                {
                    // Register this build platform for Linux
                    Log.TraceVerbose("        Registering for {0}", UnrealTargetPlatform.Linux.ToString());
                    UEBuildPlatform.RegisterBuildPlatform(new LinuxPlatform(SDK));
                    UEBuildPlatform.RegisterPlatformWithGroup(UnrealTargetPlatform.Linux, UnrealPlatformGroup.Unix);
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Creates a receipt for this binary.
        /// </summary>
        /// <param name="ToolChain">Toolchain for the target platform</param>
        /// <param name="BuildPlatform">Platform that we're building for</param>
        public virtual BuildReceipt MakeReceipt(IUEToolChain ToolChain)
        {
            BuildReceipt Receipt = new BuildReceipt();

            // Get the type of build products we're creating
            BuildProductType Type = BuildProductType.RequiredResource;

            switch (Config.Type)
            {
            case UEBuildBinaryType.Executable:
                Type = BuildProductType.Executable;
                break;

            case UEBuildBinaryType.DynamicLinkLibrary:
                Type = BuildProductType.DynamicLibrary;
                break;

            case UEBuildBinaryType.StaticLibrary:
                Type = BuildProductType.StaticLibrary;
                break;
            }

            // Add the primary build products
            string DebugExtension = UEBuildPlatform.GetBuildPlatform(Target.Platform).GetDebugInfoExtension(Config.Type);

            foreach (string OutputFilePath in Config.OutputFilePaths)
            {
                AddBuildProductAndDebugFile(OutputFilePath, Type, DebugExtension, Receipt);
            }

            // Add the console app, if there is one
            if (Config.Type == UEBuildBinaryType.Executable && Config.bBuildAdditionalConsoleApp)
            {
                foreach (string OutputFilePath in Config.OutputFilePaths)
                {
                    AddBuildProductAndDebugFile(GetAdditionalConsoleAppPath(OutputFilePath), Type, DebugExtension, Receipt);
                }
            }

            // Add any extra files from the toolchain
            ToolChain.AddFilesToReceipt(Receipt, this);
            return(Receipt);
        }
Пример #3
0
        /// <summary>
        /// Register the platform with the UEBuildPlatform class
        /// </summary>
        protected override void RegisterBuildPlatforms()
        {
            if (Utils.IsRunningOnMono)
            {
                return;
            }

            WinRTPlatformSDK SDK = new WinRTPlatformSDK();

            SDK.ManageAndValidateSDK();

            if ((ProjectFileGenerator.bGenerateProjectFiles == true) || (WinRTPlatform.IsVisualStudioInstalled() == true))
            {
                bool bRegisterBuildPlatform = true;

                // We also need to check for the generated projects... to handle the case where someone generates projects w/out WinRT.
                // Hardcoding this for now - but ideally it would be dynamically discovered.
                string EngineSourcePath = Path.Combine(ProjectFileGenerator.EngineRelativePath, "Source");
                string WinRTRHIFile     = Path.Combine(EngineSourcePath, "Runtime", "Windows", "D3D11RHI", "D3D11RHI.build.cs");
                if (File.Exists(WinRTRHIFile) == false)
                {
                    bRegisterBuildPlatform = false;
                }

                if (bRegisterBuildPlatform == true)
                {
                    // Register this build platform for WinRT
                    Log.TraceVerbose("        Registering for {0}", UnrealTargetPlatform.WinRT.ToString());
                    UEBuildPlatform.RegisterBuildPlatform(new WinRTPlatform(UnrealTargetPlatform.WinRT, CPPTargetPlatform.WinRT, SDK));
                    UEBuildPlatform.RegisterPlatformWithGroup(UnrealTargetPlatform.WinRT, UnrealPlatformGroup.Microsoft);

                    // For now only register WinRT_ARM is truly a Windows 8 machine.
                    // This will prevent people who do all platform builds from running into the compiler issue.
                    if (WinRTPlatform.IsWindows8() == true)
                    {
                        Log.TraceVerbose("        Registering for {0}", UnrealTargetPlatform.WinRT_ARM.ToString());
                        UEBuildPlatform.RegisterBuildPlatform(new WinRTPlatform(UnrealTargetPlatform.WinRT_ARM, CPPTargetPlatform.WinRT_ARM, SDK));
                        UEBuildPlatform.RegisterPlatformWithGroup(UnrealTargetPlatform.WinRT_ARM, UnrealPlatformGroup.Microsoft);
                    }
                }
            }
        }
Пример #4
0
        public override void ModifyModuleRulesForOtherPlatform(string ModuleName, ModuleRules Rules, ReadOnlyTargetRules Target)
        {
            base.ModifyModuleRulesForOtherPlatform(ModuleName, Rules, Target);

            // don't do any target platform stuff if SDK is not available
            if (!UEBuildPlatform.IsPlatformAvailable(Platform))
            {
                return;
            }

            if ((Target.Platform == UnrealTargetPlatform.Win32) || (Target.Platform == UnrealTargetPlatform.Win64) || (Target.Platform == UnrealTargetPlatform.Mac))
            {
                // allow standalone tools to use targetplatform modules, without needing Engine
                if (Target.bForceBuildTargetPlatforms)
                {
                    // @todo tvos: Make the module
                    // InModule.AddPlatformSpecificDynamicallyLoadedModule("TVOSTargetPlatform");
                }
            }
        }
Пример #5
0
        /// <summary>
        /// Get the default path for a target's version file.
        /// </summary>
        /// <param name="OutputDirectory">The output directory for the executable. For MacOS, this is the directory containing the app bundle.</param>
        /// <param name="TargetName">Name of the target being built</param>
        /// <param name="Platform">Platform the target is being built for</param>
        /// <param name="Configuration">The configuration being built</param>
        /// <param name="Architecture">Architecture of the target being built</param>
        /// <returns>Path to the target's version file</returns>
        public static FileReference GetFileNameForTarget(DirectoryReference OutputDirectory, string TargetName, UnrealTargetPlatform Platform, UnrealTargetConfiguration Configuration, string Architecture)
        {
            // Get the architecture suffix. Platforms have the option of overriding whether to include this string in filenames.
            string ArchitectureSuffix = "";

            if (UEBuildPlatform.GetBuildPlatform(Platform).RequiresArchitectureSuffix())
            {
                ArchitectureSuffix = Architecture;
            }

            // Build the output filename
            if (String.IsNullOrEmpty(ArchitectureSuffix) && Configuration == UnrealTargetConfiguration.Development)
            {
                return(FileReference.Combine(OutputDirectory, String.Format("{0}.version", TargetName)));
            }
            else
            {
                return(FileReference.Combine(OutputDirectory, String.Format("{0}-{1}-{2}{3}.version", TargetName, Platform.ToString(), Configuration.ToString(), ArchitectureSuffix)));
            }
        }
Пример #6
0
        /// <summary>
        /// Returns the standard path to the build receipt for a given target
        /// </summary>
        /// <param name="BaseDir">Base directory for the target being built; either the project directory or engine directory.</param>
        /// <param name="TargetName">The target being built</param>
        /// <param name="Platform">The target platform</param>
        /// <param name="Configuration">The target configuration</param>
        /// <param name="BuildArchitecture">The architecture being built</param>
        /// <returns>Path to the receipt for this target</returns>
        public static FileReference GetDefaultPath(DirectoryReference BaseDir, string TargetName, UnrealTargetPlatform Platform, UnrealTargetConfiguration Configuration, string BuildArchitecture)
        {
            // Get the architecture suffix. Platforms have the option of overriding whether to include this string in filenames.
            string ArchitectureSuffix = "";

            if (!String.IsNullOrEmpty(BuildArchitecture) && UEBuildPlatform.GetBuildPlatform(Platform).RequiresArchitectureSuffix())
            {
                ArchitectureSuffix = BuildArchitecture;
            }

            // Build the output filename
            if (String.IsNullOrEmpty(ArchitectureSuffix) && Configuration == UnrealTargetConfiguration.Development)
            {
                return(FileReference.Combine(BaseDir, "Binaries", Platform.ToString(), String.Format("{0}.target", TargetName)));
            }
            else
            {
                return(FileReference.Combine(BaseDir, "Binaries", Platform.ToString(), String.Format("{0}-{1}-{2}{3}.target", TargetName, Platform.ToString(), Configuration.ToString(), ArchitectureSuffix)));
            }
        }
Пример #7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="InProject"></param>
        /// <param name="Distribution"></param>
        /// <param name="MobileProvision"></param>
        /// <param name="SigningCertificate"></param>
        /// <param name="TeamUUID"></param>
        /// <param name="bAutomaticSigning"></param>
        public static void GetProvisioningData(FileReference InProject, bool Distribution, out string MobileProvision, out string SigningCertificate, out string TeamUUID, out bool bAutomaticSigning)
        {
            IOSProjectSettings ProjectSettings = ((TVOSPlatform)UEBuildPlatform.GetBuildPlatform(UnrealTargetPlatform.TVOS)).ReadProjectSettings(InProject);

            IOSProvisioningData Data = ((IOSPlatform)UEBuildPlatform.GetBuildPlatform(UnrealTargetPlatform.TVOS)).ReadProvisioningData(ProjectSettings, Distribution);

            if (Data == null)
            {
                MobileProvision    = null;
                SigningCertificate = null;
                TeamUUID           = null;
                bAutomaticSigning  = false;
            }
            else
            {
                MobileProvision    = Data.MobileProvision;
                SigningCertificate = Data.SigningCertificate;
                TeamUUID           = Data.TeamUUID;
                bAutomaticSigning  = ProjectSettings.bAutomaticSigning;
            }
        }
        /// <summary>
        /// Write C++ toolchain information to JSON writer
        /// </summary>
        /// <param name="Target"></param>
        /// <param name="Writer"></param>
        private void ExportEnvironmentToJson(UEBuildTarget Target, JsonWriter Writer)
        {
            CppCompileEnvironment GlobalCompileEnvironment = Target.CreateCompileEnvironmentForProjectFiles();

            RootToolchainInfo = GenerateToolchainInfo(GlobalCompileEnvironment);

            Writer.WriteObjectStart("ToolchainInfo");
            foreach (Tuple <string, object> Field in RootToolchainInfo.GetFields())
            {
                WriteField(Target.TargetName, Writer, Field);
            }
            Writer.WriteObjectEnd();

            Writer.WriteArrayStart("EnvironmentIncludePaths");
            foreach (DirectoryReference Path in GlobalCompileEnvironment.UserIncludePaths)
            {
                Writer.WriteValue(Path.FullName);
            }
            foreach (DirectoryReference Path in GlobalCompileEnvironment.SystemIncludePaths)
            {
                Writer.WriteValue(Path.FullName);
            }

            // TODO: get corresponding includes for specific platforms
            if (UEBuildPlatform.IsPlatformInGroup(Target.Platform, UnrealPlatformGroup.Windows))
            {
                foreach (DirectoryReference Path in Target.Rules.WindowsPlatform.Environment.IncludePaths)
                {
                    Writer.WriteValue(Path.FullName);
                }
            }
            Writer.WriteArrayEnd();

            Writer.WriteArrayStart("EnvironmentDefinitions");
            foreach (string Definition in GlobalCompileEnvironment.Definitions)
            {
                Writer.WriteValue(Definition);
            }
            Writer.WriteArrayEnd();
        }
Пример #9
0
        /// <summary>
        /// Get CPU architecture target for ISPC.
        /// </summary>
        /// <param name="Platform">Which OS platform to target.</param>
        /// <param name="Arch">Which architecture inside an OS platform to target. Only used for Android currently.</param>
        /// <returns>Arch string passed to ISPC compiler</returns>
        public virtual string GetISPCArchTarget(UnrealTargetPlatform Platform, string Arch)
        {
            string ISPCArch = "";

            if ((UEBuildPlatform.IsPlatformInGroup(Platform, UnrealPlatformGroup.Windows) && Platform != UnrealTargetPlatform.Win32) ||
                (UEBuildPlatform.IsPlatformInGroup(Platform, UnrealPlatformGroup.Unix) && Platform != UnrealTargetPlatform.LinuxAArch64) ||
                Platform == UnrealTargetPlatform.Mac)
            {
                ISPCArch += "x86-64";
            }
            else if (Platform == UnrealTargetPlatform.Win32)
            {
                ISPCArch += "x86";
            }
            else if (Platform == UnrealTargetPlatform.LinuxAArch64)
            {
                ISPCArch += "aarch64";
            }
            else if (Platform == UnrealTargetPlatform.Android || Platform == UnrealTargetPlatform.Lumin)
            {
                switch (Arch)
                {
                case "-armv7": ISPCArch += "arm"; break;                         // Assumes NEON is in use

                case "-arm64": ISPCArch += "aarch64"; break;

                case "-x86": ISPCArch += "x86"; break;

                case "-x64": ISPCArch += "x86-64"; break;

                default: Log.TraceWarning("Invalid Android architecture for ISPC. At least one architecture (armv7, x86, etc) needs to be selected in the project settings to build"); break;
                }
            }
            else
            {
                Log.TraceWarning("Unsupported ISPC platform target!");
            }

            return(ISPCArch);
        }
Пример #10
0
        /// <summary>
        /// Modify the rules for a newly created module, where the target is a different host platform.
        /// This is not required - but allows for hiding details of a particular platform.
        /// </summary>
        /// <param name="ModuleName">The name of the module</param>
        /// <param name="Rules">The module rules</param>
        /// <param name="Target">The target being build</param>
        public override void ModifyModuleRulesForOtherPlatform(string ModuleName, ModuleRules Rules, ReadOnlyTargetRules Target)
        {
            // don't do any target platform stuff if SDK is not available
            if (!UEBuildPlatform.IsPlatformAvailable(Platform))
            {
                return;
            }

            if ((Target.Platform == UnrealTargetPlatform.Win32) || (Target.Platform == UnrealTargetPlatform.Win64))
            {
                if (!Target.bBuildRequiresCookedData)
                {
                    if (ModuleName == "Engine")
                    {
                        if (Target.bBuildDeveloperTools)
                        {
                            Rules.DynamicallyLoadedModuleNames.Add("LinuxTargetPlatform");
                            Rules.DynamicallyLoadedModuleNames.Add("LinuxNoEditorTargetPlatform");
                            Rules.DynamicallyLoadedModuleNames.Add("LinuxAArch64NoEditorTargetPlatform");
                            Rules.DynamicallyLoadedModuleNames.Add("LinuxClientTargetPlatform");
                            Rules.DynamicallyLoadedModuleNames.Add("LinuxAArch64ClientTargetPlatform");
                            Rules.DynamicallyLoadedModuleNames.Add("LinuxServerTargetPlatform");
                            Rules.DynamicallyLoadedModuleNames.Add("LinuxAArch64ServerTargetPlatform");
                        }
                    }
                }

                // allow standalone tools to use targetplatform modules, without needing Engine
                if (Target.bForceBuildTargetPlatforms && ModuleName == "TargetPlatform")
                {
                    Rules.DynamicallyLoadedModuleNames.Add("LinuxTargetPlatform");
                    Rules.DynamicallyLoadedModuleNames.Add("LinuxNoEditorTargetPlatform");
                    Rules.DynamicallyLoadedModuleNames.Add("LinuxAArch64NoEditorTargetPlatform");
                    Rules.DynamicallyLoadedModuleNames.Add("LinuxClientTargetPlatform");
                    Rules.DynamicallyLoadedModuleNames.Add("LinuxAArch64ClientTargetPlatform");
                    Rules.DynamicallyLoadedModuleNames.Add("LinuxServerTargetPlatform");
                    Rules.DynamicallyLoadedModuleNames.Add("LinuxAArch64ServerTargetPlatform");
                }
            }
        }
Пример #11
0
        /// <summary>
        /// Gets all build products produced by this binary
        /// </summary>
        /// <param name="ToolChain">The platform toolchain</param>
        /// <param name="BuildProducts">Mapping of produced build product to type</param>
        public virtual void GetBuildProducts(UEToolChain ToolChain, Dictionary <FileReference, BuildProductType> BuildProducts)
        {
            // Get the type of build products we're creating
            BuildProductType Type = BuildProductType.RequiredResource;

            switch (Config.Type)
            {
            case UEBuildBinaryType.Executable:
                Type = BuildProductType.Executable;
                break;

            case UEBuildBinaryType.DynamicLinkLibrary:
                Type = BuildProductType.DynamicLibrary;
                break;

            case UEBuildBinaryType.StaticLibrary:
                Type = BuildProductType.StaticLibrary;
                break;
            }

            // Add the primary build products
            string DebugExtension = UEBuildPlatform.GetBuildPlatform(Target.Platform).GetDebugInfoExtension(Config.Type);

            foreach (FileReference OutputFilePath in Config.OutputFilePaths)
            {
                AddBuildProductAndDebugFile(OutputFilePath, Type, DebugExtension, BuildProducts, ToolChain);
            }

            // Add the console app, if there is one
            if (Config.Type == UEBuildBinaryType.Executable && Config.bBuildAdditionalConsoleApp)
            {
                foreach (FileReference OutputFilePath in Config.OutputFilePaths)
                {
                    AddBuildProductAndDebugFile(GetAdditionalConsoleAppPath(OutputFilePath), Type, DebugExtension, BuildProducts, ToolChain);
                }
            }

            // Add any extra files from the toolchain
            ToolChain.ModifyBuildProducts(this, BuildProducts);
        }
Пример #12
0
        /// <summary>
        /// Writes information about the targets in an assembly to a file
        /// </summary>
        /// <param name="ProjectFile">The project file for the targets being built</param>
        /// <param name="Assembly">The rules assembly for this target</param>
        /// <param name="OutputFile">Output file to write to</param>
        /// <param name="Arguments"></param>
        public static void WriteTargetInfo(FileReference ProjectFile, RulesAssembly Assembly, FileReference OutputFile, CommandLineArguments Arguments)
        {
            // Construct all the targets in this assembly
            List <string> TargetNames = new List <string>();

            Assembly.GetAllTargetNames(TargetNames, false);

            // Write the output file
            DirectoryReference.CreateDirectory(OutputFile.Directory);
            using (JsonWriter Writer = new JsonWriter(OutputFile))
            {
                Writer.WriteObjectStart();
                Writer.WriteArrayStart("Targets");
                foreach (string TargetName in TargetNames)
                {
                    // Construct the rules object
                    TargetRules TargetRules;
                    try
                    {
                        string Architecture = UEBuildPlatform.GetBuildPlatform(BuildHostPlatform.Current.Platform).GetDefaultArchitecture(ProjectFile);
                        TargetRules = Assembly.CreateTargetRules(TargetName, BuildHostPlatform.Current.Platform, UnrealTargetConfiguration.Development, Architecture, ProjectFile, Arguments);
                    }
                    catch (Exception Ex)
                    {
                        Log.TraceWarning("Unable to construct target rules for {0}", TargetName);
                        Log.TraceVerbose(ExceptionUtils.FormatException(Ex));
                        continue;
                    }

                    // Write the target info
                    Writer.WriteObjectStart();
                    Writer.WriteValue("Name", TargetName);
                    Writer.WriteValue("Path", Assembly.GetTargetFileName(TargetName).ToString());
                    Writer.WriteValue("Type", TargetRules.Type.ToString());
                    Writer.WriteObjectEnd();
                }
                Writer.WriteArrayEnd();
                Writer.WriteObjectEnd();
            }
        }
Пример #13
0
        /// <summary>
        /// Register the platform with the UEBuildPlatform class
        /// </summary>
        protected override void RegisterBuildPlatforms(SDKOutputLevel OutputLevel)
        {
            IOSPlatformSDK SDK = new IOSPlatformSDK();

            SDK.ManageAndValidateSDK(OutputLevel);

            // Register this build platform for IOS
            Log.TraceVerbose("        Registering for {0}", UnrealTargetPlatform.IOS.ToString());
            UEBuildPlatform.RegisterBuildPlatform(new IOSPlatform(SDK));
            UEBuildPlatform.RegisterPlatformWithGroup(UnrealTargetPlatform.IOS, UnrealPlatformGroup.Unix);
            UEBuildPlatform.RegisterPlatformWithGroup(UnrealTargetPlatform.IOS, UnrealPlatformGroup.Apple);
            UEBuildPlatform.RegisterPlatformWithGroup(UnrealTargetPlatform.IOS, UnrealPlatformGroup.IOS);

            if (IOSPlatform.IOSArchitecture == "-simulator")
            {
                UEBuildPlatform.RegisterPlatformWithGroup(UnrealTargetPlatform.IOS, UnrealPlatformGroup.Simulator);
            }
            else
            {
                UEBuildPlatform.RegisterPlatformWithGroup(UnrealTargetPlatform.IOS, UnrealPlatformGroup.Device);
            }
        }
Пример #14
0
        /// <summary>
        /// Get object file suffix for ISPC.
        /// </summary>
        /// <param name="Platform">Which OS build platform is running on.</param>
        /// <returns>Object file suffix</returns>
        public virtual string GetISPCObjectFileSuffix(UnrealTargetPlatform Platform)
        {
            string Suffix = "";

            if (UEBuildPlatform.IsPlatformInGroup(Platform, UnrealPlatformGroup.Windows))
            {
                Suffix += ".obj";
            }
            else if (UEBuildPlatform.IsPlatformInGroup(Platform, UnrealPlatformGroup.Unix) ||
                     Platform == UnrealTargetPlatform.Mac ||
                     Platform == UnrealTargetPlatform.Android ||
                     Platform == UnrealTargetPlatform.Lumin)
            {
                Suffix += ".o";
            }
            else
            {
                Log.TraceWarning("Unsupported ISPC platform target!");
            }

            return(Suffix);
        }
Пример #15
0
        /**
         *	Register the platform with the UEBuildPlatform class
         */
        protected override void RegisterBuildPlatformInternal()
        {
            //@todo.Rocket: Add platform support
            if (UnrealBuildTool.RunningRocket() || UnrealBuildTool.BuildingRocket())
            {
                return;
            }

            // Make sure the SDK is installed
            if ((ProjectFileGenerator.bGenerateProjectFiles == true) || (HasRequiredSDKsInstalled() == SDKStatus.Valid))
            {
                bool bRegisterBuildPlatform = true;

                // make sure we have the HTML5 files; if not, then this user doesn't really have HTML5 access/files, no need to compile HTML5!
                string EngineSourcePath        = Path.Combine(ProjectFileGenerator.EngineRelativePath, "Source");
                string HTML5TargetPlatformFile = Path.Combine(EngineSourcePath, "Developer", "HTML5", "HTML5TargetPlatform", "HTML5TargetPlatform.Build.cs");
                if ((File.Exists(HTML5TargetPlatformFile) == false))
                {
                    bRegisterBuildPlatform = false;
                    Log.TraceWarning("Missing required components (.... HTML5TargetPlatformFile, others here...). Check source control filtering, or try resyncing.");
                }

                if (bRegisterBuildPlatform == true)
                {
                    // Register this build platform for HTML5
                    Log.TraceVerbose("        Registering for {0}", UnrealTargetPlatform.HTML5.ToString());
                    UEBuildPlatform.RegisterBuildPlatform(UnrealTargetPlatform.HTML5, this);
                    if (GetActiveArchitecture() == "-win32")
                    {
                        UEBuildPlatform.RegisterPlatformWithGroup(UnrealTargetPlatform.HTML5, UnrealPlatformGroup.Simulator);
                    }
                    else
                    {
                        UEBuildPlatform.RegisterPlatformWithGroup(UnrealTargetPlatform.HTML5, UnrealPlatformGroup.Device);
                    }
                }
            }
        }
Пример #16
0
        /// <summary>
        /// Setup the target environment for building
        /// </summary>
        /// <param name="Target">Settings for the target being compiled</param>
        /// <param name="CompileEnvironment">The compile environment for this target</param>
        /// <param name="LinkEnvironment">The link environment for this target</param>
        public override void SetUpEnvironment(ReadOnlyTargetRules Target, CppCompileEnvironment CompileEnvironment, LinkEnvironment LinkEnvironment)
        {
            CompileEnvironment.Definitions.Add("PLATFORM_IOS=1");
            CompileEnvironment.Definitions.Add("PLATFORM_APPLE=1");

            CompileEnvironment.Definitions.Add("WITH_TTS=0");
            CompileEnvironment.Definitions.Add("WITH_SPEECH_RECOGNITION=0");
            CompileEnvironment.Definitions.Add("WITH_DATABASE_SUPPORT=0");
            CompileEnvironment.Definitions.Add("WITH_EDITOR=0");
            CompileEnvironment.Definitions.Add("USE_NULL_RHI=0");
            CompileEnvironment.Definitions.Add("REQUIRES_ALIGNED_INT_ACCESS");

            IOSProjectSettings ProjectSettings = ((IOSPlatform)UEBuildPlatform.GetBuildPlatform(Target.Platform)).ReadProjectSettings(Target.ProjectFile);

            if (ProjectSettings.bNotificationsEnabled)
            {
                CompileEnvironment.Definitions.Add("NOTIFICATIONS_ENABLED=1");
            }
            else
            {
                CompileEnvironment.Definitions.Add("NOTIFICATIONS_ENABLED=0");
            }

            CompileEnvironment.Definitions.Add("UE_DISABLE_FORCE_INLINE=" + (ProjectSettings.bDisableForceInline ? "1" : "0"));

            if (Target.Architecture == "-simulator")
            {
                CompileEnvironment.Definitions.Add("WITH_SIMULATOR=1");
            }
            else
            {
                CompileEnvironment.Definitions.Add("WITH_SIMULATOR=0");
            }

            LinkEnvironment.AdditionalFrameworks.Add(new UEBuildFramework("GameKit"));
            LinkEnvironment.AdditionalFrameworks.Add(new UEBuildFramework("StoreKit"));
            LinkEnvironment.AdditionalFrameworks.Add(new UEBuildFramework("DeviceCheck"));
        }
        /**
         *	Register the given platforms UEPlatformProjectGenerator instance
         *
         *	@param	InPlatform			The UnrealTargetPlatform to register with
         *	@param	InProjectGenerator	The UEPlatformProjectGenerator instance to use for the InPlatform
         */
        public static void RegisterPlatformProjectGenerator(UnrealTargetPlatform InPlatform, UEPlatformProjectGenerator InProjectGenerator)
        {
            // Make sure the build platform is legal
            var BuildPlatform = UEBuildPlatform.GetBuildPlatform(InPlatform, true);

            if (BuildPlatform != null)
            {
                if (ProjectGeneratorDictionary.ContainsKey(InPlatform) == true)
                {
                    Log.TraceInformation("RegisterPlatformProjectGenerator Warning: Registering project generator {0} for {1} when it is already set to {2}",
                                         InProjectGenerator.ToString(), InPlatform.ToString(), ProjectGeneratorDictionary[InPlatform].ToString());
                    ProjectGeneratorDictionary[InPlatform] = InProjectGenerator;
                }
                else
                {
                    ProjectGeneratorDictionary.Add(InPlatform, InProjectGenerator);
                }
            }
            else
            {
                Log.TraceVerbose("Skipping project file generator registration for {0} due to no valid BuildPlatform.", InPlatform.ToString());
            }
        }
Пример #18
0
        /// <summary>
        /// Register the platform with the UEBuildPlatform class
        /// </summary>
        public override void RegisterBuildPlatforms()
        {
            HTML5PlatformSDK SDK = new HTML5PlatformSDK();

            SDK.ManageAndValidateSDK();

            // Make sure the SDK is installed
            if ((ProjectFileGenerator.bGenerateProjectFiles == true) || (SDK.HasRequiredSDKsInstalled() == SDKStatus.Valid))
            {
                // make sure we have the HTML5 files; if not, then this user doesn't really have HTML5 access/files, no need to compile HTML5!
                FileReference HTML5TargetPlatformFile = FileReference.Combine(UnrealBuildTool.EngineSourceDirectory, "Developer", "HTML5", "HTML5TargetPlatform", "HTML5TargetPlatform.Build.cs");
                if (!FileReference.Exists(HTML5TargetPlatformFile))
                {
                    Log.TraceWarning("Missing required components (.... HTML5TargetPlatformFile, others here...). Check source control filtering, or try resyncing.");
                }
                else
                {
                    // Register this build platform for HTML5
                    Log.TraceVerbose("        Registering for {0}", UnrealTargetPlatform.HTML5.ToString());
                    UEBuildPlatform.RegisterBuildPlatform(new HTML5Platform(SDK));
                }
            }
        }
Пример #19
0
        protected override void RegisterBuildPlatformInternal()
        {
            if ((ProjectFileGenerator.bGenerateProjectFiles == true) || (HasRequiredSDKsInstalled() == SDKStatus.Valid) || Environment.GetEnvironmentVariable("IsBuildMachine") == "1")
            {
                bool bRegisterBuildPlatform = true;

                string EngineSourcePath          = Path.Combine(ProjectFileGenerator.EngineRelativePath, "Source");
                string AndroidTargetPlatformFile = Path.Combine(EngineSourcePath, "Developer", "Android", "AndroidTargetPlatform", "AndroidTargetPlatform.Build.cs");

                if (File.Exists(AndroidTargetPlatformFile) == false)
                {
                    bRegisterBuildPlatform = false;
                }

                if (bRegisterBuildPlatform == true)
                {
                    // Register this build platform
                    Log.TraceVerbose("        Registering for {0}", UnrealTargetPlatform.Android.ToString());
                    UEBuildPlatform.RegisterBuildPlatform(UnrealTargetPlatform.Android, this);
                    UEBuildPlatform.RegisterPlatformWithGroup(UnrealTargetPlatform.Android, UnrealPlatformGroup.Android);
                }
            }
        }
Пример #20
0
        /// <summary>
        /// Modify the rules for a newly created module, where the target is a different host platform.
        /// This is not required - but allows for hiding details of a particular platform.
        /// </summary>
        /// <param name="ModuleName">The name of the module</param>
        /// <param name="Rules">The module rules</param>
        /// <param name="Target">The target being build</param>
        public override void ModifyModuleRulesForOtherPlatform(string ModuleName, ModuleRules Rules, ReadOnlyTargetRules Target)
        {
            // don't do any target platform stuff if SDK is not available
            if (!UEBuildPlatform.IsPlatformAvailable(Platform))
            {
                return;
            }

            if ((Target.Platform == UnrealTargetPlatform.Win32) || (Target.Platform == UnrealTargetPlatform.Win64) || (Target.Platform == UnrealTargetPlatform.Mac) || (Target.Platform == UnrealTargetPlatform.Linux))
            {
                bool bBuildShaderFormats = Target.bForceBuildShaderFormats;
                if (!Target.bBuildRequiresCookedData)
                {
                    if (ModuleName == "Engine")
                    {
                        if (Target.bBuildDeveloperTools)
                        {
                            Rules.DynamicallyLoadedModuleNames.Add("LuminTargetPlatform");
                        }
                    }
                    else if (ModuleName == "TargetPlatform")
                    {
                        bBuildShaderFormats = true;
                        Rules.DynamicallyLoadedModuleNames.Add("TextureFormatASTC");
                    }
                }

                // allow standalone tools to use targetplatform modules, without needing Engine
                if (ModuleName == "TargetPlatform")
                {
                    if (Target.bForceBuildTargetPlatforms)
                    {
                        Rules.DynamicallyLoadedModuleNames.Add("LuminTargetPlatform");
                    }
                }
            }
        }
Пример #21
0
        /// <summary>
        /// Get CPU Instruction set targets for ISPC.
        /// </summary>
        /// <param name="Platform">Which OS platform to target.</param>
        /// <param name="Arch">Which architecture inside an OS platform to target. Only used for Android currently.</param>
        /// <returns>List of instruction set targets passed to ISPC compiler</returns>
        public virtual List <string> GetISPCCompileTargets(UnrealTargetPlatform Platform, string Arch)
        {
            List <string> ISPCTargets = new List <string>();

            if (UEBuildPlatform.IsPlatformInGroup(Platform, UnrealPlatformGroup.Windows) ||
                (UEBuildPlatform.IsPlatformInGroup(Platform, UnrealPlatformGroup.Unix) && Platform != UnrealTargetPlatform.LinuxAArch64) ||
                Platform == UnrealTargetPlatform.Mac)
            {
                ISPCTargets.AddRange(new string[] { "avx512skx-i32x8", "avx2", "avx", "sse4", "sse2" });
            }
            else if (Platform == UnrealTargetPlatform.LinuxAArch64)
            {
                ISPCTargets.AddRange(new string[] { "neon" });
            }
            else if (Platform == UnrealTargetPlatform.Android || Platform == UnrealTargetPlatform.Lumin)
            {
                switch (Arch)
                {
                case "-armv7": ISPCTargets.Add("neon"); break;                         // Assumes NEON is in use

                case "-arm64": ISPCTargets.Add("neon"); break;

                case "-x86": ISPCTargets.AddRange(new string[] { "sse4", "sse2" }); break;

                case "-x64": ISPCTargets.AddRange(new string[] { "sse4", "sse2" }); break;

                default: Log.TraceWarning("Invalid Android architecture for ISPC. At least one architecture (armv7, x86, etc) needs to be selected in the project settings to build"); break;
                }
            }
            else
            {
                Log.TraceWarning("Unsupported ISPC platform target!");
            }

            return(ISPCTargets);
        }
Пример #22
0
        private void GenerateSNDBSIncludeRewriteRules()
        {
            // Get all registered platforms. Most will just use the name as is, but some may have an override so
            // add all distinct entries to the list.
            IEnumerable <UnrealTargetPlatform> Platforms = UEBuildPlatform.GetRegisteredPlatforms();
            List <string> PlatformNames = new List <string>();

            foreach (UnrealTargetPlatform Platform in Platforms)
            {
                UEBuildPlatform PlatformData = UEBuildPlatform.GetBuildPlatform(Platform);
                if (!PlatformNames.Contains(PlatformData.GetPlatformName()))
                {
                    PlatformNames.Add(PlatformData.GetPlatformName());
                }
            }

            if (!Directory.Exists(IncludeRewriteRulesFile.Directory.FullName))
            {
                Directory.CreateDirectory(IncludeRewriteRulesFile.Directory.FullName);
            }

            List <string> IncludeRewriteRulesText = new List <string>();

            IncludeRewriteRulesText.Add("[computed-include-rules]");
            {
                IncludeRewriteRulesText.Add(@"pattern1=^COMPILED_PLATFORM_HEADER\(\s*([^ ,]+)\)");
                IEnumerable <string> PlatformExpansions = PlatformNames.Select(p => String.Format("{0}/{0}$1|{0}$1", p));
                IncludeRewriteRulesText.Add(String.Format("expansions1={0}", String.Join("|", PlatformExpansions)));
            }
            {
                IncludeRewriteRulesText.Add(@"pattern2=^COMPILED_PLATFORM_HEADER_WITH_PREFIX\(\s*([^ ,]+)\s*,\s*([^ ,]+)\)");
                IEnumerable <string> PlatformExpansions = PlatformNames.Select(p => String.Format("$1/{0}/{0}$2|$1/{0}$2", p));
                IncludeRewriteRulesText.Add(String.Format("expansions2={0}", String.Join("|", PlatformExpansions)));
            }
            File.WriteAllText(IncludeRewriteRulesFile.FullName, String.Join(Environment.NewLine, IncludeRewriteRulesText));
        }
Пример #23
0
        /// <summary>
        /// Setup the binaries for this target
        /// </summary>
        protected override void SetupBinaries()
        {
            base.SetupBinaries();

            {
                // Make the editor executable.
                UEBuildBinaryConfiguration Config = new UEBuildBinaryConfiguration(InType: UEBuildBinaryType.Executable,
                                                                                   InOutputFilePaths: OutputPaths,
                                                                                   InIntermediateDirectory: EngineIntermediateDirectory,
                                                                                   bInCreateImportLibrarySeparately: (ShouldCompileMonolithic() ? false : true),
                                                                                   bInAllowExports: !ShouldCompileMonolithic(),
                                                                                   InModuleNames: new List <string>()
                {
                    "Launch"
                });

                // This "default" game module is required by the editor executable in case
                // you want to run it in content-only mode.
                if (!ExtraModuleNames.Contains("UE4Game"))
                {
                    ExtraModuleNames.Add("UE4Game");
                }

                AppBinaries.Add(new UEBuildBinaryCPP(this, Config));
            }

            // Add the other modules that we want to compile along with the executable.  These aren't necessarily
            // dependencies to any of the other modules we're building, so we need to opt in to compile them.
            {
                // Modules should properly identify the 'extra modules' they need now.
                // There should be nothing here!
            }

            // Allow the platform to setup binaries
            UEBuildPlatform.GetBuildPlatform(Platform).SetupBinaries(this);
        }
Пример #24
0
        public static List <TargetDescriptor> ParseCommandLine(string[] Arguments, ref FileReference ProjectFile)
        {
            UnrealTargetPlatform      Platform      = UnrealTargetPlatform.Unknown;
            UnrealTargetConfiguration Configuration = UnrealTargetConfiguration.Unknown;
            List <string>             TargetNames   = new List <string>();
            string            Architecture          = null;
            string            RemoteRoot            = null;
            List <OnlyModule> OnlyModules           = new List <OnlyModule>();
            FileReference     ForeignPlugin         = null;
            string            ForceReceiptFileName  = null;

            // If true, the recompile was launched by the editor.
            bool bIsEditorRecompile = false;

            // Settings for creating/using static libraries for the engine
            List <string> PossibleTargetNames = new List <string>();

            for (int ArgumentIndex = 0; ArgumentIndex < Arguments.Length; ArgumentIndex++)
            {
                string Argument = Arguments[ArgumentIndex];
                if (!Argument.StartsWith("-"))
                {
                    UnrealTargetPlatform ParsedPlatform;
                    if (Enum.TryParse(Argument, true, out ParsedPlatform) && ParsedPlatform != UnrealTargetPlatform.Unknown)
                    {
                        if (Platform != UnrealTargetPlatform.Unknown)
                        {
                            throw new BuildException("Multiple platforms specified on command line (first {0}, then {1})", Platform, ParsedPlatform);
                        }
                        Platform = ParsedPlatform;
                        continue;
                    }

                    UnrealTargetConfiguration ParsedConfiguration;
                    if (Enum.TryParse(Argument, true, out ParsedConfiguration) && ParsedConfiguration != UnrealTargetConfiguration.Unknown)
                    {
                        if (Configuration != UnrealTargetConfiguration.Unknown)
                        {
                            throw new BuildException("Multiple configurations specified on command line (first {0}, then {1})", Configuration, ParsedConfiguration);
                        }
                        Configuration = ParsedConfiguration;
                        continue;
                    }

                    PossibleTargetNames.Add(Argument);
                }
                else
                {
                    switch (Arguments[ArgumentIndex].ToUpperInvariant())
                    {
                    case "-MODULE":
                        // Specifies a module to recompile.  Can be specified more than once on the command-line to compile multiple specific modules.
                    {
                        if (ArgumentIndex + 1 >= Arguments.Length)
                        {
                            throw new BuildException("Expected module name after -Module argument, but found nothing.");
                        }
                        string OnlyModuleName = Arguments[++ArgumentIndex];

                        OnlyModules.Add(new OnlyModule(OnlyModuleName));
                    }
                    break;

                    case "-MODULEWITHSUFFIX":
                    {
                        // Specifies a module name to compile along with a suffix to append to the DLL file name.  Can be specified more than once on the command-line to compile multiple specific modules.
                        if (ArgumentIndex + 2 >= Arguments.Length)
                        {
                            throw new BuildException("Expected module name and module suffix -ModuleWithSuffix argument");
                        }

                        string OnlyModuleName   = Arguments[++ArgumentIndex];
                        string OnlyModuleSuffix = Arguments[++ArgumentIndex];

                        OnlyModules.Add(new OnlyModule(OnlyModuleName, OnlyModuleSuffix));
                    }
                    break;

                    case "-PLUGIN":
                    {
                        if (ArgumentIndex + 1 >= Arguments.Length)
                        {
                            throw new BuildException("Expected plugin filename after -Plugin argument, but found nothing.");
                        }
                        if (ForeignPlugin != null)
                        {
                            throw new BuildException("Only one foreign plugin to compile may be specified per invocation");
                        }
                        ForeignPlugin = new FileReference(Arguments[++ArgumentIndex]);
                    }
                    break;

                    case "-RECEIPT":
                    {
                        if (ArgumentIndex + 1 >= Arguments.Length)
                        {
                            throw new BuildException("Expected path to the generated receipt after -Receipt argument, but found nothing.");
                        }

                        ForceReceiptFileName = Arguments[++ArgumentIndex];
                    }
                    break;

                    // -RemoteRoot <RemoteRoot> sets where the generated binaries are CookerSynced.
                    case "-REMOTEROOT":
                        if (ArgumentIndex + 1 >= Arguments.Length)
                        {
                            throw new BuildException("Expected path after -RemoteRoot argument, but found nothing.");
                        }
                        ArgumentIndex++;
                        if (Arguments[ArgumentIndex].StartsWith("xe:\\") == true)
                        {
                            RemoteRoot = Arguments[ArgumentIndex].Substring("xe:\\".Length);
                        }
                        else if (Arguments[ArgumentIndex].StartsWith("devkit:\\") == true)
                        {
                            RemoteRoot = Arguments[ArgumentIndex].Substring("devkit:\\".Length);
                        }
                        break;

                    case "-DEPLOY":
                        // Does nothing at the moment...
                        break;

                    case "-EDITORRECOMPILE":
                    {
                        bIsEditorRecompile = true;
                    }
                    break;

                    default:
                        break;
                    }
                }
            }

            if (Platform == UnrealTargetPlatform.Unknown)
            {
                throw new BuildException("Couldn't find platform name.");
            }
            if (Configuration == UnrealTargetConfiguration.Unknown)
            {
                throw new BuildException("Couldn't determine configuration name.");
            }

            List <TargetDescriptor> Targets = new List <TargetDescriptor>();

            if (PossibleTargetNames.Count > 0)
            {
                // We have possible targets!
                string PossibleTargetName = PossibleTargetNames[0];

                // If Engine is installed, the PossibleTargetName could contain a path
                string TargetName = PossibleTargetName;

                // If a project file was not specified see if we can find one
                if (ProjectFile == null && UProjectInfo.TryGetProjectForTarget(TargetName, out ProjectFile))
                {
                    Log.TraceVerbose("Found project file for {0} - {1}", TargetName, ProjectFile);
                }

                UEBuildPlatform BuildPlatform = UEBuildPlatform.GetBuildPlatform(Platform);

                if (Architecture == null)
                {
                    Architecture = BuildPlatform.GetDefaultArchitecture(ProjectFile);
                }

                Targets.Add(new TargetDescriptor()
                {
                    ProjectFile          = ProjectFile,
                    TargetName           = TargetName,
                    Platform             = Platform,
                    Configuration        = Configuration,
                    Architecture         = Architecture,
                    bIsEditorRecompile   = bIsEditorRecompile,
                    RemoteRoot           = RemoteRoot,
                    OnlyModules          = OnlyModules,
                    ForeignPlugin        = ForeignPlugin,
                    ForceReceiptFileName = ForceReceiptFileName
                });
            }
            if (Targets.Count == 0)
            {
                throw new BuildException("No target name was specified on the command-line.");
            }
            return(Targets);
        }
Пример #25
0
        /// <summary>
        /// Gets all build products produced by this binary
        /// </summary>
        /// <param name="Target">The target being built</param>
        /// <param name="ToolChain">The platform toolchain</param>
        /// <param name="BuildProducts">Mapping of produced build product to type</param>
        /// <param name="bCreateDebugInfo">Whether debug info is enabled for this binary</param>
        public void GetBuildProducts(ReadOnlyTargetRules Target, UEToolChain ToolChain, Dictionary <FileReference, BuildProductType> BuildProducts, bool bCreateDebugInfo)
        {
            // Add all the precompiled outputs
            foreach (UEBuildModuleCPP Module in Modules.OfType <UEBuildModuleCPP>())
            {
                if (Module.Rules.bPrecompile)
                {
                    if (Module.GeneratedCodeDirectory != null && DirectoryReference.Exists(Module.GeneratedCodeDirectory))
                    {
                        foreach (FileReference GeneratedCodeFile in DirectoryReference.EnumerateFiles(Module.GeneratedCodeDirectory))
                        {
                            // Exclude timestamp files, since they're always updated and cause collisions between builds
                            if (!GeneratedCodeFile.GetFileName().Equals("Timestamp", StringComparison.OrdinalIgnoreCase) && !GeneratedCodeFile.HasExtension(".cpp"))
                            {
                                BuildProducts.Add(GeneratedCodeFile, BuildProductType.BuildResource);
                            }
                        }
                    }
                    if (Target.LinkType == TargetLinkType.Monolithic)
                    {
                        FileReference PrecompiledManifestLocation = Module.PrecompiledManifestLocation;
                        BuildProducts.Add(PrecompiledManifestLocation, BuildProductType.BuildResource);

                        PrecompiledManifest ModuleManifest = PrecompiledManifest.Read(PrecompiledManifestLocation);
                        foreach (FileReference OutputFile in ModuleManifest.OutputFiles)
                        {
                            if (!BuildProducts.ContainsKey(OutputFile))
                            {
                                BuildProducts.Add(OutputFile, BuildProductType.BuildResource);
                            }
                        }
                    }
                }
            }

            // Add all the binary outputs
            if (!Target.bDisableLinking)
            {
                // Get the type of build products we're creating
                BuildProductType OutputType = BuildProductType.RequiredResource;
                switch (Type)
                {
                case UEBuildBinaryType.Executable:
                    OutputType = BuildProductType.Executable;
                    break;

                case UEBuildBinaryType.DynamicLinkLibrary:
                    OutputType = BuildProductType.DynamicLibrary;
                    break;

                case UEBuildBinaryType.StaticLibrary:
                    OutputType = BuildProductType.BuildResource;
                    break;
                }

                // Add the primary build products
                string[] DebugExtensions = UEBuildPlatform.GetBuildPlatform(Target.Platform).GetDebugInfoExtensions(Target, Type);
                foreach (FileReference OutputFilePath in OutputFilePaths)
                {
                    AddBuildProductAndDebugFiles(OutputFilePath, OutputType, DebugExtensions, BuildProducts, ToolChain, bCreateDebugInfo);
                }

                // Add the console app, if there is one
                if (Type == UEBuildBinaryType.Executable && bBuildAdditionalConsoleApp)
                {
                    foreach (FileReference OutputFilePath in OutputFilePaths)
                    {
                        AddBuildProductAndDebugFiles(GetAdditionalConsoleAppPath(OutputFilePath), OutputType, DebugExtensions, BuildProducts, ToolChain, bCreateDebugInfo);
                    }
                }

                // Add any additional build products from the modules in this binary, including additional bundle resources/dylibs on Mac.
                List <string> Libraries = new List <string>();
                List <UEBuildBundleResource> BundleResources = new List <UEBuildBundleResource>();
                GatherAdditionalResources(Libraries, BundleResources);

                // Add any extra files from the toolchain
                ToolChain.ModifyBuildProducts(Target, this, Libraries, BundleResources, BuildProducts);
            }
        }
Пример #26
0
        /// <summary>
        /// Main entry point
        /// </summary>
        /// <param name="Arguments">Command-line arguments</param>
        /// <returns>One of the values of ECompilationResult</returns>
        public override int Execute(CommandLineArguments Arguments)
        {
            Arguments.ApplyTo(this);

            // Create the build configuration object, and read the settings
            BuildConfiguration BuildConfiguration = new BuildConfiguration();

            XmlConfig.ApplyTo(BuildConfiguration);
            Arguments.ApplyTo(BuildConfiguration);

            // Parse all the targets being built
            List <TargetDescriptor> TargetDescriptors = TargetDescriptor.ParseCommandLine(Arguments, BuildConfiguration.bUsePrecompiled, bSkipRulesCompile);

            if (TargetDescriptors.Count == 0)
            {
                throw new BuildException("No targets specified to clean");
            }

            // Also add implicit descriptors for cleaning UnrealBuildTool
            if (!BuildConfiguration.bDoNotBuildUHT)
            {
                const string UnrealHeaderToolTarget = "UnrealHeaderTool";

                // Get a list of project files to clean UHT for
                List <FileReference> ProjectFiles = new List <FileReference>();
                foreach (TargetDescriptor TargetDesc in TargetDescriptors)
                {
                    if (TargetDesc.Name != UnrealHeaderToolTarget && !RemoteMac.HandlesTargetPlatform(TargetDesc.Platform))
                    {
                        if (ProjectFiles.Count == 0)
                        {
                            ProjectFiles.Add(null);
                        }
                        if (TargetDesc.ProjectFile != null && !ProjectFiles.Contains(TargetDesc.ProjectFile))
                        {
                            ProjectFiles.Add(TargetDesc.ProjectFile);
                        }
                    }
                }

                // Add descriptors for cleaning UHT with all these projects
                if (ProjectFiles.Count > 0)
                {
                    UnrealTargetConfiguration Configuration = BuildConfiguration.bForceDebugUnrealHeaderTool ? UnrealTargetConfiguration.Debug : UnrealTargetConfiguration.Development;
                    string Architecture = UEBuildPlatform.GetBuildPlatform(BuildHostPlatform.Current.Platform).GetDefaultArchitecture(null);
                    foreach (FileReference ProjectFile in ProjectFiles)
                    {
                        TargetDescriptors.Add(new TargetDescriptor(ProjectFile, UnrealHeaderToolTarget, BuildHostPlatform.Current.Platform, Configuration, Architecture, null));
                    }
                }
            }

            // Output the list of targets that we're cleaning
            Log.TraceInformation("Cleaning {0} binaries...", StringUtils.FormatList(TargetDescriptors.Select(x => x.Name).Distinct()));

            // Loop through all the targets, and clean them all
            HashSet <FileReference>      FilesToDelete       = new HashSet <FileReference>();
            HashSet <DirectoryReference> DirectoriesToDelete = new HashSet <DirectoryReference>();

            foreach (TargetDescriptor TargetDescriptor in TargetDescriptors)
            {
                // Create the rules assembly
                RulesAssembly RulesAssembly = RulesCompiler.CreateTargetRulesAssembly(TargetDescriptor.ProjectFile, TargetDescriptor.Name, bSkipRulesCompile, BuildConfiguration.bUsePrecompiled, TargetDescriptor.ForeignPlugin);

                // Create the rules object
                ReadOnlyTargetRules Target = new ReadOnlyTargetRules(RulesAssembly.CreateTargetRules(TargetDescriptor.Name, TargetDescriptor.Platform, TargetDescriptor.Configuration, TargetDescriptor.Architecture, TargetDescriptor.ProjectFile, TargetDescriptor.AdditionalArguments));

                // Find the base folders that can contain binaries
                List <DirectoryReference> BaseDirs = new List <DirectoryReference>();
                BaseDirs.Add(UnrealBuildTool.EngineDirectory);
                BaseDirs.Add(UnrealBuildTool.EnterpriseDirectory);
                foreach (FileReference Plugin in Plugins.EnumeratePlugins(Target.ProjectFile))
                {
                    BaseDirs.Add(Plugin.Directory);
                }
                if (Target.ProjectFile != null)
                {
                    BaseDirs.Add(Target.ProjectFile.Directory);
                }

                // If we're running a precompiled build, remove anything under the engine folder
                BaseDirs.RemoveAll(x => RulesAssembly.IsReadOnly(x));

                // Get all the names which can prefix build products
                List <string> NamePrefixes = new List <string>();
                if (Target.Type != TargetType.Program)
                {
                    NamePrefixes.Add(UEBuildTarget.GetAppNameForTargetType(Target.Type));
                }
                NamePrefixes.Add(Target.Name);

                // Get the suffixes for this configuration
                List <string> NameSuffixes = new List <string>();
                if (Target.Configuration == Target.UndecoratedConfiguration)
                {
                    NameSuffixes.Add("");
                }
                NameSuffixes.Add(String.Format("-{0}-{1}", Target.Platform.ToString(), Target.Configuration.ToString()));
                if (!String.IsNullOrEmpty(Target.Architecture))
                {
                    NameSuffixes.AddRange(NameSuffixes.ToArray().Select(x => x + Target.Architecture));
                }

                // Add all the makefiles and caches to be deleted
                FilesToDelete.Add(TargetMakefile.GetLocation(Target.ProjectFile, Target.Name, Target.Platform, Target.Configuration));
                FilesToDelete.UnionWith(SourceFileMetadataCache.GetFilesToClean(Target.ProjectFile));
                FilesToDelete.UnionWith(ActionHistory.GetFilesToClean(Target.ProjectFile, Target.Name, Target.Platform, Target.Type));

                // Add all the intermediate folders to be deleted
                foreach (DirectoryReference BaseDir in BaseDirs)
                {
                    foreach (string NamePrefix in NamePrefixes)
                    {
                        DirectoryReference GeneratedCodeDir = DirectoryReference.Combine(BaseDir, "Intermediate", "Build", Target.Platform.ToString(), NamePrefix, "Inc");
                        if (DirectoryReference.Exists(GeneratedCodeDir))
                        {
                            DirectoriesToDelete.Add(GeneratedCodeDir);
                        }

                        DirectoryReference IntermediateDir = DirectoryReference.Combine(BaseDir, "Intermediate", "Build", Target.Platform.ToString(), NamePrefix, Target.Configuration.ToString());
                        if (DirectoryReference.Exists(IntermediateDir))
                        {
                            DirectoriesToDelete.Add(IntermediateDir);
                        }
                    }
                }

                // List of additional files and directories to clean, specified by the target platform
                List <FileReference>      AdditionalFilesToDelete       = new List <FileReference>();
                List <DirectoryReference> AdditionalDirectoriesToDelete = new List <DirectoryReference>();

                // Add all the build products from this target
                string[] NamePrefixesArray = NamePrefixes.Distinct().ToArray();
                string[] NameSuffixesArray = NameSuffixes.Distinct().ToArray();
                foreach (DirectoryReference BaseDir in BaseDirs)
                {
                    DirectoryReference BinariesDir = DirectoryReference.Combine(BaseDir, "Binaries", Target.Platform.ToString());
                    if (DirectoryReference.Exists(BinariesDir))
                    {
                        UEBuildPlatform.GetBuildPlatform(Target.Platform).FindBuildProductsToClean(BinariesDir, NamePrefixesArray, NameSuffixesArray, AdditionalFilesToDelete, AdditionalDirectoriesToDelete);
                    }
                }

                // Get all the additional intermediate folders created by this platform
                UEBuildPlatform.GetBuildPlatform(Target.Platform).FindAdditionalBuildProductsToClean(Target, AdditionalFilesToDelete, AdditionalDirectoriesToDelete);

                // Add the platform's files and directories to the main list
                FilesToDelete.UnionWith(AdditionalFilesToDelete);
                DirectoriesToDelete.UnionWith(AdditionalDirectoriesToDelete);
            }

            // Delete all the directories, then all the files. By sorting the list of directories before we delete them, we avoid spamming the log if a parent directory is deleted first.
            foreach (DirectoryReference DirectoryToDelete in DirectoriesToDelete.OrderBy(x => x.FullName))
            {
                if (DirectoryReference.Exists(DirectoryToDelete))
                {
                    Log.TraceVerbose("    Deleting {0}{1}...", DirectoryToDelete, Path.DirectorySeparatorChar);
                    try
                    {
                        DirectoryReference.Delete(DirectoryToDelete, true);
                    }
                    catch (Exception Ex)
                    {
                        throw new BuildException(Ex, "Unable to delete {0} ({1})", DirectoryToDelete, Ex.Message.TrimEnd());
                    }
                }
            }

            foreach (FileReference FileToDelete in FilesToDelete.OrderBy(x => x.FullName))
            {
                if (FileReference.Exists(FileToDelete))
                {
                    Log.TraceVerbose("    Deleting " + FileToDelete);
                    try
                    {
                        FileReference.Delete(FileToDelete);
                    }
                    catch (Exception Ex)
                    {
                        throw new BuildException(Ex, "Unable to delete {0} ({1})", FileToDelete, Ex.Message.TrimEnd());
                    }
                }
            }

            // Also clean all the remote targets
            for (int Idx = 0; Idx < TargetDescriptors.Count; Idx++)
            {
                TargetDescriptor TargetDescriptor = TargetDescriptors[Idx];
                if (RemoteMac.HandlesTargetPlatform(TargetDescriptor.Platform))
                {
                    RemoteMac RemoteMac = new RemoteMac(TargetDescriptor.ProjectFile);
                    RemoteMac.Clean(TargetDescriptor);
                }
            }

            return(0);
        }
Пример #27
0
        /// <summary>
        /// Returns all the excluded folder names for a given platform
        /// </summary>
        /// <param name="Platform">The platform to get the excluded folder names for</param>
        /// <returns>Array of folder names</returns>
        public static FileSystemName[] GetExcludedFolderNames(UnrealTargetPlatform Platform)
        {
            UEBuildPlatform BuildPlatform = UEBuildPlatform.GetBuildPlatform(Platform, false);

            return(BuildPlatform.GetExcludedFolderNames());
        }
Пример #28
0
 /// <summary>
 /// Check whether the given platform supports XGE
 /// </summary>
 /// <param name="Platform">Platform to check</param>
 /// <returns>True if the platform supports XGE</returns>
 public static bool CanUseXGE(UnrealTargetPlatform Platform)
 {
     return(UEBuildPlatform.IsPlatformAvailable(Platform) && UEBuildPlatform.GetBuildPlatform(Platform).CanUseXGE());
 }
Пример #29
0
 /// <summary>
 /// Returns an array of all platform folder names
 /// </summary>
 /// <returns>All platform folder names</returns>
 public static FileSystemName[] GetPlatformFolderNames()
 {
     return(UEBuildPlatform.GetPlatformFolderNames());
 }
Пример #30
0
        /// <summary>
        /// Checks whether the given project has a default build configuration
        /// </summary>
        /// <param name="ProjectFile">The project file</param>
        /// <param name="Platform">Platform to check settings for</param>
        /// <returns>True if the project uses the default build configuration</returns>
        public static bool HasDefaultBuildConfig(FileReference ProjectFile, UnrealTargetPlatform Platform)
        {
            UEBuildPlatform BuildPlat = UEBuildPlatform.GetBuildPlatform(Platform, true);

            return((BuildPlat == null)? true : BuildPlat.HasDefaultBuildConfig(Platform, ProjectFile.Directory));
        }
Пример #31
0
		protected void AddPrerequisiteSourceFile(UEBuildTarget Target, UEBuildPlatform BuildPlatform, CPPEnvironment CompileEnvironment, FileItem SourceFile, List<FileItem> PrerequisiteItems)
		{
			PrerequisiteItems.Add(SourceFile);

			RemoteToolChain RemoteThis = this as RemoteToolChain;
			bool bAllowUploading = RemoteThis != null && BuildHostPlatform.Current.Platform != UnrealTargetPlatform.Mac;	// Don't use remote features when compiling from a Mac
			if (bAllowUploading)
			{
				RemoteThis.QueueFileForBatchUpload(SourceFile);
			}

			if (!BuildConfiguration.bUseUBTMakefiles)	// In fast build iteration mode, we'll gather includes later on
			{
				// @todo ubtmake: What if one of the prerequisite files has become missing since it was updated in our cache? (usually, because a coder eliminated the source file)
				//		-> Two CASES:
				//				1) NOT WORKING: Non-unity file went away (SourceFile in this context).  That seems like an existing old use case.  Compile params or Response file should have changed?
				//				2) WORKING: Indirect file went away (unity'd original source file or include).  This would return a file that no longer exists and adds to the prerequiteitems list
				List<FileItem> IncludedFileList = CPPEnvironment.FindAndCacheAllIncludedFiles(Target, SourceFile, BuildPlatform, CompileEnvironment.Config.CPPIncludeInfo, bOnlyCachedDependencies: BuildConfiguration.bUseUBTMakefiles);
				if (IncludedFileList != null)
				{
					foreach (FileItem IncludedFile in IncludedFileList)
					{
						PrerequisiteItems.Add(IncludedFile);

						if (bAllowUploading &&
							!BuildConfiguration.bUseUBTMakefiles)	// With fast dependency scanning, we will not have an exhaustive list of dependencies here.  We rely on PostCodeGeneration() to upload these files.
						{
							RemoteThis.QueueFileForBatchUpload(IncludedFile);
						}
					}
				}
			}
		}
Пример #32
0
 /**
  *	Register the given platforms UEBuildPlatform instance
  *
  *	@param	InPlatform			The UnrealTargetPlatform to register with
  *	@param	InBuildPlatform		The UEBuildPlatform instance to use for the InPlatform
  */
 public static void RegisterBuildPlatform(UnrealTargetPlatform InPlatform, UEBuildPlatform InBuildPlatform)
 {
     if (BuildPlatformDictionary.ContainsKey(InPlatform) == true)
     {
         Log.TraceWarning("RegisterBuildPlatform Warning: Registering build platform {0} for {1} when it is already set to {2}",
             InBuildPlatform.ToString(), InPlatform.ToString(), BuildPlatformDictionary[InPlatform].ToString());
         BuildPlatformDictionary[InPlatform] = InBuildPlatform;
     }
     else
     {
         BuildPlatformDictionary.Add(InPlatform, InBuildPlatform);
     }
 }
Пример #33
0
		private static FileItem CachePCHUsageForCPPFile(UEBuildTarget Target, FileItem CPPFile, UEBuildPlatform BuildPlatform, List<string> IncludePathsToSearch, Dictionary<string, FileItem> IncludeFileSearchDictionary)
		{
			// @todo ubtmake: We don't really need to scan every file looking for PCH headers, just need one.  The rest is just for error checking.
			// @todo ubtmake: We don't need all of the direct includes either.  We just need the first, unless we want to check for errors.
			List<DependencyInclude> DirectIncludeFilenames = CPPEnvironment.GetDirectIncludeDependencies(Target, CPPFile, BuildPlatform, bOnlyCachedDependencies: false);
			if (BuildConfiguration.bPrintDebugInfo)
			{
				Log.TraceVerbose("Found direct includes for {0}: {1}", Path.GetFileName(CPPFile.AbsolutePath), string.Join(", ", DirectIncludeFilenames.Select(F => F.IncludeName)));
			}

			if (DirectIncludeFilenames.Count == 0)
			{
				return null;
			}

			DependencyInclude FirstInclude = DirectIncludeFilenames[0];

			// The pch header should always be the first include in the source file.
			// NOTE: This is not an absolute path.  This is just the literal include string from the source file!
			CPPFile.PCHHeaderNameInCode = FirstInclude.IncludeName;

			// Resolve the PCH header to an absolute path.
			// Check NullOrEmpty here because if the file could not be resolved we need to throw an exception
			if (FirstInclude.IncludeResolvedNameIfSuccessful != null &&
				// ignore any preexisting resolve cache if we are not configured to use it.
				BuildConfiguration.bUseIncludeDependencyResolveCache &&
				// if we are testing the resolve cache, we force UBT to resolve every time to look for conflicts
				!BuildConfiguration.bTestIncludeDependencyResolveCache)
			{
				CPPFile.PrecompiledHeaderIncludeFilename = FirstInclude.IncludeResolvedNameIfSuccessful;
				return FileItem.GetItemByFileReference(CPPFile.PrecompiledHeaderIncludeFilename);
			}

			// search the include paths to resolve the file.
			FileItem PrecompiledHeaderIncludeFile = CPPEnvironment.FindIncludedFile(CPPFile.PCHHeaderNameInCode, !BuildConfiguration.bCheckExternalHeadersForModification, IncludePathsToSearch, IncludeFileSearchDictionary);
			if (PrecompiledHeaderIncludeFile == null)
			{
				throw new BuildException("The first include statement in source file '{0}' is trying to include the file '{1}' as the precompiled header, but that file could not be located in any of the module's include search paths.", CPPFile.AbsolutePath, CPPFile.PCHHeaderNameInCode);
			}

			CPPEnvironment.IncludeDependencyCache[Target].CacheResolvedIncludeFullPath(CPPFile, 0, PrecompiledHeaderIncludeFile.Reference);
			CPPFile.PrecompiledHeaderIncludeFilename = PrecompiledHeaderIncludeFile.Reference;

			return PrecompiledHeaderIncludeFile;
		}