/// <summary> /// Generates a list of all modules referenced by this binary /// </summary> /// <param name="ReferencedBy">Map of module to the module that referenced it</param> /// <returns>List of all referenced modules</returns> public void FindModuleReferences(Dictionary <UEBuildModule, UEBuildModule> ReferencedBy) { List <UEBuildModule> ReferencedModules = new List <UEBuildModule>(); foreach (UEBuildModule Module in Modules) { ReferencedModules.Add(Module); ReferencedBy.Add(Module, null); } List <UEBuildModule> DirectlyReferencedModules = new List <UEBuildModule>(); HashSet <UEBuildModule> VisitedModules = new HashSet <UEBuildModule>(); for (int Idx = 0; Idx < ReferencedModules.Count; Idx++) { UEBuildModule SourceModule = ReferencedModules[Idx]; // Find all the direct references from this module DirectlyReferencedModules.Clear(); SourceModule.GetAllDependencyModules(DirectlyReferencedModules, VisitedModules, false, false, true); // Set up the references for all the new modules foreach (UEBuildModule DirectlyReferencedModule in DirectlyReferencedModules) { if (!ReferencedBy.ContainsKey(DirectlyReferencedModule)) { ReferencedBy.Add(DirectlyReferencedModule, SourceModule); ReferencedModules.Add(DirectlyReferencedModule); } } } }
/** * Modify the newly created module passed in for this platform. * This is not required - but allows for hiding details of a * particular platform. * * @param InModule The newly loaded module * @param Target The target being build */ public override void ModifyNewlyLoadedModule(UEBuildModule InModule, TargetInfo Target) { if (Target.Platform == UnrealTargetPlatform.HTML5) { if (InModule.ToString() == "Core") { InModule.AddPublicIncludePath("Runtime/Core/Public/HTML5"); InModule.AddPublicDependencyModule("zlib"); } else if (InModule.ToString() == "Engine") { InModule.AddPrivateDependencyModule("zlib"); InModule.AddPrivateDependencyModule("UElibPNG"); InModule.AddPublicDependencyModule("UEOgg"); InModule.AddPublicDependencyModule("Vorbis"); } } else if (Target.Platform == UnrealTargetPlatform.Win32 || Target.Platform == UnrealTargetPlatform.Win64 || Target.Platform == UnrealTargetPlatform.Mac) { // allow standalone tools to use targetplatform modules, without needing Engine if ((!UEBuildConfiguration.bBuildRequiresCookedData && InModule.ToString() == "Engine" && UEBuildConfiguration.bBuildDeveloperTools) || UEBuildConfiguration.bForceBuildTargetPlatforms) { InModule.AddPlatformSpecificDynamicallyLoadedModule("HTML5TargetPlatform"); } } }
/// <summary> /// Adds a module to the binary. /// </summary> /// <param name="Module">The module to add</param> public void AddModule(UEBuildModule Module) { if (!Modules.Contains(Module)) { Modules.Add(Module); } }
public override void ModifyNewlyLoadedModule(UEBuildModule InModule, TargetInfo Target) { if (Target.Platform == UnrealTargetPlatform.Mac) { bool bBuildShaderFormats = UEBuildConfiguration.bForceBuildShaderFormats; if (!UEBuildConfiguration.bBuildRequiresCookedData) { if (InModule.ToString() == "TargetPlatform") { bBuildShaderFormats = true; } } // allow standalone tools to use target platform modules, without needing Engine if (UEBuildConfiguration.bForceBuildTargetPlatforms) { InModule.AddDynamicallyLoadedModule("MacTargetPlatform"); InModule.AddDynamicallyLoadedModule("MacNoEditorTargetPlatform"); InModule.AddDynamicallyLoadedModule("MacClientTargetPlatform"); InModule.AddDynamicallyLoadedModule("MacServerTargetPlatform"); } if (bBuildShaderFormats) { InModule.AddDynamicallyLoadedModule("ShaderFormatOpenGL"); } } }
/// <summary> /// Checks whether the binary output paths are appropriate for the distribution /// level of its direct module dependencies /// </summary> public bool CheckRestrictedFolders(DirectoryReference ProjectDir, Dictionary <UEBuildModule, Dictionary <RestrictedFolder, DirectoryReference> > ModuleRestrictedFolderCache) { // Find all the modules we depend on Dictionary <UEBuildModule, UEBuildModule> ModuleReferencedBy = new Dictionary <UEBuildModule, UEBuildModule>(); FindModuleReferences(ModuleReferencedBy); // Loop through each of the output binaries and check them separately bool bResult = true; foreach (FileReference OutputFilePath in OutputFilePaths) { // Find the base directory for this binary DirectoryReference BaseDir; if (OutputFilePath.IsUnderDirectory(UnrealBuildTool.EngineDirectory)) { BaseDir = UnrealBuildTool.EngineDirectory; } else if (ProjectDir != null && OutputFilePath.IsUnderDirectory(ProjectDir)) { BaseDir = ProjectDir; } else { continue; } // Find the permitted restricted folder references under the base directory List <RestrictedFolder> BinaryFolders = RestrictedFolders.FindPermittedRestrictedFolderReferences(BaseDir, OutputFilePath.Directory); // Check all the dependent modules foreach (UEBuildModule Module in ModuleReferencedBy.Keys) { // Find the restricted folders for this module Dictionary <RestrictedFolder, DirectoryReference> ModuleRestrictedFolders; if (!ModuleRestrictedFolderCache.TryGetValue(Module, out ModuleRestrictedFolders)) { ModuleRestrictedFolders = Module.FindRestrictedFolderReferences(ProjectDir); ModuleRestrictedFolderCache.Add(Module, ModuleRestrictedFolders); } // Write errors for any missing paths in the output files foreach (KeyValuePair <RestrictedFolder, DirectoryReference> Pair in ModuleRestrictedFolders) { if (!BinaryFolders.Contains(Pair.Key)) { List <string> ReferenceChain = new List <string>(); for (UEBuildModule ReferencedModule = Module; ReferencedModule != null; ReferencedModule = ModuleReferencedBy[ReferencedModule]) { ReferenceChain.Insert(0, ReferencedModule.Name); } Log.TraceError("Output binary \"{0}\" is not in a {1} folder, but references \"{2}\" via {3}.", OutputFilePath, Pair.Key.ToString(), Pair.Value, String.Join(" -> ", ReferenceChain)); bResult = false; } } } } return(bResult); }
public override void ModifyNewlyLoadedModule(UEBuildModule InModule, TargetInfo Target) { if ((Target.Platform == UnrealTargetPlatform.Win32) || (Target.Platform == UnrealTargetPlatform.Win64)) { bool bBuildShaderFormats = UEBuildConfiguration.bForceBuildShaderFormats; if (!UEBuildConfiguration.bBuildRequiresCookedData) { if (InModule.ToString() == "Engine") { if (UEBuildConfiguration.bBuildDeveloperTools) { InModule.AddPlatformSpecificDynamicallyLoadedModule("AndroidTargetPlatform"); InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_PVRTCTargetPlatform"); InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_ATCTargetPlatform"); InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_DXTTargetPlatform"); InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_ETC1TargetPlatform"); InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_ETC2TargetPlatform"); // InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_GL4TargetPlatform"); // @todo es31: Put this back in for ES31 support // ES31 code is in, but it's not fully supported in UE4 4.5, so for now we need to disable the targetplatform as it will confuse people greatly // InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_ES31TargetPlatform"); } } else if (InModule.ToString() == "TargetPlatform") { bBuildShaderFormats = true; InModule.AddDynamicallyLoadedModule("TextureFormatPVR"); InModule.AddDynamicallyLoadedModule("TextureFormatDXT"); InModule.AddPlatformSpecificDynamicallyLoadedModule("TextureFormatAndroid"); // ATITC, ETC1 and ETC2 if (UEBuildConfiguration.bBuildDeveloperTools) { //InModule.AddDynamicallyLoadedModule("AudioFormatADPCM"); //@todo android: android audio } } } // allow standalone tools to use targetplatform modules, without needing Engine if (UEBuildConfiguration.bForceBuildTargetPlatforms) { InModule.AddPlatformSpecificDynamicallyLoadedModule("AndroidTargetPlatform"); InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_PVRTCTargetPlatform"); InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_ATCTargetPlatform"); InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_DXTTargetPlatform"); InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_ETC1TargetPlatform"); InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_ETC2TargetPlatform"); // InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_GL4TargetPlatform"); // @todo es31: Put this back in for ES31 support // ES31 code is in, but it's not fully supported in UE4 4.5, so for now we need to disable the targetplatform as it will confuse people greatly // InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_ES31TargetPlatform"); } if (bBuildShaderFormats) { //InModule.AddDynamicallyLoadedModule("ShaderFormatAndroid"); //@todo android: ShaderFormatAndroid } } }
public override void ModifyNewlyLoadedModule(UEBuildModule InModule, TargetInfo Target) { if ((Target.Platform == UnrealTargetPlatform.Win32) || (Target.Platform == UnrealTargetPlatform.Win64) || (Target.Platform == UnrealTargetPlatform.Mac)) { bool bBuildShaderFormats = UEBuildConfiguration.bForceBuildShaderFormats; if (!UEBuildConfiguration.bBuildRequiresCookedData) { if (InModule.ToString() == "Engine") { if (UEBuildConfiguration.bBuildDeveloperTools) { InModule.AddPlatformSpecificDynamicallyLoadedModule("AndroidTargetPlatform"); InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_PVRTCTargetPlatform"); InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_ATCTargetPlatform"); InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_DXTTargetPlatform"); InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_ETC1TargetPlatform"); InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_ETC2TargetPlatform"); InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_ES31TargetPlatform"); // @todo gl4android // InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_GL4TargetPlatform"); } } else if (InModule.ToString() == "TargetPlatform") { bBuildShaderFormats = true; InModule.AddDynamicallyLoadedModule("TextureFormatPVR"); InModule.AddDynamicallyLoadedModule("TextureFormatDXT"); InModule.AddDynamicallyLoadedModule("TextureFormatASTC"); InModule.AddPlatformSpecificDynamicallyLoadedModule("TextureFormatAndroid"); // ATITC, ETC1 and ETC2 if (UEBuildConfiguration.bBuildDeveloperTools) { //InModule.AddDynamicallyLoadedModule("AudioFormatADPCM"); //@todo android: android audio } } } // allow standalone tools to use targetplatform modules, without needing Engine if (UEBuildConfiguration.bForceBuildTargetPlatforms) { InModule.AddPlatformSpecificDynamicallyLoadedModule("AndroidTargetPlatform"); InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_PVRTCTargetPlatform"); InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_ATCTargetPlatform"); InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_DXTTargetPlatform"); InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_ETC1TargetPlatform"); InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_ETC2TargetPlatform"); InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_ES31TargetPlatform"); // @todo gl4android // InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_GL4TargetPlatform"); } if (bBuildShaderFormats) { //InModule.AddDynamicallyLoadedModule("ShaderFormatAndroid"); //@todo android: ShaderFormatAndroid } } }
/// <summary> /// Process all modules that aren't yet bound, creating binaries for modules that don't yet have one (if needed), /// and updating modules for circular dependencies. /// </summary> /// <returns>List of newly-created binaries (may be empty)</returns> public override void ProcessUnboundModules() { if (Config.bHasModuleRules) { // Modules may be added to this binary during this process, so don't foreach over ModuleNames for (int Idx = 0; Idx < ModuleNames.Count; Idx++) { UEBuildModule Module = Target.FindOrCreateModuleByName(ModuleNames[Idx]); Module.RecursivelyProcessUnboundModules(); } } }
/** * Modify the newly created module passed in for this platform. * This is not required - but allows for hiding details of a * particular platform. * * @param InModule The newly loaded module * @param Target The target being build */ public override void ModifyNewlyLoadedModule(UEBuildModule InModule, TargetInfo Target) { if ((Target.Platform == UnrealTargetPlatform.Win32) || (Target.Platform == UnrealTargetPlatform.Win64)) { if (!UEBuildConfiguration.bBuildRequiresCookedData) { if (InModule.ToString() == "Engine") { if (UEBuildConfiguration.bBuildDeveloperTools) { InModule.AddPlatformSpecificDynamicallyLoadedModule("LinuxTargetPlatform"); InModule.AddPlatformSpecificDynamicallyLoadedModule("LinuxNoEditorTargetPlatform"); InModule.AddPlatformSpecificDynamicallyLoadedModule("LinuxServerTargetPlatform"); } } } // allow standalone tools to use targetplatform modules, without needing Engine if (UEBuildConfiguration.bForceBuildTargetPlatforms) { InModule.AddPlatformSpecificDynamicallyLoadedModule("LinuxTargetPlatform"); InModule.AddPlatformSpecificDynamicallyLoadedModule("LinuxNoEditorTargetPlatform"); InModule.AddPlatformSpecificDynamicallyLoadedModule("LinuxServerTargetPlatform"); } } else if (Target.Platform == UnrealTargetPlatform.Linux) { bool bBuildShaderFormats = UEBuildConfiguration.bForceBuildShaderFormats; if (!UEBuildConfiguration.bBuildRequiresCookedData) { if (InModule.ToString() == "TargetPlatform") { bBuildShaderFormats = true; } } // allow standalone tools to use target platform modules, without needing Engine if (UEBuildConfiguration.bForceBuildTargetPlatforms) { InModule.AddDynamicallyLoadedModule("LinuxTargetPlatform"); InModule.AddDynamicallyLoadedModule("LinuxNoEditorTargetPlatform"); InModule.AddDynamicallyLoadedModule("LinuxServerTargetPlatform"); InModule.AddDynamicallyLoadedModule("AllDesktopTargetPlatform"); } if (bBuildShaderFormats) { // InModule.AddDynamicallyLoadedModule("ShaderFormatD3D"); InModule.AddDynamicallyLoadedModule("ShaderFormatOpenGL"); } } }
public override void ModifyNewlyLoadedModule(UEBuildModule InModule, TargetInfo Target) { if ((Target.Platform == UnrealTargetPlatform.Win32) || (Target.Platform == UnrealTargetPlatform.Win64)) { bool bBuildShaderFormats = UEBuildConfiguration.bForceBuildShaderFormats; if (!UEBuildConfiguration.bBuildRequiresCookedData) { if (InModule.ToString() == "TargetPlatform") { bBuildShaderFormats = true; } } // allow standalone tools to use target platform modules, without needing Engine if (UEBuildConfiguration.bForceBuildTargetPlatforms) { InModule.AddDynamicallyLoadedModule("WindowsTargetPlatform"); InModule.AddDynamicallyLoadedModule("WindowsNoEditorTargetPlatform"); InModule.AddDynamicallyLoadedModule("WindowsServerTargetPlatform"); InModule.AddDynamicallyLoadedModule("WindowsClientTargetPlatform"); InModule.AddDynamicallyLoadedModule("AllDesktopTargetPlatform"); } if (bBuildShaderFormats) { InModule.AddDynamicallyLoadedModule("ShaderFormatD3D"); InModule.AddDynamicallyLoadedModule("ShaderFormatOpenGL"); //#todo-rco: Remove when public { string VulkanSDKPath = Environment.GetEnvironmentVariable("VulkanSDK"); if (!String.IsNullOrEmpty(VulkanSDKPath)) { InModule.AddDynamicallyLoadedModule("VulkanShaderFormat"); } } } if (InModule.ToString() == "D3D11RHI") { // To enable platform specific D3D11 RHI Types InModule.AddPrivateIncludePath("Runtime/Windows/D3D11RHI/Private/Windows"); } if (InModule.ToString() == "D3D12RHI") { // To enable platform specific D3D12 RHI Types InModule.AddPrivateIncludePath("Runtime/Windows/D3D12RHI/Private/Windows"); } } }
private static void RecursivelyCreateIncludePathModulesByName(List <string> ModuleNames, ref List <UEBuildModule> Modules, CreateModuleDelegate CreateModule, string ReferenceChain) { // Check whether the module list is already set. We set this immediately (via the ref) to avoid infinite recursion. if (Modules == null) { Modules = new List <UEBuildModule>(); foreach (string ModuleName in ModuleNames) { UEBuildModule Module = CreateModule(ModuleName, ReferenceChain); RecursivelyCreateIncludePathModulesByName(Module.Rules.PublicIncludePathModuleNames, ref Module.PublicIncludePathModules, CreateModule, ReferenceChain); Modules.Add(Module); } } }
public override List <UEBuildModule> FindGameModules() { var GameModules = new List <UEBuildModule>(); foreach (var ModuleName in ModuleNames) { UEBuildModule Module = Target.GetModuleByName(ModuleName); if (!Utils.IsFileUnderDirectory(Module.ModuleDirectory, BuildConfiguration.RelativeEnginePath)) { GameModules.Add(Module); } } return(GameModules); }
/// <summary> /// Overrides base class to add module runtime dependencies to the build receipt. /// </summary> /// <param name="ToolChain">The platform toolchain</param> public override BuildReceipt MakeReceipt(IUEToolChain ToolChain) { BuildReceipt Receipt = base.MakeReceipt(ToolChain); // Set the IsPrecompiled flag on all the build products if we're not actually building this binary if (!Config.bAllowCompilation) { foreach (BuildProduct BuildProduct in Receipt.BuildProducts) { BuildProduct.IsPrecompiled = true; } } // Add the compiled resource file if we're building a static library containing the launch module on Windows if (Config.Type == UEBuildBinaryType.StaticLibrary && ModuleNames.Contains("Launch") && (Target.Platform == UnrealTargetPlatform.Win32 || Target.Platform == UnrealTargetPlatform.Win64)) { string ResourceFilePath = Path.Combine(Config.IntermediateDirectory, "Launch", "PCLaunch.rc.res"); Receipt.AddBuildProduct(ResourceFilePath, BuildProductType.StaticLibrary); } // Add runtime dependencies for all the modules in this binary, and build up a list of all the referenced modules Dictionary <string, UEBuildModule> ReferencedModules = new Dictionary <string, UEBuildModule>(); List <UEBuildModule> OrderedModules = new List <UEBuildModule>(); foreach (string ModuleName in ModuleNames) { UEBuildModule Module = Target.GetModuleByName(ModuleName); foreach (RuntimeDependency RuntimeDependency in Module.RuntimeDependencies) { Receipt.RuntimeDependencies.Add(new RuntimeDependency(RuntimeDependency)); } Module.GetAllDependencyModules(ReferencedModules, OrderedModules, true, false, true); } // Add runtime dependencies for all the referenced external modules. These may be introduce dependencies for the binary without actually being listed for inclusion in it. foreach (UEBuildModule OrderedModule in OrderedModules) { UEBuildExternalModule ExternalModule = OrderedModule as UEBuildExternalModule; if (ExternalModule != null) { foreach (RuntimeDependency RuntimeDependency in ExternalModule.RuntimeDependencies) { Receipt.RuntimeDependencies.Add(new RuntimeDependency(RuntimeDependency)); } } } return(Receipt); }
public override void ModifyNewlyLoadedModule(UEBuildModule InModule, TargetInfo Target) { if ((Target.Platform == UnrealTargetPlatform.UWP)) { if (InModule.ToString() == "Core") { InModule.AddPrivateDependencyModule("UWPSDK"); } else if (InModule.ToString() == "Engine") { InModule.AddPrivateDependencyModule("zlib"); InModule.AddPrivateDependencyModule("UElibPNG"); InModule.AddPublicDependencyModule("UEOgg"); InModule.AddPublicDependencyModule("Vorbis"); } else if (InModule.ToString() == "D3D11RHI") { InModule.AddPublicDefinition("D3D11_WITH_DWMAPI=0"); InModule.AddPublicDefinition("WITH_DX_PERF=0"); } else if (InModule.ToString() == "DX11") { // Clear out all the Windows include paths and libraries... // The UWPSDK module handles proper paths and libs for UWP. // However, the D3D11RHI module will include the DX11 module. InModule.ClearPublicIncludePaths(); InModule.ClearPublicLibraryPaths(); InModule.ClearPublicAdditionalLibraries(); InModule.RemovePublicDefinition("WITH_D3DX_LIBS=1"); InModule.AddPublicDefinition("WITH_D3DX_LIBS=0"); InModule.RemovePublicAdditionalLibrary("X3DAudio.lib"); InModule.RemovePublicAdditionalLibrary("XAPOFX.lib"); } else if (InModule.ToString() == "XAudio2") { InModule.AddPublicDefinition("XAUDIO_SUPPORTS_XMA2WAVEFORMATEX=0"); InModule.AddPublicDefinition("XAUDIO_SUPPORTS_DEVICE_DETAILS=0"); InModule.AddPublicDefinition("XAUDIO2_SUPPORTS_MUSIC=0"); InModule.AddPublicDefinition("XAUDIO2_SUPPORTS_SENDLIST=0"); InModule.AddPublicAdditionalLibrary("XAudio2.lib"); } else if (InModule.ToString() == "DX11Audio") { InModule.RemovePublicAdditionalLibrary("X3DAudio.lib"); InModule.RemovePublicAdditionalLibrary("XAPOFX.lib"); } } }
/// <summary> /// Checks whether the binary output paths are appropriate for the distribution /// level of its direct module dependencies /// </summary> public void CheckOutputDistributionLevelAgainstDependencies(Dictionary <UEBuildModule, UEBuildModuleDistribution> ModuleDistributionCache) { // Find maximum distribution level of its direct dependencies UEBuildModuleDistribution DistributionLevel = UEBuildModuleDistribution.Public; List <UEBuildModule> DependantModules = GetAllDependencyModules(false, false); List <string>[] DependantModuleNames = new List <string> [Enum.GetNames(typeof(UEBuildModuleDistribution)).Length]; foreach (UEBuildModule Module in DependantModules) { UEBuildModuleDistribution ModuleDistributionLevel; if (!ModuleDistributionCache.TryGetValue(Module, out ModuleDistributionLevel)) { ModuleDistributionLevel = Module.DetermineDistributionLevel(); ModuleDistributionCache.Add(Module, ModuleDistributionLevel); } if (ModuleDistributionLevel != UEBuildModuleDistribution.Public) { // Make a list of non-public dependant modules so that exception // message can be more helpful int DistributionIndex = (int)ModuleDistributionLevel; if (DependantModuleNames[DistributionIndex] == null) { DependantModuleNames[DistributionIndex] = new List <string>(); } DependantModuleNames[DistributionIndex].Add(Module.Name); DistributionLevel = Utils.Max(DistributionLevel, ModuleDistributionLevel); } } // Check Output Paths if dependencies shouldn't be distributed to everyone if (DistributionLevel != UEBuildModuleDistribution.Public) { foreach (FileReference OutputFilePath in Config.OutputFilePaths) { UEBuildModuleDistribution OutputDistributionLevel = UEBuildModule.GetModuleDistributionLevelBasedOnLocation(OutputFilePath.FullName); // Throw exception if output path is not appropriate if (OutputDistributionLevel < DistributionLevel) { string JoinedModuleNames = String.Join(",", DependantModuleNames[(int)DistributionLevel]); throw new BuildException("Output file \"{0}\" has distribution level of \"{1}\" but has direct dependencies on modules with distribution level of \"{2}\" ({3}).\nEither change to dynamic dependencies, set BinariesSubFolder/ExeBinariesSubFolder to \"{2}\" or set bOutputPubliclyDistributable to true in the target.cs or build.cs file.", OutputFilePath, OutputDistributionLevel.ToString(), DistributionLevel.ToString(), JoinedModuleNames); } } } }
private static void RecursivelyCreateModulesByName(List <string> ModuleNames, ref List <UEBuildModule> Modules, CreateModuleDelegate CreateModule) { // Check whether the module list is already set. We set this immediately (via the ref) to avoid infinite recursion. if (Modules == null) { Modules = new List <UEBuildModule>(); foreach (string ModuleName in ModuleNames) { UEBuildModule Module = CreateModule(ModuleName); if (!Modules.Contains(Module)) { Module.RecursivelyCreateModules(CreateModule); Modules.Add(Module); } } } }
// UEBuildBinary interface. /// <summary> /// Called to resolve module names and uniquely bind modules to a binary. /// </summary> /// <param name="BuildTarget">The build target the modules are being bound for</param> /// <param name="Target">The target info</param> public override void BindModules() { foreach (var ModuleName in ModuleNames) { UEBuildModule Module = null; if (Config.bHasModuleRules) { Module = Target.FindOrCreateModuleByName(ModuleName); if (Module.Binary == null) { Module.Binary = this; Module.bIncludedInTarget = true; } else if (Module.Binary.Config.Type != UEBuildBinaryType.StaticLibrary) { throw new BuildException("Module \"{0}\" linked into both {1} and {2}, which creates ambiguous linkage for dependents.", ModuleName, Module.Binary.Config.OutputFilePath, Config.OutputFilePath); } } } }
/** * Modify the newly created module passed in for this platform. * This is not required - but allows for hiding details of a * particular platform. * * @param InModule The newly loaded module * @param GameName The game being build * @param Target The target being build */ public override void ModifyNewlyLoadedModule(UEBuildModule InModule, TargetInfo Target) { if ((Target.Platform == UnrealTargetPlatform.Win32) || (Target.Platform == UnrealTargetPlatform.Win64) || (Target.Platform == UnrealTargetPlatform.Mac)) { bool bBuildShaderFormats = UEBuildConfiguration.bForceBuildShaderFormats; if (!UEBuildConfiguration.bBuildRequiresCookedData) { if (InModule.ToString() == "Engine") { if (UEBuildConfiguration.bBuildDeveloperTools) { InModule.AddPlatformSpecificDynamicallyLoadedModule("IOSTargetPlatform"); } } else if (InModule.ToString() == "UnrealEd") { InModule.AddPlatformSpecificDynamicallyLoadedModule("IOSPlatformEditor"); } else if (InModule.ToString() == "TargetPlatform") { bBuildShaderFormats = true; InModule.AddDynamicallyLoadedModule("TextureFormatPVR"); if (UEBuildConfiguration.bBuildDeveloperTools) { InModule.AddPlatformSpecificDynamicallyLoadedModule("AudioFormatADPCM"); } } } // allow standalone tools to use targetplatform modules, without needing Engine if (UEBuildConfiguration.bForceBuildTargetPlatforms) { InModule.AddPlatformSpecificDynamicallyLoadedModule("IOSTargetPlatform"); } if (bBuildShaderFormats) { InModule.AddPlatformSpecificDynamicallyLoadedModule("MetalShaderFormat"); } } }
/// <summary> /// Overrides base class to add module runtime dependencies to the build receipt. /// </summary> /// <param name="ToolChain">The platform toolchain</param> public override BuildReceipt MakeReceipt(IUEToolChain ToolChain) { BuildReceipt Receipt = base.MakeReceipt(ToolChain); // Set the IsPrecompiled flag on all the build products if we're not actually building this binary if (!Config.bAllowCompilation) { foreach (BuildProduct BuildProduct in Receipt.BuildProducts) { BuildProduct.IsPrecompiled = true; } } // Add runtime dependencies for all the modules in this binary, and build up a list of all the referenced modules Dictionary <string, UEBuildModule> ReferencedModules = new Dictionary <string, UEBuildModule>(); List <UEBuildModule> OrderedModules = new List <UEBuildModule>(); foreach (string ModuleName in ModuleNames) { UEBuildModule Module = Target.GetModuleByName(ModuleName); foreach (RuntimeDependency RuntimeDependency in Module.RuntimeDependencies) { Receipt.RuntimeDependencies.Add(new RuntimeDependency(RuntimeDependency)); } Module.GetAllDependencyModules(ReferencedModules, OrderedModules, true, false, true); } // Add runtime dependencies for all the referenced external modules. These may be introduce dependencies for the binary without actually being listed for inclusion in it. foreach (UEBuildModule OrderedModule in OrderedModules) { UEBuildExternalModule ExternalModule = OrderedModule as UEBuildExternalModule; if (ExternalModule != null) { foreach (RuntimeDependency RuntimeDependency in ExternalModule.RuntimeDependencies) { Receipt.RuntimeDependencies.Add(new RuntimeDependency(RuntimeDependency)); } } } return(Receipt); }
// UEBuildBinary interface. /// <summary> /// Called to resolve module names and uniquely bind modules to a binary. /// </summary> /// <param name="BuildTarget">The build target the modules are being bound for</param> /// <param name="Target">The target info</param> public override void BindModules() { foreach (var ModuleName in ModuleNames) { UEBuildModule Module = null; if (Config.bHasModuleRules) { Module = Target.FindOrCreateModuleByName(ModuleName); if (Module.Binary != null) { throw new BuildException("Module \"{0}\" linked into both {1} and {2}, which creates ambiguous linkage for dependents.", ModuleName, Module.Binary.Config.OutputFilePath, Config.OutputFilePath); } Module.Binary = this; Module.bIncludedInTarget = true; } // We set whether the binary is being compiled monolithic here to know later - specifically // when we are determining whether to use SharedPCHs or not for static lib builds of plugins. Config.bCompileMonolithic = Target.ShouldCompileMonolithic(); // We also need to know what the actual build target configuration is later in the process // where we do not have access to the Target itself... This is for generating the paths // to the plugins. Config.TargetConfiguration = Target.Configuration; Config.TargetName = Target.GetAppName(); if (Module != null && (Target.Rules == null || Target.Rules.bOutputToEngineBinaries == false)) { // Fix up the binary path if this is module specifies an alternate output directory for (int Index = 0; Index < Config.OutputFilePaths.Length; Index++) { Config.OutputFilePaths[Index] = Module.FixupOutputPath(Config.OutputFilePaths[Index]); } } } }
public override void ModifyNewlyLoadedModule(UEBuildModule InModule, TargetInfo Target) { if ((Target.Platform == UnrealTargetPlatform.Win32) || (Target.Platform == UnrealTargetPlatform.Win64)) { bool bBuildShaderFormats = UEBuildConfiguration.bForceBuildShaderFormats; if (!UEBuildConfiguration.bBuildRequiresCookedData) { if (InModule.ToString() == "TargetPlatform") { bBuildShaderFormats = true; } } // allow standalone tools to use target platform modules, without needing Engine if (UEBuildConfiguration.bForceBuildTargetPlatforms) { InModule.AddDynamicallyLoadedModule("WindowsTargetPlatform"); InModule.AddDynamicallyLoadedModule("WindowsNoEditorTargetPlatform"); InModule.AddDynamicallyLoadedModule("WindowsServerTargetPlatform"); InModule.AddDynamicallyLoadedModule("WindowsClientTargetPlatform"); } if (bBuildShaderFormats) { InModule.AddDynamicallyLoadedModule("ShaderFormatD3D"); InModule.AddDynamicallyLoadedModule("ShaderFormatOpenGL"); } if (InModule.ToString() == "D3D11RHI") { // To enable platform specific D3D11 RHI Types InModule.AddPrivateIncludePath("Runtime/Windows/D3D11RHI/Private/Windows"); } } }
/** * Modify the newly created module passed in for this platform. * This is not required - but allows for hiding details of a * particular platform. * * @param InModule The newly loaded module * @param Target The target being build */ public override void ModifyNewlyLoadedModule(UEBuildModule InModule, TargetInfo Target) { if (Target.Platform == UnrealTargetPlatform.HTML5) { if (InModule.ToString() == "Core") { InModule.AddPublicIncludePath("Runtime/Core/Public/HTML5"); InModule.AddPublicDependencyModule("zlib"); } else if (InModule.ToString() == "Engine") { InModule.AddPrivateDependencyModule("zlib"); InModule.AddPrivateDependencyModule("UElibPNG"); InModule.AddPublicDependencyModule("UEOgg"); InModule.AddPublicDependencyModule("Vorbis"); } } else if (Target.Platform == UnrealTargetPlatform.Win32 || Target.Platform == UnrealTargetPlatform.Win64 || Target.Platform == UnrealTargetPlatform.Mac ) { // allow standalone tools to use targetplatform modules, without needing Engine if ((!UEBuildConfiguration.bBuildRequiresCookedData && InModule.ToString() == "Engine" && UEBuildConfiguration.bBuildDeveloperTools) || UEBuildConfiguration.bForceBuildTargetPlatforms) { InModule.AddPlatformSpecificDynamicallyLoadedModule("HTML5TargetPlatform"); } } }
/** * Modify the newly created module passed in for this platform. * This is not required - but allows for hiding details of a * particular platform. * * @param InModule The newly loaded module * @param Target The target being build */ public virtual void ModifyNewlyLoadedModule(UEBuildModule InModule, TargetInfo Target) { }
/** * Allow all registered build platforms to modify the newly created module * passed in for the given platform. * This is not required - but allows for hiding details of a particular platform. * * @param InModule The newly loaded module * @param Target The target being build * @param Only If this is not unknown, then only run that platform */ public static void PlatformModifyNewlyLoadedModule(UEBuildModule InModule, TargetInfo Target, UnrealTargetPlatform Only = UnrealTargetPlatform.Unknown) { foreach (var PlatformEntry in BuildPlatformDictionary) { if (Only == UnrealTargetPlatform.Unknown || PlatformEntry.Key == Only || PlatformEntry.Key == Target.Platform) { PlatformEntry.Value.ModifyNewlyLoadedModule(InModule, Target); } } }
/** Registers a module with this target. */ public void RegisterModule(UEBuildModule Module) { Debug.Assert(Module.Target == this); Modules.Add(Module.Name, Module); ModuleCsMap.Add(Module.Name, Module.BuildCsFilename); }
/// <summary> /// Adds a module to the binary. /// </summary> /// <param name="ModuleName">The module to add</param> public virtual void AddModule(UEBuildModule Module) { }
/** * Modify the newly created module passed in for this platform. * This is not required - but allows for hiding details of a * particular platform. * * @param InModule The newly loaded module * @param Target The target being build */ public override void ModifyNewlyLoadedModule(UEBuildModule InModule, TargetInfo Target) { if (Target.Platform == UnrealTargetPlatform.HTML5) { if (InModule.ToString() == "Core") { InModule.AddPublicIncludePath("Runtime/Core/Public/HTML5"); InModule.AddPublicDependencyModule("zlib"); } else if (InModule.ToString() == "Engine") { InModule.AddPrivateDependencyModule("zlib"); InModule.AddPrivateDependencyModule("UElibPNG"); InModule.AddPublicDependencyModule("UEOgg"); InModule.AddPublicDependencyModule("Vorbis"); } if (InModule.ToString() == "NetworkFile") { if (EnableHTTPForNFS) { InModule.AddPublicDefinition("ENABLE_HTTP_FOR_NFS=1"); if (Target.Architecture == "-win32") { InModule.AddPrivateDependencyModule("HTML5Win32"); } else { InModule.AddPrivateDependencyModule("HTML5JS"); } } } } else if (Target.Platform == UnrealTargetPlatform.Win32 || Target.Platform == UnrealTargetPlatform.Win64 || Target.Platform == UnrealTargetPlatform.Mac ) { // allow standalone tools to use targetplatform modules, without needing Engine if ((!UEBuildConfiguration.bBuildRequiresCookedData && InModule.ToString() == "Engine" && UEBuildConfiguration.bBuildDeveloperTools) || UEBuildConfiguration.bForceBuildTargetPlatforms) { InModule.AddPlatformSpecificDynamicallyLoadedModule("HTML5TargetPlatform"); } if (EnableHTTPForNFS && (Target.Platform == UnrealTargetPlatform.Win64 || Target.Platform == UnrealTargetPlatform.Mac) ) { if (InModule.ToString() == "NetworkFile") // client { InModule.AddPrivateDependencyModule("HTTP"); InModule.AddPublicDefinition("ENABLE_HTTP_FOR_NFS=1"); } else if (InModule.ToString() == "NetworkFileSystem") // server { if (UnrealBuildTool.RunningRocket() == false || Target.Type == TargetRules.TargetType.Game ) { InModule.AddPrivateDependencyModule("WebSockets"); InModule.AddPublicDefinition("ENABLE_HTTP_FOR_NFS=1"); } } } } }
/** * Modify the newly created module passed in for this platform. * This is not required - but allows for hiding details of a * particular platform. * * @param InModule The newly loaded module * @param Target The target being build */ public override void ModifyNewlyLoadedModule(UEBuildModule InModule, TargetInfo Target) { if (Target.Platform == UnrealTargetPlatform.HTML5) { if (InModule.ToString() == "Core") { InModule.AddPublicIncludePath("Runtime/Core/Public/HTML5"); InModule.AddPublicDependencyModule("zlib"); } else if (InModule.ToString() == "Engine") { InModule.AddPrivateDependencyModule("zlib"); InModule.AddPrivateDependencyModule("UElibPNG"); InModule.AddPublicDependencyModule("UEOgg"); InModule.AddPublicDependencyModule("Vorbis"); } } else if (Target.Platform == UnrealTargetPlatform.Win64) { bool bBuildShaderFormats = UEBuildConfiguration.bForceBuildShaderFormats; if (!UEBuildConfiguration.bBuildRequiresCookedData) { if (InModule.ToString() == "Engine") { if (UEBuildConfiguration.bBuildDeveloperTools) { InModule.AddPlatformSpecificDynamicallyLoadedModule("HTML5TargetPlatform"); } } else if (InModule.ToString() == "TargetPlatform") { bBuildShaderFormats = true; // if (UEBuildConfiguration.bBuildDeveloperTools) // { // InModule.AddPlatformSpecificDynamicallyLoadedModule("AT9AudioFormat"); // InModule.AddPlatformSpecificDynamicallyLoadedModule("HTML5TextureFormat"); // } } } // allow standalone tools to use target platform modules, without needing Engine if (UEBuildConfiguration.bForceBuildTargetPlatforms) { InModule.AddPlatformSpecificDynamicallyLoadedModule("HTML5TargetPlatform"); } if (bBuildShaderFormats) { // InModule.AddDynamicallyLoadedModule("HTML5ShaderFormat"); } } }
public ModuleProcessingException(UEBuildModule Module, Exception InnerException) : base(string.Format("Exception thrown while processing dependent modules of {0}", Module.Name), InnerException) { }
/** Registers a module with this target. */ public void RegisterModule(UEBuildModule Module) { Debug.Assert(Module.Target == this); Modules.Add(Module.Name, Module); FlatModuleCsData.Add(Module.Name, new FlatModuleCsDataType(Module.BuildCsFilename)); }
/** * Modify the newly created module passed in for this platform. * This is not required - but allows for hiding details of a * particular platform. * * @param InModule The newly loaded module * @param Target The target being build */ public override void ModifyNewlyLoadedModule(UEBuildModule InModule, TargetInfo Target) { if (Target.Platform == UnrealTargetPlatform.HTML5) { if (InModule.ToString() == "Core") { InModule.AddPublicIncludePath("Runtime/Core/Public/HTML5"); InModule.AddPublicDependencyModule("zlib"); } else if (InModule.ToString() == "Engine") { InModule.AddPrivateDependencyModule("zlib"); InModule.AddPrivateDependencyModule("UElibPNG"); InModule.AddPublicDependencyModule("UEOgg"); InModule.AddPublicDependencyModule("Vorbis"); } if (InModule.ToString() == "NetworkFile") { if (EnableHTTPForNFS) { InModule.AddPublicDefinition("ENABLE_HTTP_FOR_NFS=1"); if (Target.Architecture == "-win32") { InModule.AddPrivateDependencyModule("HTML5Win32"); } else { InModule.AddPrivateDependencyModule("HTML5JS"); } } } } else if (Target.Platform == UnrealTargetPlatform.Win32 || Target.Platform == UnrealTargetPlatform.Win64 || Target.Platform == UnrealTargetPlatform.Mac) { // allow standalone tools to use targetplatform modules, without needing Engine if ((!UEBuildConfiguration.bBuildRequiresCookedData && InModule.ToString() == "Engine" && UEBuildConfiguration.bBuildDeveloperTools) || UEBuildConfiguration.bForceBuildTargetPlatforms) { InModule.AddPlatformSpecificDynamicallyLoadedModule("HTML5TargetPlatform"); } if (EnableHTTPForNFS && (Target.Platform == UnrealTargetPlatform.Win64 || Target.Platform == UnrealTargetPlatform.Mac) ) { if (InModule.ToString() == "NetworkFile") // client { InModule.AddPrivateDependencyModule("HTTP"); InModule.AddPublicDefinition("ENABLE_HTTP_FOR_NFS=1"); } else if (InModule.ToString() == "NetworkFileSystem") // server { if (UnrealBuildTool.RunningRocket() == false || Target.Type == TargetRules.TargetType.Game) { InModule.AddPrivateDependencyModule("WebSockets"); InModule.AddPublicDefinition("ENABLE_HTTP_FOR_NFS=1"); } } } } }
/** * Modify the newly created module passed in for this platform. * This is not required - but allows for hiding details of a * particular platform. * * @param InModule The newly loaded module * @param Target The target being build */ public override void ModifyNewlyLoadedModule(UEBuildModule InModule, TargetInfo Target) { if ((Target.Platform == UnrealTargetPlatform.WinRT) || (Target.Platform == UnrealTargetPlatform.WinRT_ARM)) { if (InModule.ToString() == "Core") { InModule.AddPublicIncludePath("Runtime/Core/Public/WinRT"); InModule.AddPublicDependencyModule("zlib"); } else if (InModule.ToString() == "Engine") { InModule.AddPrivateDependencyModule("zlib"); InModule.AddPrivateDependencyModule("UElibPNG"); InModule.AddPublicDependencyModule("UEOgg"); InModule.AddPublicDependencyModule("Vorbis"); } else if (InModule.ToString() == "Launch") { } else if (InModule.ToString() == "D3D11RHI") { InModule.AddPublicDefinition("D3D11_CUSTOM_VIEWPORT_CONSTRUCTOR=1"); // To enable platform specific D3D11 RHI Types InModule.AddPrivateIncludePath("Runtime/Windows/D3D11RHI/Private/WinRT"); // Hack to enable AllowWindowsPlatformTypes.h/HideWindowsPlatformTypes.h InModule.AddPublicIncludePath("Runtime/Core/Public/Windows"); } else if (InModule.ToString() == "Sockets") { // Hack to enable AllowWindowsPlatformTypes.h/HideWindowsPlatformTypes.h InModule.AddPublicIncludePath("Runtime/Core/Public/Windows"); } else if (InModule.ToString() == "PhysX") { string PhysXDir = UEBuildConfiguration.UEThirdPartySourceDirectory + "PhysX/PhysX-3.3/"; InModule.AddPublicIncludePath("include/foundation/WinRT"); if (Target.Platform == UnrealTargetPlatform.WinRT) { InModule.AddPublicLibraryPath(PhysXDir + "Lib/WinRT"); } else { InModule.AddPublicLibraryPath(PhysXDir + "Lib/WinRT/ARM"); } if (Target.Configuration == UnrealTargetConfiguration.Debug) { InModule.AddPublicAdditionalLibrary("PhysX3DEBUG.lib"); InModule.AddPublicAdditionalLibrary("PhysX3ExtensionsDEBUG.lib"); InModule.AddPublicAdditionalLibrary("PhysX3CookingDEBUG.lib"); InModule.AddPublicAdditionalLibrary("PhysX3CommonDEBUG.lib"); InModule.AddPublicAdditionalLibrary("PhysX3VehicleDEBUG.lib"); InModule.AddPublicAdditionalLibrary("PxTaskDEBUG.lib"); InModule.AddPublicAdditionalLibrary("PhysXVisualDebuggerSDKDEBUG.lib"); InModule.AddPublicAdditionalLibrary("PhysXProfileSDKDEBUG.lib"); } else if (Target.Configuration == UnrealTargetConfiguration.Development) { InModule.AddPublicAdditionalLibrary("PhysX3PROFILE.lib"); InModule.AddPublicAdditionalLibrary("PhysX3ExtensionsPROFILE.lib"); InModule.AddPublicAdditionalLibrary("PhysX3CookingPROFILE.lib"); InModule.AddPublicAdditionalLibrary("PhysX3CommonPROFILE.lib"); InModule.AddPublicAdditionalLibrary("PhysX3VehiclePROFILE.lib"); InModule.AddPublicAdditionalLibrary("PxTaskPROFILE.lib"); InModule.AddPublicAdditionalLibrary("PhysXVisualDebuggerSDKPROFILE.lib"); InModule.AddPublicAdditionalLibrary("PhysXProfileSDKPROFILE.lib"); } else // Test or Shipping { InModule.AddPublicAdditionalLibrary("PhysX3.lib"); InModule.AddPublicAdditionalLibrary("PhysX3Extensions.lib"); InModule.AddPublicAdditionalLibrary("PhysX3Cooking.lib"); InModule.AddPublicAdditionalLibrary("PhysX3Common.lib"); InModule.AddPublicAdditionalLibrary("PhysX3Vehicle.lib"); InModule.AddPublicAdditionalLibrary("PxTask.lib"); InModule.AddPublicAdditionalLibrary("PhysXVisualDebuggerSDK.lib"); InModule.AddPublicAdditionalLibrary("PhysXProfileSDK.lib"); } } else if (InModule.ToString() == "APEX") { InModule.RemovePublicDefinition("APEX_STATICALLY_LINKED=0"); InModule.AddPublicDefinition("APEX_STATICALLY_LINKED=1"); string APEXDir = UEBuildConfiguration.UEThirdPartySourceDirectory + "PhysX/APEX-1.3/"; if (Target.Platform == UnrealTargetPlatform.WinRT) { InModule.AddPublicLibraryPath(APEXDir + "lib/WinRT"); } else { InModule.AddPublicLibraryPath(APEXDir + "lib/WinRT/ARM"); } if (Target.Configuration == UnrealTargetConfiguration.Debug) { InModule.AddPublicAdditionalLibrary("ApexCommonDEBUG.lib"); InModule.AddPublicAdditionalLibrary("ApexFrameworkDEBUG.lib"); InModule.AddPublicAdditionalLibrary("ApexSharedDEBUG.lib"); InModule.AddPublicAdditionalLibrary("APEX_DestructibleDEBUG.lib"); } else if (Target.Configuration == UnrealTargetConfiguration.Development) { InModule.AddPublicAdditionalLibrary("ApexCommonPROFILE.lib"); InModule.AddPublicAdditionalLibrary("ApexFrameworkPROFILE.lib"); InModule.AddPublicAdditionalLibrary("ApexSharedPROFILE.lib"); InModule.AddPublicAdditionalLibrary("APEX_DestructiblePROFILE.lib"); } else // Test or Shipping { InModule.AddPublicAdditionalLibrary("ApexCommon.lib"); InModule.AddPublicAdditionalLibrary("ApexFramework.lib"); InModule.AddPublicAdditionalLibrary("ApexShared.lib"); InModule.AddPublicAdditionalLibrary("APEX_Destructible.lib"); } } else if (InModule.ToString() == "FreeType2") { string FreeType2Path = UEBuildConfiguration.UEThirdPartySourceDirectory + "FreeType2/FreeType2-2.4.12/"; if (Target.Platform == UnrealTargetPlatform.WinRT) { InModule.AddPublicLibraryPath(FreeType2Path + "Lib/WinRT/Win64"); } else { InModule.AddPublicLibraryPath(FreeType2Path + "Lib/WinRT/ARM"); } InModule.AddPublicAdditionalLibrary("freetype2412MT.lib"); } else if (InModule.ToString() == "UElibPNG") { string libPNGPath = UEBuildConfiguration.UEThirdPartySourceDirectory + "libPNG/libPNG-1.5.2"; if (Target.Platform == UnrealTargetPlatform.WinRT) { InModule.AddPublicLibraryPath(libPNGPath + "/lib/WinRT/Win64"); } else { InModule.AddPublicLibraryPath(libPNGPath + "/lib/WinRT/ARM"); } InModule.AddPublicAdditionalLibrary("libpng125.lib"); } else if (InModule.ToString() == "DX11") { // Clear out all the Windows include paths and libraries... // The WinRTSDK module handles proper paths and libs for WinRT. // However, the D3D11RHI module will include the DX11 module. InModule.ClearPublicIncludePaths(); InModule.ClearPublicLibraryPaths(); InModule.ClearPublicAdditionalLibraries(); InModule.RemovePublicDefinition("WITH_D3DX_LIBS=1"); InModule.AddPublicDefinition("D3D11_WITH_DWMAPI=0"); InModule.AddPublicDefinition("WITH_D3DX_LIBS=0"); InModule.AddPublicDefinition("WITH_DX_PERF=0"); InModule.RemovePublicAdditionalLibrary("X3DAudio.lib"); InModule.RemovePublicAdditionalLibrary("XAPOFX.lib"); } else if (InModule.ToString() == "XInput") { InModule.AddPublicAdditionalLibrary("XInput.lib"); } else if (InModule.ToString() == "XAudio2") { InModule.AddPublicDefinition("XAUDIO_SUPPORTS_XMA2WAVEFORMATEX=0"); InModule.AddPublicDefinition("XAUDIO_SUPPORTS_DEVICE_DETAILS=0"); InModule.AddPublicDefinition("XAUDIO2_SUPPORTS_MUSIC=0"); InModule.AddPublicDefinition("XAUDIO2_SUPPORTS_SENDLIST=0"); InModule.AddPublicAdditionalLibrary("XAudio2.lib"); // Hack to enable AllowWindowsPlatformTypes.h/HideWindowsPlatformTypes.h InModule.AddPublicIncludePath("Runtime/Core/Public/Windows"); } else if (InModule.ToString() == "UEOgg") { string OggPath = UEBuildConfiguration.UEThirdPartySourceDirectory + "Ogg/libogg-1.2.2/"; if (Target.Platform == UnrealTargetPlatform.WinRT) { InModule.AddPublicLibraryPath(OggPath + "WinRT/VS2012/WinRT/x64/Release"); } else { InModule.AddPublicLibraryPath(OggPath + "WinRT/VS2012/WinRT/ARM/Release"); } InModule.AddPublicAdditionalLibrary("libogg_static.lib"); } else if (InModule.ToString() == "Vorbis") { string VorbisPath = UEBuildConfiguration.UEThirdPartySourceDirectory + "Vorbis/libvorbis-1.3.2/"; if (Target.Platform == UnrealTargetPlatform.WinRT) { InModule.AddPublicLibraryPath(VorbisPath + "WinRT/VS2012/WinRT/x64/Release"); } else { InModule.AddPublicLibraryPath(VorbisPath + "WinRT/VS2012/WinRT/ARM/Release"); } InModule.AddPublicAdditionalLibrary("libvorbis_static.lib"); } else if (InModule.ToString() == "VorbisFile") { string VorbisPath = UEBuildConfiguration.UEThirdPartySourceDirectory + "Vorbis/libvorbis-1.3.2/"; if (Target.Platform == UnrealTargetPlatform.WinRT) { InModule.AddPublicLibraryPath(VorbisPath + "WinRT/VS2012/WinRT/x64/Release"); } else { InModule.AddPublicLibraryPath(VorbisPath + "WinRT/VS2012/WinRT/ARM/Release"); } InModule.AddPublicAdditionalLibrary("libvorbisfile_static.lib"); } else if (InModule.ToString() == "DX11Audio") { InModule.RemovePublicAdditionalLibrary("X3DAudio.lib"); InModule.RemovePublicAdditionalLibrary("XAPOFX.lib"); } else if (InModule.ToString() == "zlib") { if (Target.Platform == UnrealTargetPlatform.WinRT) { InModule.AddPublicLibraryPath(UEBuildConfiguration.UEThirdPartySourceDirectory + "zlib/zlib-1.2.5/Lib/WinRT/Win64"); } else { InModule.AddPublicLibraryPath(UEBuildConfiguration.UEThirdPartySourceDirectory + "zlib/zlib-1.2.5/Lib/WinRT/ARM"); } InModule.AddPublicAdditionalLibrary("zlib125.lib"); } } else if ((Target.Platform == UnrealTargetPlatform.Win32) || (Target.Platform == UnrealTargetPlatform.Win64)) { // bool bBuildShaderFormats = UEBuildConfiguration.bForceBuildShaderFormats; // if (!UEBuildConfiguration.bBuildRequiresCookedData) // { // if (InModule.ToString() == "Engine") // { // if (UEBuildConfiguration.bBuildDeveloperTools) // { // InModule.AddPlatformSpecificDynamicallyLoadedModule("WinRTTargetPlatform"); // } // } // else if (InModule.ToString() == "TargetPlatform") // { // bBuildShaderFormats = true; // } // } // // allow standalone tools to use targetplatform modules, without needing Engine // if (UEBuildConfiguration.bForceBuildTargetPlatforms) // { // InModule.AddPlatformSpecificDynamicallyLoadedModule("WinRTTargetPlatform"); // } // if (bBuildShaderFormats) // { // InModule.AddPlatformSpecificDynamicallyLoadedModule("ShaderFormatWinRT"); // } } }
/// <summary> /// Adds a module to the binary. /// </summary> /// <param name="ModuleName">The module to add</param> public override void AddModule(UEBuildModule Module) { if (!Modules.Contains(Module)) { Modules.Add(Module); } }
/// <summary> /// Checks whether the binary output paths are appropriate for the distribution /// level of its direct module dependencies /// </summary> public bool CheckRestrictedFolders(List <DirectoryReference> RootDirectories, Dictionary <UEBuildModule, Dictionary <RestrictedFolder, DirectoryReference> > ModuleRestrictedFolderCache) { // Find all the modules we depend on Dictionary <UEBuildModule, UEBuildModule> ModuleReferencedBy = new Dictionary <UEBuildModule, UEBuildModule>(); FindModuleReferences(ModuleReferencedBy); // Loop through each of the output binaries and check them separately bool bResult = true; foreach (FileReference OutputFilePath in OutputFilePaths) { // Find the base directory for this binary DirectoryReference BaseDir = RootDirectories.FirstOrDefault(x => OutputFilePath.IsUnderDirectory(x)); if (BaseDir == null) { continue; } // Find the permitted restricted folder references under the base directory List <RestrictedFolder> BinaryFolders = RestrictedFolders.FindPermittedRestrictedFolderReferences(BaseDir, OutputFilePath.Directory); List <RestrictedFolder> AliasedBinaryFolders = new List <RestrictedFolder>(); foreach (RestrictedFolder BinaryFolder in BinaryFolders) { string Alias; if (PrimaryModule.AliasRestrictedFolders.TryGetValue(BinaryFolder.ToString(), out Alias)) { foreach (RestrictedFolder Folder in RestrictedFolder.GetValues()) { if (Folder.ToString().Equals(Alias)) { AliasedBinaryFolders.Add(Folder); } } } } BinaryFolders.AddRange(AliasedBinaryFolders); // Check all the dependent modules foreach (UEBuildModule Module in ModuleReferencedBy.Keys) { // Find the restricted folders for this module Dictionary <RestrictedFolder, DirectoryReference> ModuleRestrictedFolders; if (!ModuleRestrictedFolderCache.TryGetValue(Module, out ModuleRestrictedFolders)) { ModuleRestrictedFolders = Module.FindRestrictedFolderReferences(RootDirectories); ModuleRestrictedFolderCache.Add(Module, ModuleRestrictedFolders); } // Write errors for any missing paths in the output files foreach (KeyValuePair <RestrictedFolder, DirectoryReference> Pair in ModuleRestrictedFolders) { if (!BinaryFolders.Contains(Pair.Key)) { List <string> ReferenceChain = new List <string>(); for (UEBuildModule ReferencedModule = Module; ReferencedModule != null; ReferencedModule = ModuleReferencedBy[ReferencedModule]) { ReferenceChain.Insert(0, ReferencedModule.Name); } Log.TraceError("Output binary \"{0}\" is not in a {1} folder, but references \"{2}\" via {3}.", OutputFilePath, Pair.Key.ToString(), Pair.Value, String.Join(" -> ", ReferenceChain)); bResult = false; } } } } return(bResult); }
/// <summary> /// Write a Module to a JSON writer. If array is empty, don't write anything /// </summary> /// <param name="BinaryOutputDir"></param> /// <param name="TargetOutputDir"></param> /// <param name="Writer">Writer for the array data</param> /// <param name="Module"></param> private static void ExportModule(UEBuildModule Module, DirectoryReference BinaryOutputDir, DirectoryReference TargetOutputDir, JsonWriter Writer) { Writer.WriteValue("Name", Module.Name); Writer.WriteValue("Directory", Module.ModuleDirectory.FullName); Writer.WriteValue("Rules", Module.RulesFile.FullName); Writer.WriteValue("PCHUsage", Module.Rules.PCHUsage.ToString()); if (Module.Rules.PrivatePCHHeaderFile != null) { Writer.WriteValue("PrivatePCH", FileReference.Combine(Module.ModuleDirectory, Module.Rules.PrivatePCHHeaderFile).FullName); } if (Module.Rules.SharedPCHHeaderFile != null) { Writer.WriteValue("SharedPCH", FileReference.Combine(Module.ModuleDirectory, Module.Rules.SharedPCHHeaderFile).FullName); } ExportJsonModuleArray(Writer, "PublicDependencyModules", Module.PublicDependencyModules); ExportJsonModuleArray(Writer, "PublicIncludePathModules", Module.PublicIncludePathModules); ExportJsonModuleArray(Writer, "PrivateDependencyModules", Module.PrivateDependencyModules); ExportJsonModuleArray(Writer, "PrivateIncludePathModules", Module.PrivateIncludePathModules); ExportJsonModuleArray(Writer, "DynamicallyLoadedModules", Module.DynamicallyLoadedModules); ExportJsonStringArray(Writer, "PublicSystemIncludePaths", Module.PublicSystemIncludePaths.Select(x => x.FullName)); ExportJsonStringArray(Writer, "PublicIncludePaths", Module.PublicIncludePaths.Select(x => x.FullName)); ExportJsonStringArray(Writer, "LegacyPublicIncludePaths", Module.LegacyPublicIncludePaths.Select(x => x.FullName)); ExportJsonStringArray(Writer, "PrivateIncludePaths", Module.PrivateIncludePaths.Select(x => x.FullName)); ExportJsonStringArray(Writer, "PublicLibraryPaths", Module.PublicSystemLibraryPaths.Select(x => x.FullName)); ExportJsonStringArray(Writer, "PublicAdditionalLibraries", Module.PublicSystemLibraries.Concat(Module.PublicAdditionalLibraries)); ExportJsonStringArray(Writer, "PublicFrameworks", Module.PublicFrameworks); ExportJsonStringArray(Writer, "PublicWeakFrameworks", Module.PublicWeakFrameworks); ExportJsonStringArray(Writer, "PublicDelayLoadDLLs", Module.PublicDelayLoadDLLs); ExportJsonStringArray(Writer, "PublicDefinitions", Module.PublicDefinitions); ExportJsonStringArray(Writer, "PrivateDefinitions", Module.Rules.PrivateDefinitions); ExportJsonStringArray(Writer, "ProjectDefinitions", /* TODO: Add method ShouldAddProjectDefinitions */ !Module.Rules.bTreatAsEngineModule ? Module.Rules.Target.ProjectDefinitions : new string[0]); ExportJsonStringArray(Writer, "ApiDefinitions", Module.GetEmptyApiMacros()); Writer.WriteValue("ShouldAddLegacyPublicIncludePaths", Module.Rules.bLegacyPublicIncludePaths); if (Module.Rules.CircularlyReferencedDependentModules.Any()) { Writer.WriteArrayStart("CircularlyReferencedModules"); foreach (string ModuleName in Module.Rules.CircularlyReferencedDependentModules) { Writer.WriteValue(ModuleName); } Writer.WriteArrayEnd(); } if (Module.Rules.RuntimeDependencies.Inner.Any()) { // We don't use info from RuntimeDependencies for code analyzes (at the moment) // So we're OK with skipping some values if they are not presented Writer.WriteArrayStart("RuntimeDependencies"); foreach (ModuleRules.RuntimeDependency RuntimeDependency in Module.Rules.RuntimeDependencies.Inner) { Writer.WriteObjectStart(); try { Writer.WriteValue("Path", Module.ExpandPathVariables(RuntimeDependency.Path, BinaryOutputDir, TargetOutputDir)); } catch (BuildException buildException) { Log.TraceVerbose("Value {0} for module {1} will not be stored. Reason: {2}", "Path", Module.Name, buildException); } if (RuntimeDependency.SourcePath != null) { try { Writer.WriteValue("SourcePath", Module.ExpandPathVariables(RuntimeDependency.SourcePath, BinaryOutputDir, TargetOutputDir)); } catch (BuildException buildException) { Log.TraceVerbose("Value {0} for module {1} will not be stored. Reason: {2}", "SourcePath", Module.Name, buildException); } } Writer.WriteValue("Type", RuntimeDependency.Type.ToString()); Writer.WriteObjectEnd(); } Writer.WriteArrayEnd(); } }
public override void ModifyNewlyLoadedModule(UEBuildModule InModule, TargetInfo Target) { if ((Target.Platform == UnrealTargetPlatform.Win32) || (Target.Platform == UnrealTargetPlatform.Win64)) { bool bBuildShaderFormats = UEBuildConfiguration.bForceBuildShaderFormats; if (!UEBuildConfiguration.bBuildRequiresCookedData) { if (InModule.ToString() == "Engine") { if (UEBuildConfiguration.bBuildDeveloperTools) { InModule.AddPlatformSpecificDynamicallyLoadedModule("AndroidTargetPlatform"); InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_PVRTCTargetPlatform"); InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_ATCTargetPlatform"); InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_DXTTargetPlatform"); InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_ETC1TargetPlatform"); InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_ETC2TargetPlatform"); // InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_GL4TargetPlatform"); // @todo es31: Put this back in for ES31 support // ES31 code is in, but it's not fully supported in UE4 4.5, so for now we need to disable the targetplatform as it will confuse people greatly // InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_ES31TargetPlatform"); } } else if (InModule.ToString() == "UnrealEd") { InModule.AddPlatformSpecificDynamicallyLoadedModule("AndroidPlatformEditor"); } else if (InModule.ToString() == "TargetPlatform") { bBuildShaderFormats = true; InModule.AddDynamicallyLoadedModule("TextureFormatPVR"); InModule.AddDynamicallyLoadedModule("TextureFormatDXT"); InModule.AddPlatformSpecificDynamicallyLoadedModule("TextureFormatAndroid"); // ATITC, ETC1 and ETC2 if (UEBuildConfiguration.bBuildDeveloperTools) { //InModule.AddDynamicallyLoadedModule("AudioFormatADPCM"); //@todo android: android audio } } } // allow standalone tools to use targetplatform modules, without needing Engine if (UEBuildConfiguration.bForceBuildTargetPlatforms) { InModule.AddPlatformSpecificDynamicallyLoadedModule("AndroidTargetPlatform"); InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_PVRTCTargetPlatform"); InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_ATCTargetPlatform"); InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_DXTTargetPlatform"); InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_ETC1TargetPlatform"); InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_ETC2TargetPlatform"); // InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_GL4TargetPlatform"); // @todo es31: Put this back in for ES31 support // ES31 code is in, but it's not fully supported in UE4 4.5, so for now we need to disable the targetplatform as it will confuse people greatly // InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_ES31TargetPlatform"); } if (bBuildShaderFormats) { //InModule.AddDynamicallyLoadedModule("ShaderFormatAndroid"); //@todo android: ShaderFormatAndroid } } }
public override void ModifyNewlyLoadedModule(UEBuildModule InModule, TargetInfo Target) { if ((Target.Platform == UnrealTargetPlatform.Win32) || (Target.Platform == UnrealTargetPlatform.Win64)) { bool bBuildShaderFormats = UEBuildConfiguration.bForceBuildShaderFormats; if (!UEBuildConfiguration.bBuildRequiresCookedData) { if (InModule.ToString() == "Engine") { if (UEBuildConfiguration.bBuildDeveloperTools) { InModule.AddPlatformSpecificDynamicallyLoadedModule("AndroidTargetPlatform"); InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_PVRTCTargetPlatform"); InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_ATCTargetPlatform"); InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_DXTTargetPlatform"); InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_ETC1TargetPlatform"); InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_ETC2TargetPlatform"); } } else if (InModule.ToString() == "UnrealEd") { InModule.AddPlatformSpecificDynamicallyLoadedModule("AndroidPlatformEditor"); } else if (InModule.ToString() == "TargetPlatform") { bBuildShaderFormats = true; InModule.AddDynamicallyLoadedModule("TextureFormatPVR"); InModule.AddDynamicallyLoadedModule("TextureFormatDXT"); InModule.AddPlatformSpecificDynamicallyLoadedModule("TextureFormatAndroid"); // ATITC, ETC1 and ETC2 if (UEBuildConfiguration.bBuildDeveloperTools) { //InModule.AddDynamicallyLoadedModule("AudioFormatADPCM"); //@todo android: android audio } } } // allow standalone tools to use targetplatform modules, without needing Engine if (UEBuildConfiguration.bForceBuildTargetPlatforms) { InModule.AddPlatformSpecificDynamicallyLoadedModule("AndroidTargetPlatform"); InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_PVRTCTargetPlatform"); InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_ATCTargetPlatform"); InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_DXTTargetPlatform"); InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_ETC1TargetPlatform"); InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_ETC2TargetPlatform"); } if (bBuildShaderFormats) { //InModule.AddDynamicallyLoadedModule("ShaderFormatAndroid"); //@todo android: ShaderFormatAndroid } } }
/** * Modify the newly created module passed in for this platform. * This is not required - but allows for hiding details of a * particular platform. * * @param InModule The newly loaded module * @param GameName The game being build * @param Target The target being build */ public override void ModifyNewlyLoadedModule(UEBuildModule InModule, TargetInfo Target) { if ((Target.Platform == UnrealTargetPlatform.Win32) || (Target.Platform == UnrealTargetPlatform.Win64) || (Target.Platform == UnrealTargetPlatform.Mac)) { bool bBuildShaderFormats = UEBuildConfiguration.bForceBuildShaderFormats; if (!UEBuildConfiguration.bBuildRequiresCookedData) { if (InModule.ToString() == "Engine") { if (UEBuildConfiguration.bBuildDeveloperTools) { InModule.AddPlatformSpecificDynamicallyLoadedModule("IOSTargetPlatform"); } } else if (InModule.ToString() == "TargetPlatform") { bBuildShaderFormats = true; InModule.AddDynamicallyLoadedModule("TextureFormatPVR"); InModule.AddDynamicallyLoadedModule("TextureFormatASTC"); if (UEBuildConfiguration.bBuildDeveloperTools) { InModule.AddPlatformSpecificDynamicallyLoadedModule("AudioFormatADPCM"); } } } // allow standalone tools to use targetplatform modules, without needing Engine if (UEBuildConfiguration.bForceBuildTargetPlatforms) { InModule.AddPlatformSpecificDynamicallyLoadedModule("IOSTargetPlatform"); } if (bBuildShaderFormats) { InModule.AddPlatformSpecificDynamicallyLoadedModule("MetalShaderFormat"); } } }
public override void ModifyNewlyLoadedModule(UEBuildModule InModule, TargetInfo Target) { if (Target.Platform == UnrealTargetPlatform.Mac) { bool bBuildShaderFormats = UEBuildConfiguration.bForceBuildShaderFormats; if (!UEBuildConfiguration.bBuildRequiresCookedData) { if (InModule.ToString() == "TargetPlatform") { bBuildShaderFormats = true; } } // allow standalone tools to use target platform modules, without needing Engine if (UEBuildConfiguration.bForceBuildTargetPlatforms) { InModule.AddDynamicallyLoadedModule("MacTargetPlatform"); InModule.AddDynamicallyLoadedModule("MacNoEditorTargetPlatform"); InModule.AddDynamicallyLoadedModule("MacClientTargetPlatform"); InModule.AddDynamicallyLoadedModule("MacServerTargetPlatform"); InModule.AddDynamicallyLoadedModule("AllDesktopTargetPlatform"); } if (bBuildShaderFormats) { // InModule.AddDynamicallyLoadedModule("ShaderFormatD3D"); InModule.AddDynamicallyLoadedModule("ShaderFormatOpenGL"); } } }