public override void RecursivelyProcessUnboundModules(UEBuildTarget Target, ref Dictionary<string, UEBuildBinary> Binaries, UEBuildBinary ExecutableBinary) { try { // Make sure this module is bound to a binary if( !bIncludedInTarget ) { throw new BuildException( "Module '{0}' should already have been bound to a binary!", Name ); } var AllModuleNames = new List<string>(); AllModuleNames.AddRange( PrivateDependencyModuleNames ); AllModuleNames.AddRange( PublicDependencyModuleNames ); AllModuleNames.AddRange( DynamicallyLoadedModuleNames ); AllModuleNames.AddRange( PlatformSpecificDynamicallyLoadedModuleNames ); foreach( var DependencyName in AllModuleNames ) { var DependencyModule = Target.FindOrCreateModuleByName(DependencyName); // Skip modules that are included with the target (externals) if( !DependencyModule.bIncludedInTarget ) { if( !Binaries.ContainsKey( DependencyModule.Name ) ) { UEBuildBinary BinaryToBindTo; if (Target.ShouldCompileMonolithic()) { // When linking monolithically, any unbound modules will be linked into the main executable BinaryToBindTo = ExecutableBinary; } else { // Is this a plugin module? var PluginInfo = Plugins.GetPluginInfoForModule( DependencyName ); string[] OutputFilePaths = Target.MakeBinaryPaths(DependencyModule.Name, Target.GetAppName() + "-" + DependencyModule.Name, UEBuildBinaryType.DynamicLinkLibrary, Target.TargetType, PluginInfo, ""); // If it's an engine module, output intermediates to the engine intermediates directory. string IntermediateDirectory = Binary.Config.IntermediateDirectory; if (IntermediateDirectory != Target.EngineIntermediateDirectory && Path.GetFullPath(DependencyModule.ModuleDirectory).StartsWith(Path.GetFullPath(BuildConfiguration.RelativeEnginePath))) { IntermediateDirectory = Target.EngineIntermediateDirectory; } // When using modular linkage, unbound modules will be linked into their own DLL files UEBuildBinaryConfiguration Config = new UEBuildBinaryConfiguration( InType: UEBuildBinaryType.DynamicLinkLibrary, InOutputFilePaths: OutputFilePaths, InIntermediateDirectory: IntermediateDirectory, bInAllowExports: true, InModuleNames: new List<string> { DependencyModule.Name }, InTargetName: Target.GetAppName(), bInIsCrossTarget: PlatformSpecificDynamicallyLoadedModuleNames.Contains(DependencyName) && !DynamicallyLoadedModuleNames.Contains(DependencyName), InTargetConfiguration: Target.Configuration, bInCompileMonolithic: Target.ShouldCompileMonolithic() ); // 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] = DependencyModule.FixupOutputPath(Config.OutputFilePaths[Index]); } BinaryToBindTo = new UEBuildBinaryCPP( Target, Config ); } Binaries[ DependencyModule.Name ] = BinaryToBindTo; // Bind this module DependencyModule.Binary = BinaryToBindTo; DependencyModule.bIncludedInTarget = true; // Also add binaries for this module's dependencies DependencyModule.RecursivelyProcessUnboundModules( Target, ref Binaries, ExecutableBinary ); } } if (Target.ShouldCompileMonolithic() == false) { // Check to see if there is a circular relationship between the module and it's referencer if( DependencyModule.Binary != null ) { if( CircularlyReferencedDependentModules.Contains( DependencyName ) ) { DependencyModule.Binary.SetCreateImportLibrarySeparately( true ); } } } } // Also make sure module entries are created for any module that is pulled in as an "include path" module. // These modules are never linked in unless they were referenced as an actual dependency of a different module, // but we still need to keep track of them so that we can find their include paths when setting up our // module's include paths. RecursivelyAddIncludePathModules( Target, bPublicIncludesOnly:false ); } catch (System.Exception ex) { throw new ModuleProcessingException(this, ex); } }