本文整理汇总了C#中UnrealBuildTool.LinkEnvironment类的典型用法代码示例。如果您正苦于以下问题:C# LinkEnvironment类的具体用法?C# LinkEnvironment怎么用?C# LinkEnvironment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LinkEnvironment类属于UnrealBuildTool命名空间,在下文中一共展示了LinkEnvironment类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LinkEnvironment
/** Copy constructor. */
public LinkEnvironment(LinkEnvironment InCopyEnvironment)
{
InputFiles.AddRange(InCopyEnvironment.InputFiles);
InputLibraries.AddRange(InCopyEnvironment.InputLibraries);
Config = new LinkEnvironmentConfiguration(InCopyEnvironment.Config);
}
示例2: SetUpGameEnvironment
/** Allows the game to add any additional environment settings before building */
public void SetUpGameEnvironment(CPPEnvironment GameCPPEnvironment, LinkEnvironment FinalLinkEnvironment, List<UE3ProjectDesc> GameProjects)
{
GameCPPEnvironment.IncludePaths.Add("ExampleGame/Inc");
GameProjects.Add( new UE3ProjectDesc( "ExampleGame/ExampleGame.vcproj") );
if (UE3BuildConfiguration.bBuildEditor &&
(GameCPPEnvironment.TargetPlatform == CPPTargetPlatform.Win32 || GameCPPEnvironment.TargetPlatform == CPPTargetPlatform.Win64))
{
GameProjects.Add( new UE3ProjectDesc( "ExampleEditor/ExampleEditor.vcproj") );
GameCPPEnvironment.IncludePaths.Add("ExampleEditor/Inc");
}
GameCPPEnvironment.Definitions.Add("GAMENAME=EXAMPLEGAME");
GameCPPEnvironment.Definitions.Add("IS_EXAMPLEGAME=1");
FinalLinkEnvironment.AdditionalLibraries.Add("ws2_32.lib");
FinalLinkEnvironment.AdditionalLibraries.Add("../../Binaries/win32/Network.lib");
}
示例3: AddAppBundleContentsToManifest
public static void AddAppBundleContentsToManifest(ref FileManifest Manifest, UEBuildBinary Binary)
{
if (Binary.Target.GlobalLinkEnvironment.Config.bIsBuildingConsoleApplication || Binary.Config.Type != UEBuildBinaryType.Executable)
{
return;
}
string ContentsDirectory = Path.GetDirectoryName(Path.GetDirectoryName(Binary.Config.OutputFilePath)) + "/";
// We need to know what third party dylibs would be copied to the bundle
var Modules = Binary.GetAllDependencyModules(bIncludeDynamicallyLoaded: false, bForceCircular: false);
var BinaryLinkEnvironment = new LinkEnvironment(Binary.Target.GlobalLinkEnvironment);
var BinaryDependencies = new List<UEBuildBinary>();
var LinkEnvironmentVisitedModules = new Dictionary<UEBuildModule, bool>();
foreach (var Module in Modules)
{
Module.SetupPrivateLinkEnvironment(ref BinaryLinkEnvironment, ref BinaryDependencies, ref LinkEnvironmentVisitedModules);
}
foreach (string AdditionalLibrary in BinaryLinkEnvironment.Config.AdditionalLibraries)
{
string LibName = Path.GetFileName(AdditionalLibrary);
if (LibName.StartsWith("lib"))
{
if (Path.GetExtension(AdditionalLibrary) == ".dylib")
{
Manifest.AddFileName(ContentsDirectory + "MacOS/" + LibName);
}
}
}
// And we also need all the resources
Manifest.AddFileName(ContentsDirectory + "Info.plist");
Manifest.AddFileName(ContentsDirectory + "PkgInfo");
Manifest.AddFileName(ContentsDirectory + "Resources/UE4.icns");
Manifest.AddFileName(ContentsDirectory + "Resources/OpenXcodeAtFileAndLine.applescript");
Manifest.AddFileName(ContentsDirectory + "Resources/English.lproj/InfoPlist.strings");
Manifest.AddFileName(ContentsDirectory + "Resources/English.lproj/MainMenu.nib");
Manifest.AddFileName(ContentsDirectory + "Resources/RadioEffectUnit.component/Contents/MacOS/RadioEffectUnit");
Manifest.AddFileName(ContentsDirectory + "Resources/RadioEffectUnit.component/Contents/Resources/English.lproj/Localizable.strings");
Manifest.AddFileName(ContentsDirectory + "Resources/RadioEffectUnit.component/Contents/Resources/RadioEffectUnit.rsrc");
Manifest.AddFileName(ContentsDirectory + "Resources/RadioEffectUnit.component/Contents/Info.plist");
}
示例4: GetResponseFileName
/// <summary>
/// Get the name of the response file for the current linker environment and output file
/// </summary>
/// <param name="LinkEnvironment"></param>
/// <param name="OutputFile"></param>
/// <returns></returns>
public static string GetResponseFileName( LinkEnvironment LinkEnvironment, FileItem OutputFile )
{
// Construct a relative path for the intermediate response file
string ResponseFileName = Path.Combine( LinkEnvironment.Config.IntermediateDirectory, Path.GetFileName( OutputFile.AbsolutePath ) + ".response" );
if (UnrealBuildTool.HasUProjectFile())
{
// If this is the uproject being built, redirect the intermediate
if (Utils.IsFileUnderDirectory( OutputFile.AbsolutePath, UnrealBuildTool.GetUProjectPath() ))
{
ResponseFileName = Path.Combine(
UnrealBuildTool.GetUProjectPath(),
BuildConfiguration.PlatformIntermediateFolder,
Path.GetFileNameWithoutExtension(UnrealBuildTool.GetUProjectFile()),
LinkEnvironment.Config.TargetConfiguration.ToString(),
Path.GetFileName(OutputFile.AbsolutePath) + ".response");
}
}
// Convert the relative path to an absolute path
ResponseFileName = Path.GetFullPath( ResponseFileName );
return ResponseFileName;
}
示例5: GetLinkArguments
static string GetLinkArguments(LinkEnvironment LinkEnvironment)
{
string Result = GetSharedArguments_Global(LinkEnvironment.Config.Target.Configuration, LinkEnvironment.Config.Target.Architecture, false);
if (LinkEnvironment.Config.Target.Architecture != "-win32") // ! simulator
{
// suppress link time warnings
Result += " -Wno-ignored-attributes"; // function alias that always gets resolved
Result += " -Wno-parentheses"; // precedence order
Result += " -Wno-shift-count-overflow"; // 64bit is more than enough for shift 32
// enable verbose mode
Result += " -v";
if (LinkEnvironment.Config.Target.Configuration == CPPTargetConfiguration.Debug || LinkEnvironment.Config.Target.Configuration == CPPTargetConfiguration.Development)
{
// check for alignment/etc checking
// Result += " -s SAFE_HEAP=1";
//Result += " -s CHECK_HEAP_ALIGN=1";
//Result += " -s SAFE_DYNCALLS=1";
// enable assertions in non-Shipping/Release builds
Result += " -s ASSERTIONS=1";
}
if (LinkEnvironment.Config.Target.Configuration == CPPTargetConfiguration.Debug)
{
Result += " -O0";
}
else // development & shipping
{
Result += " -s ASM_JS=1";
if (UEBuildConfiguration.bCompileForSize)
{
Result += " -Oz -s OUTLINING_LIMIT=40000";
}
else
{
Result += " -s OUTLINING_LIMIT=110000";
if (LinkEnvironment.Config.Target.Configuration == CPPTargetConfiguration.Development)
{
Result += " -O2";
}
if (LinkEnvironment.Config.Target.Configuration == CPPTargetConfiguration.Shipping)
{
Result += " -O3";
}
}
}
Result += " -s CASE_INSENSITIVE_FS=1";
}
return Result;
}
示例6: PostBuild
public virtual ICollection<FileItem> PostBuild(FileItem Executable, LinkEnvironment ExecutableLinkEnvironment)
{
return new List<FileItem>();
}
示例7: GetLinkArguments
static string GetLinkArguments(LinkEnvironment LinkEnvironment, string Architecture)
{
string Result = "";
Result += " -nostdlib";
Result += " -Wl,-shared,-Bsymbolic";
Result += " -Wl,--no-undefined";
if (Architecture == "-arm64")
{
Result += ToolchainParamsArm64;
Result += " -march=armv8-a";
}
else if (Architecture == "-x86")
{
Result += ToolchainParamsx86;
Result += " -march=atom";
}
else if (Architecture == "-x64")
{
Result += ToolchainParamsx64;
Result += " -march=atom";
}
else // if (Architecture == "-armv7")
{
Result += ToolchainParamsArm;
Result += " -march=armv7-a";
Result += " -Wl,--fix-cortex-a8"; // required to route around a CPU bug in some Cortex-A8 implementations
}
if (BuildConfiguration.bUseUnityBuild && ClangVersionFloat >= 3.6f)
{
Result += " -fuse-ld=gold"; // ld.gold is available in r10e (clang 3.6)
}
// verbose output from the linker
// Result += " -v";
return Result;
}
示例8: LinkFiles
public override FileItem LinkFiles(LinkEnvironment LinkEnvironment, bool bBuildImportLibraryOnly)
{
if (LinkEnvironment.Config.Target.Architecture == "-win32")
{
return base.LinkFiles(LinkEnvironment, bBuildImportLibraryOnly);
}
FileItem OutputFile;
// Make the final javascript file
Action LinkAction = new Action(ActionType.Link);
LinkAction.bCanExecuteRemotely = false;
LinkAction.WorkingDirectory = Path.GetFullPath(".");
LinkAction.CommandPath = PythonPath;
LinkAction.CommandArguments = EMCCPath;
LinkAction.CommandArguments += GetLinkArguments(LinkEnvironment);
// Add the input files to a response file, and pass the response file on the command-line.
foreach (FileItem InputFile in LinkEnvironment.InputFiles)
{
System.Console.WriteLine("File {0} ", InputFile.AbsolutePath);
LinkAction.CommandArguments += string.Format(" \"{0}\"", InputFile.AbsolutePath);
LinkAction.PrerequisiteItems.Add(InputFile);
}
foreach (string InputFile in LinkEnvironment.Config.AdditionalLibraries)
{
FileItem Item = FileItem.GetItemByPath(InputFile);
if (Item.AbsolutePath.Contains(".lib"))
continue;
if (Item != null)
{
if (Item.ToString().Contains(".js"))
LinkAction.CommandArguments += string.Format(" --js-library \"{0}\"", Item.AbsolutePath);
else
LinkAction.CommandArguments += string.Format(" \"{0}\"", Item.AbsolutePath);
LinkAction.PrerequisiteItems.Add(Item);
}
}
// make the file we will create
OutputFile = FileItem.GetItemByPath(LinkEnvironment.Config.OutputFilePath);
LinkAction.ProducedItems.Add(OutputFile);
LinkAction.CommandArguments += string.Format(" -o \"{0}\"", OutputFile.AbsolutePath);
FileItem OutputBC = FileItem.GetItemByPath(LinkEnvironment.Config.OutputFilePath.Replace(".js", ".bc").Replace(".html", ".bc"));
LinkAction.ProducedItems.Add(OutputBC);
LinkAction.CommandArguments += string.Format(" --save-bc \"{0}\"", OutputBC.AbsolutePath);
LinkAction.StatusDescription = Path.GetFileName(OutputFile.AbsolutePath);
LinkAction.OutputEventHandler = new DataReceivedEventHandler(RemoteOutputReceivedEventHandler);
return OutputFile;
}
示例9: PostBuild
public override ICollection<FileItem> PostBuild(FileItem Executable, LinkEnvironment BinaryLinkEnvironment)
{
var OutputFiles = base.PostBuild(Executable, BinaryLinkEnvironment);
if (BinaryLinkEnvironment.Config.bIsBuildingLibrary)
{
return OutputFiles;
}
foreach (UEBuildBundleResource Resource in BinaryLinkEnvironment.Config.AdditionalBundleResources)
{
OutputFiles.Add(CopyBundleResource(Resource, Executable));
}
// If building for Mac on a Mac, use actions to finalize the builds (otherwise, we use Deploy)
if (BuildHostPlatform.Current.Platform != UnrealTargetPlatform.Mac)
{
return OutputFiles;
}
if (BinaryLinkEnvironment.Config.bIsBuildingDLL || BinaryLinkEnvironment.Config.bIsBuildingLibrary)
{
return OutputFiles;
}
FileItem FixDylibOutputFile = FixDylibDependencies(BinaryLinkEnvironment, Executable);
OutputFiles.Add(FixDylibOutputFile);
if (!BinaryLinkEnvironment.Config.bIsBuildingConsoleApplication)
{
OutputFiles.Add(FinalizeAppBundle(BinaryLinkEnvironment, Executable, FixDylibOutputFile));
}
return OutputFiles;
}
示例10: FixDylibDependencies
FileItem FixDylibDependencies(LinkEnvironment LinkEnvironment, FileItem Executable)
{
Action LinkAction = new Action(ActionType.Link);
LinkAction.WorkingDirectory = Path.GetFullPath(".");
LinkAction.CommandPath = "/bin/sh";
LinkAction.CommandDescription = "";
// Call the FixDylibDependencies.sh script which will link the dylibs and the main executable, this time proper ones, as it's called
// once all are already created, so the cross dependency problem no longer prevents linking.
// The script is deleted after it's executed so it's empty when we start appending link commands for the next executable.
FileItem FixDylibDepsScript = FileItem.GetItemByFullPath(Path.Combine(LinkEnvironment.Config.LocalShadowDirectory, "FixDylibDependencies.sh"));
FileItem RemoteFixDylibDepsScript = LocalToRemoteFileItem(FixDylibDepsScript, true);
LinkAction.CommandArguments = "-c 'chmod +x \"" + RemoteFixDylibDepsScript.AbsolutePath + "\"; \"" + RemoteFixDylibDepsScript.AbsolutePath + "\"; if [[ $? -ne 0 ]]; then exit 1; fi; ";
if (BuildHostPlatform.Current.Platform != UnrealTargetPlatform.Mac)
{
LinkAction.ActionHandler = new Action.BlockingActionHandler(RPCUtilHelper.RPCActionHandler);
}
// Make sure this action is executed after all the dylibs and the main executable are created
foreach (FileItem Dependency in BundleDependencies)
{
LinkAction.PrerequisiteItems.Add(Dependency);
}
BundleDependencies.Clear();
LinkAction.StatusDescription = string.Format("Fixing dylib dependencies for {0}", Path.GetFileName(Executable.AbsolutePath));
LinkAction.bCanExecuteRemotely = false;
FileItem OutputFile = FileItem.GetItemByPath(Path.Combine(LinkEnvironment.Config.LocalShadowDirectory, Path.GetFileNameWithoutExtension(Executable.AbsolutePath) + ".link"));
FileItem RemoteOutputFile = LocalToRemoteFileItem(OutputFile, false);
LinkAction.CommandArguments += "echo \"Dummy\" >> \"" + RemoteOutputFile.AbsolutePath + "\"";
LinkAction.CommandArguments += "'";
LinkAction.ProducedItems.Add(RemoteOutputFile);
return RemoteOutputFile;
}
示例11: GetLinkArguments_Global
string GetLinkArguments_Global( LinkEnvironment LinkEnvironment )
{
IOSPlatform BuildPlat = UEBuildPlatform.GetBuildPlatform(UnrealTargetPlatform.IOS) as IOSPlatform;
BuildPlat.SetUpProjectEnvironment(UnrealTargetPlatform.IOS);
string Result = "";
if (LinkEnvironment.Config.Target.Architecture == "-simulator")
{
Result += " -arch i386";
Result += " -isysroot " + XcodeDeveloperDir + "Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" + IOSSDKVersion + ".sdk";
}
else
{
Result += Result += GetArchitectureArgument(LinkEnvironment.Config.Target.Configuration, LinkEnvironment.Config.Target.Architecture);
Result += " -isysroot " + XcodeDeveloperDir + "Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" + IOSSDKVersion + ".sdk";
}
Result += " -dead_strip";
Result += " -miphoneos-version-min=" + BuildPlat.GetRunTimeVersion();
Result += " -Wl,-no_pie";
// Result += " -v";
// link in the frameworks
foreach (string Framework in LinkEnvironment.Config.Frameworks)
{
Result += " -framework " + Framework;
}
foreach (UEBuildFramework Framework in LinkEnvironment.Config.AdditionalFrameworks)
{
if ( Framework.OwningModule != null && Framework.FrameworkZipPath != null && Framework.FrameworkZipPath != "" )
{
// If this framework has a zip specified, we'll need to setup the path as well
Result += " -F \"" + GetRemoteIntermediateFrameworkZipPath( Framework ) + "\"";
}
Result += " -framework " + Framework.FrameworkName;
}
foreach (string Framework in LinkEnvironment.Config.WeakFrameworks)
{
Result += " -weak_framework " + Framework;
}
return Result;
}
示例12: SetupPrivateLinkEnvironment
/** Sets up the environment for linking this module. */
public virtual void SetupPrivateLinkEnvironment(
UEBuildBinary SourceBinary,
LinkEnvironment LinkEnvironment,
List<UEBuildBinary> BinaryDependencies,
Dictionary<UEBuildModule, bool> VisitedModules
)
{
// Allow the module's public dependencies to add library paths and additional libraries to the link environment.
SetupPublicLinkEnvironment(SourceBinary, LinkEnvironment.Config.LibraryPaths, LinkEnvironment.Config.AdditionalLibraries, LinkEnvironment.Config.Frameworks, LinkEnvironment.Config.WeakFrameworks,
LinkEnvironment.Config.AdditionalFrameworks,LinkEnvironment.Config.AdditionalShadowFiles, LinkEnvironment.Config.AdditionalBundleResources, LinkEnvironment.Config.DelayLoadDLLs, BinaryDependencies, VisitedModules);
// Also allow the module's public and private dependencies to modify the link environment.
List<string> AllDependencyModuleNames = new List<string>(PrivateDependencyModuleNames);
AllDependencyModuleNames.AddRange(PublicDependencyModuleNames);
foreach (var DependencyName in AllDependencyModuleNames)
{
var DependencyModule = Target.GetModuleByName(DependencyName);
DependencyModule.SetupPublicLinkEnvironment(SourceBinary, LinkEnvironment.Config.LibraryPaths, LinkEnvironment.Config.AdditionalLibraries, LinkEnvironment.Config.Frameworks, LinkEnvironment.Config.WeakFrameworks,
LinkEnvironment.Config.AdditionalFrameworks, LinkEnvironment.Config.AdditionalShadowFiles, LinkEnvironment.Config.AdditionalBundleResources, LinkEnvironment.Config.DelayLoadDLLs, BinaryDependencies, VisitedModules);
}
}
示例13: GetLinkArguments
static string GetLinkArguments(LinkEnvironment LinkEnvironment)
{
string Result = "";
// Prevents the linker from displaying its logo for each invocation.
Result += " /NOLOGO";
Result += " /TLBID:1";
// Don't create a side-by-side manifest file for the executable.
Result += " /MANIFEST:NO";
if (LinkEnvironment.Config.bCreateDebugInfo)
{
// Output debug info for the linked executable.
Result += " /DEBUG";
}
// Prompt the user before reporting internal errors to Microsoft.
Result += " /errorReport:prompt";
// Set machine type/ architecture to be 64 bit.
Result += " /MACHINE:x64";
Result += " /DYNAMICBASE \"d2d1.lib\" \"d3d11.lib\" \"dxgi.lib\" \"ole32.lib\" \"windowscodecs.lib\" \"dwrite.lib\" \"kernel32.lib\"";
// WinRT
// if (WinRTPlatform.ShouldCompileWinRT() == true)
{
// generate metadata
// Result += " /WINMD:ONLY";
Result += " /WINMD";
Result += " /APPCONTAINER";
// location of metadata
Result += string.Format(" /WINMDFILE:\"{0}\"", Path.ChangeExtension(LinkEnvironment.Config.OutputFilePath, "winmd"));
}
if (LinkEnvironment.Config.Target.Platform == CPPTargetPlatform.WinRT_ARM)
{
// Link for console.
Result += " /SUBSYSTEM:CONSOLE";
}
else
{
// Link for Windows.
Result += " /SUBSYSTEM:WINDOWS";
}
// Allow the OS to load the EXE at different base addresses than its preferred base address.
Result += " /FIXED:No";
// Explicitly declare that the executable is compatible with Data Execution Prevention.
Result += " /NXCOMPAT";
// Set the default stack size.
Result += " /STACK:5000000,5000000";
// Allow delay-loaded DLLs to be explicitly unloaded.
Result += " /DELAY:UNLOAD";
if (LinkEnvironment.Config.bIsBuildingDLL == true)
{
Result += " /DLL";
}
//
// ReleaseLTCG
//
if (BuildConfiguration.bAllowLTCG &&
LinkEnvironment.Config.Target.Configuration == CPPTargetConfiguration.Shipping)
{
// Use link-time code generation.
Result += " /LTCG";
// This is where we add in the PGO-Lite linkorder.txt if we are using PGO-Lite
//Result += " /ORDER:@linkorder.txt";
//Result += " /VERBOSE";
}
//
// Shipping binary
//
if (LinkEnvironment.Config.Target.Configuration == CPPTargetConfiguration.Shipping)
{
// Generate an EXE checksum.
Result += " /RELEASE";
// Eliminate unreferenced symbols.
Result += " /OPT:REF";
// Remove redundant COMDATs.
Result += " /OPT:ICF";
}
//
// Regular development binary.
//
else
{
//.........这里部分代码省略.........
示例14: GetLibArguments
static string GetLibArguments(LinkEnvironment LinkEnvironment)
{
string Result = "";
// Prevents the linker from displaying its logo for each invocation.
Result += " /NOLOGO";
// Prompt the user before reporting internal errors to Microsoft.
Result += " /errorReport:prompt";
// Set machine type/ architecture to be 64 bit.
Result += " /MACHINE:x64";
Result += " /SUBSYSTEM:WINDOWS";
//
// Shipping & LTCG
//
if (LinkEnvironment.Config.Target.Configuration == CPPTargetConfiguration.Shipping)
{
// Use link-time code generation.
Result += " /ltcg";
}
return Result;
}
示例15: LinkFiles
public override FileItem LinkFiles(LinkEnvironment LinkEnvironment, bool bBuildImportLibraryOnly)
{
if (LinkEnvironment.Config.bIsBuildingDotNetAssembly)
{
return FileItem.GetItemByPath(LinkEnvironment.Config.OutputFilePath);
}
bool bIsBuildingLibrary = LinkEnvironment.Config.bIsBuildingLibrary || bBuildImportLibraryOnly;
bool bIncludeDependentLibrariesInLibrary = bIsBuildingLibrary && LinkEnvironment.Config.bIncludeDependentLibrariesInLibrary;
// Create an action that invokes the linker.
Action LinkAction = new Action(ActionType.Link);
LinkAction.WorkingDirectory = Path.GetFullPath(".");
LinkAction.CommandPath = GetVCToolPath(
LinkEnvironment.Config.Target.Platform,
LinkEnvironment.Config.Target.Configuration,
bIsBuildingLibrary ? "lib" : "link");
// Get link arguments.
LinkAction.CommandArguments = bIsBuildingLibrary ?
GetLibArguments(LinkEnvironment) :
GetLinkArguments(LinkEnvironment);
// Tell the action that we're building an import library here and it should conditionally be
// ignored as a prerequisite for other actions
LinkAction.bProducesImportLibrary = bBuildImportLibraryOnly || LinkEnvironment.Config.bIsBuildingDLL;
// If we're only building an import library, add the '/DEF' option that tells the LIB utility
// to simply create a .LIB file and .EXP file, and don't bother validating imports
if (bBuildImportLibraryOnly)
{
LinkAction.CommandArguments += " /DEF";
// Ensure that the import library references the correct filename for the linked binary.
LinkAction.CommandArguments += string.Format(" /NAME:\"{0}\"", Path.GetFileName(LinkEnvironment.Config.OutputFilePath));
}
if (!LinkEnvironment.Config.bIsBuildingLibrary || (LinkEnvironment.Config.bIsBuildingLibrary && bIncludeDependentLibrariesInLibrary))
{
// Add the library paths to the argument list.
foreach (string LibraryPath in LinkEnvironment.Config.LibraryPaths)
{
LinkAction.CommandArguments += string.Format(" /LIBPATH:\"{0}\"", LibraryPath);
}
// Add the excluded default libraries to the argument list.
foreach (string ExcludedLibrary in LinkEnvironment.Config.ExcludedLibraries)
{
LinkAction.CommandArguments += string.Format(" /NODEFAULTLIB:\"{0}\"", ExcludedLibrary);
}
}
// For targets that are cross-referenced, we don't want to write a LIB file during the link step as that
// file will clobber the import library we went out of our way to generate during an earlier step. This
// file is not needed for our builds, but there is no way to prevent MSVC from generating it when
// linking targets that have exports. We don't want this to clobber our LIB file and invalidate the
// existing timstamp, so instead we simply emit it with a different name
string ImportLibraryFilePath = Path.Combine(LinkEnvironment.Config.IntermediateDirectory,
Path.GetFileNameWithoutExtension(LinkEnvironment.Config.OutputFilePath) + ".lib");
if (LinkEnvironment.Config.bIsCrossReferenced && !bBuildImportLibraryOnly)
{
ImportLibraryFilePath += ".suppressed";
}
FileItem OutputFile;
if (bBuildImportLibraryOnly)
{
OutputFile = FileItem.GetItemByPath(ImportLibraryFilePath);
}
else
{
OutputFile = FileItem.GetItemByPath(LinkEnvironment.Config.OutputFilePath);
OutputFile.bNeedsHotReloadNumbersDLLCleanUp = LinkEnvironment.Config.bIsBuildingDLL;
}
LinkAction.ProducedItems.Add(OutputFile);
LinkAction.StatusDescription = Path.GetFileName(OutputFile.AbsolutePath);
// Add the input files to a response file, and pass the response file on the command-line.
List<string> InputFileNames = new List<string>();
foreach (FileItem InputFile in LinkEnvironment.InputFiles)
{
InputFileNames.Add(string.Format("\"{0}\"", InputFile.AbsolutePath));
LinkAction.PrerequisiteItems.Add(InputFile);
}
if (!bBuildImportLibraryOnly)
{
// Add input libraries as prerequisites, too!
foreach (FileItem InputLibrary in LinkEnvironment.InputLibraries)
{
InputFileNames.Add(string.Format("\"{0}\"", InputLibrary.AbsolutePath));
LinkAction.PrerequisiteItems.Add(InputLibrary);
}
}
if (!bIsBuildingLibrary || (LinkEnvironment.Config.bIsBuildingLibrary && bIncludeDependentLibrariesInLibrary))
{
foreach (string AdditionalLibrary in LinkEnvironment.Config.AdditionalLibraries)
{
//.........这里部分代码省略.........