/// <summary> /// Called to allow the binary to modify the link environment of a different binary containing /// a module that depends on a module in this binary. /// </summary> /// <param name="DependentLinkEnvironment">The link environment of the dependency</param> public void SetupDependentLinkEnvironment(LinkEnvironment DependentLinkEnvironment) { // Cache the list of libraries in the dependent link environment between calls. We typically run this code path many times for each module. if (DependentLinkLibraries == null) { DependentLinkLibraries = new List <string>(); foreach (FileReference OutputFilePath in OutputFilePaths) { FileReference LibraryFileName; if (Type == UEBuildBinaryType.StaticLibrary || DependentLinkEnvironment.Platform == CppPlatform.Mac || DependentLinkEnvironment.Platform == CppPlatform.Linux) { LibraryFileName = OutputFilePath; } else { LibraryFileName = FileReference.Combine(IntermediateDirectory, OutputFilePath.GetFileNameWithoutExtension() + ".lib"); } DependentLinkLibraries.Add(LibraryFileName.FullName); } } DependentLinkEnvironment.AdditionalLibraries.AddRange(DependentLinkLibraries); }
/// <summary> /// Called to allow the binary to modify the link environment of a different binary containing /// a module that depends on a module in this binary. /// </summary> /// <param name="DependentLinkEnvironment">The link environment of the dependency</param> public override void SetupDependentLinkEnvironment(LinkEnvironment DependentLinkEnvironment) { // Cache the list of libraries in the dependent link environment between calls. We typically run this code path many times for each module. if (DependentLinkLibraries == null) { DependentLinkLibraries = new List <string>(); foreach (FileReference OutputFilePath in Config.OutputFilePaths) { FileReference LibraryFileName; if (Config.Type == UEBuildBinaryType.StaticLibrary || DependentLinkEnvironment.Config.Platform == CPPTargetPlatform.Mac || DependentLinkEnvironment.Config.Platform == CPPTargetPlatform.Linux) { LibraryFileName = OutputFilePath; } else { LibraryFileName = FileReference.Combine(Config.IntermediateDirectory, OutputFilePath.GetFileNameWithoutExtension() + ".lib"); } DependentLinkLibraries.Add(LibraryFileName.FullName); } } DependentLinkEnvironment.Config.AdditionalLibraries.AddRange(DependentLinkLibraries); // If we're linking against static library containing the launch module on windows, we need to add the compiled resource separately. We can't link it through the static library. if (Config.Type == UEBuildBinaryType.StaticLibrary && Modules.Any(x => x.Name == "Launch") && (Target.Platform == UnrealTargetPlatform.Win32 || Target.Platform == UnrealTargetPlatform.Win64)) { FileReference ResourceFileRef = FileReference.Combine(Config.IntermediateDirectory, "Launch", "PCLaunch.rc.res"); DependentLinkEnvironment.InputFiles.Add(FileItem.GetItemByFileReference(ResourceFileRef)); } }