本文整理汇总了C#中UnrealBuildTool.LinkEnvironment.LinkExecutable方法的典型用法代码示例。如果您正苦于以下问题:C# LinkEnvironment.LinkExecutable方法的具体用法?C# LinkEnvironment.LinkExecutable怎么用?C# LinkEnvironment.LinkExecutable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnrealBuildTool.LinkEnvironment
的用法示例。
在下文中一共展示了LinkEnvironment.LinkExecutable方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetupOutputFiles
private List<FileItem> SetupOutputFiles(IUEToolChain TargetToolChain, ref LinkEnvironment BinaryLinkEnvironment)
{
// Early exits first
if (ProjectFileGenerator.bGenerateProjectFiles)
{
// We're generating projects. Since we only need include paths and definitions, there is no need
// to go ahead and run through the linking logic.
return BinaryLinkEnvironment.InputFiles;
}
if (BuildConfiguration.bEnableCodeAnalysis)
{
// We're only analyzing code, so we won't actually link any executables. Instead, our output
// files will simply be the .obj files that were compiled during static analysis.
return BinaryLinkEnvironment.InputFiles;
}
if (BuildConfiguration.bRunUnrealCodeAnalyzer)
{
//
// Create actions to analyze *.includes files and provide suggestions on how to modify PCH.
//
return CreateOutputFilesForUCA(BinaryLinkEnvironment);
}
//
// Regular linking action.
//
var OutputFiles = new List<FileItem>();
if (bCreateImportLibrarySeparately)
{
// Mark the link environment as cross-referenced.
BinaryLinkEnvironment.Config.bIsCrossReferenced = true;
if (BinaryLinkEnvironment.Config.Target.Platform != CPPTargetPlatform.Mac && BinaryLinkEnvironment.Config.Target.Platform != CPPTargetPlatform.Linux)
{
// Create the import library.
OutputFiles.AddRange(BinaryLinkEnvironment.LinkExecutable(true));
}
}
BinaryLinkEnvironment.Config.bIncludeDependentLibrariesInLibrary = bIncludeDependentLibrariesInLibrary;
// Link the binary.
FileItem[] Executables = BinaryLinkEnvironment.LinkExecutable(false);
OutputFiles.AddRange(Executables);
// Produce additional console app if requested
if (Config.bBuildAdditionalConsoleApp)
{
// Produce additional binary but link it as a console app
var ConsoleAppLinkEvironment = BinaryLinkEnvironment.DeepCopy();
ConsoleAppLinkEvironment.Config.bIsBuildingConsoleApplication = true;
ConsoleAppLinkEvironment.Config.WindowsEntryPointOverride = "WinMainCRTStartup"; // For WinMain() instead of "main()" for Launch module
for (int Index = 0; Index < Config.OutputFilePaths.Length; Index++)
{
ConsoleAppLinkEvironment.Config.OutputFilePaths[Index] = GetAdditionalConsoleAppPath(ConsoleAppLinkEvironment.Config.OutputFilePaths[Index]);
}
// Link the console app executable
OutputFiles.AddRange(ConsoleAppLinkEvironment.LinkExecutable(false));
}
foreach (var Executable in Executables)
{
OutputFiles.AddRange(TargetToolChain.PostBuild(Executable, BinaryLinkEnvironment));
}
return OutputFiles;
}
示例2: Compile
//.........这里部分代码省略.........
var CPPFilesToCompile = CPPFiles;
if (bModuleUsesUnityBuild)
{
CPPFilesToCompile = Unity.GenerateUnityCPPs( CPPFilesToCompile, ModuleCompileEnvironment, Name );
}
LinkInputFiles.AddRange( ModuleCompileEnvironment.CompileFiles( CPPFilesToCompile, Name ).ObjectFiles );
}
}
// Compile C files directly.
LinkInputFiles.AddRange(ModuleCompileEnvironment.CompileFiles(CFiles, Name).ObjectFiles);
// Compile CC files directly.
LinkInputFiles.AddRange(ModuleCompileEnvironment.CompileFiles(CCFiles, Name).ObjectFiles);
// Compile MM files directly.
LinkInputFiles.AddRange(ModuleCompileEnvironment.CompileFiles(MMFiles, Name).ObjectFiles);
// If we're building Rocket, generate a static library for this module
if(RedistStaticLibraryPath != null)
{
// Create a link environment for it
LinkEnvironment RedistLinkEnvironment = new LinkEnvironment();
RedistLinkEnvironment.InputFiles.AddRange(LinkInputFiles);
RedistLinkEnvironment.Config.TargetArchitecture = CompileEnvironment.Config.TargetArchitecture;
RedistLinkEnvironment.Config.TargetConfiguration = CompileEnvironment.Config.TargetConfiguration;
RedistLinkEnvironment.Config.TargetPlatform = CompileEnvironment.Config.TargetPlatform;
RedistLinkEnvironment.Config.bIsBuildingDLL = false;
RedistLinkEnvironment.Config.bIsBuildingLibrary = true;
RedistLinkEnvironment.Config.IntermediateDirectory = Binary.Config.IntermediateDirectory;
RedistLinkEnvironment.Config.OutputFilePath = RedistStaticLibraryPath;
// Replace the items built so far with the library
FileItem RedistLibrary = RedistLinkEnvironment.LinkExecutable(false);
LinkInputFiles.Clear();
}
// Compile RC files.
LinkInputFiles.AddRange(ModuleCompileEnvironment.CompileRCFiles(RCFiles).ObjectFiles);
// Keep track of this module's public and private UObject source files, so that we can pass those off to UHT if needed
{
string ModuleSourceFolder = Path.GetFullPath( this.ModuleDirectory );
var ModuleClassesSourceFolder = Path.Combine( ModuleSourceFolder, "Classes" ); // @todo uht: Want to deprecate this eventually
foreach( var SourceFile in SourceFiles )
{
// Will always be a cache hit (we did this earlier during Compile())
var IncludedFiles = ModuleCompileEnvironment.GetIncludeDependencies( SourceFile );
// Also check for intrinsic classes like "Object.h", which are special cases because they are never included in compiled code and exist only for UHT to parse
{
// Runtime/CoreUObject/Classes/Object.h
{
var IntrinsicFileItem = FileItem.GetExistingItemByPath( Path.Combine( ProjectFileGenerator.EngineRelativePath, "Source", "Runtime", Path.Combine( "CoreUObject", "Classes", "Object.h" ) ) ); // @todo uht: In Classes folder right now
if( !IntrinsicFileItem.bExists )
{
throw new BuildException( "Expecting " + IntrinsicFileItem.AbsolutePath + " to exist" );
}
IntrinsicFileItem.HasUObjects = true;
IncludedFiles.Add( IntrinsicFileItem );
}
// Runtime/Engine/Classes/Model.h
{
var IntrinsicFileItem = FileItem.GetExistingItemByPath( Path.Combine( ProjectFileGenerator.EngineRelativePath, "Source", "Runtime", Path.Combine( "Engine", "Classes", "Intrinsic", "Model.h" ) ) ); // @todo uht: In Classes folder right now
if( !IntrinsicFileItem.bExists )
示例3: Build
//.........这里部分代码省略.........
// Allow the binary dependencies to modify the link environment.
foreach(var BinaryDependency in BinaryDependencies)
{
BinaryDependency.SetupDependentLinkEnvironment(ref BinaryLinkEnvironment);
}
// Set the link output file.
BinaryLinkEnvironment.Config.OutputFilePath = Config.OutputFilePath;
// Set whether the link is allowed to have exports.
BinaryLinkEnvironment.Config.bHasExports = Config.bAllowExports;
// Set the output folder for intermediate files
BinaryLinkEnvironment.Config.IntermediateDirectory = Config.IntermediateDirectory;
// Put the non-executable output files (PDB, import library, etc) in the same directory as the production
BinaryLinkEnvironment.Config.OutputDirectory = Path.GetDirectoryName(Config.OutputFilePath);
// Determine the type of binary we're linking.
switch (Config.Type)
{
case UEBuildBinaryType.DynamicLinkLibrary:
BinaryLinkEnvironment.Config.bIsBuildingDLL = true;
BinaryLinkEnvironment.Config.bIsBuildingLibrary = false;
break;
case UEBuildBinaryType.StaticLibrary:
BinaryLinkEnvironment.Config.bIsBuildingDLL = false;
BinaryLinkEnvironment.Config.bIsBuildingLibrary = true;
break;
default:
BinaryLinkEnvironment.Config.bIsBuildingDLL = false;
BinaryLinkEnvironment.Config.bIsBuildingLibrary = false;
break;
};
if( ProjectFileGenerator.bGenerateProjectFiles )
{
// We're generating projects. Since we only need include paths and definitions, there is no need
// to go ahead and run through the linking logic.
OutputFiles = BinaryLinkEnvironment.InputFiles;
}
else if( BuildConfiguration.bEnableCodeAnalysis )
{
// We're only analyzing code, so we won't actually link any executables. Instead, our output
// files will simply be the .obj files that were compiled during static analysis.
OutputFiles = BinaryLinkEnvironment.InputFiles;
}
else
{
if(bCreateImportLibrarySeparately)
{
// Mark the link environment as cross-referenced.
BinaryLinkEnvironment.Config.bIsCrossReferenced = true;
if (BinaryLinkEnvironment.Config.TargetPlatform != CPPTargetPlatform.Mac)
{
// Create the import library.
OutputFiles.Add(BinaryLinkEnvironment.LinkExecutable(true));
}
}
BinaryLinkEnvironment.Config.bIncludeDependentLibrariesInLibrary = bIncludeDependentLibrariesInLibrary;
// Link the binary.
FileItem Executable = BinaryLinkEnvironment.LinkExecutable(false);
OutputFiles.Add(Executable);
// Produce additional console app if requested
if (BinaryLinkEnvironment.Config.CanProduceAdditionalConsoleApp && UEBuildConfiguration.bBuildEditor)
{
// Produce additional binary but link it as a console app
LinkEnvironment ConsoleAppLinkEvironment = new LinkEnvironment(BinaryLinkEnvironment);
ConsoleAppLinkEvironment.Config.bIsBuildingConsoleApplication = true;
ConsoleAppLinkEvironment.Config.WindowsEntryPointOverride = "WinMainCRTStartup"; // For WinMain() instead of "main()" for Launch module
ConsoleAppLinkEvironment.Config.OutputFilePath = GetAdditionalConsoleAppPath(ConsoleAppLinkEvironment.Config.OutputFilePath);
// Link the console app executable
OutputFiles.Add(ConsoleAppLinkEvironment.LinkExecutable(false));
}
// if building for Mac on a Mac, use actions to finalize the builds (otherwise, we use Deploy)
if (ExternalExecution.GetRuntimePlatform() == UnrealTargetPlatform.Mac &&
BinaryLinkEnvironment.Config.TargetPlatform == CPPTargetPlatform.Mac)
{
if (!BinaryLinkEnvironment.Config.bIsBuildingDLL && !BinaryLinkEnvironment.Config.bIsBuildingLibrary)
{
MacToolChain Mac = (MacToolChain)UEToolChain.GetPlatformToolChain(CPPTargetPlatform.Mac);
FileItem FixDylibOutputFile = Mac.FixDylibDependencies(BinaryLinkEnvironment, Executable);
OutputFiles.Add(FixDylibOutputFile);
if (!BinaryLinkEnvironment.Config.bIsBuildingConsoleApplication)
{
OutputFiles.Add(Mac.CreateAppBundle(BinaryLinkEnvironment, Executable, FixDylibOutputFile));
}
}
}
}
return OutputFiles;
}
示例4: Compile
//.........这里部分代码省略.........
PCHModuleName = "Shared";
}
var PCHOutput = PrecompileHeaderEnvironment.GeneratePCHCreationAction(
Target,
CPPFilesToBuild[0].PCHHeaderNameInCode,
ModulePCHEnvironment.PrecompiledHeaderIncludeFilename,
ModuleCompileEnvironment,
PCHOutputDirectory,
PCHModuleName,
bAllowDLLExports );
ModulePCHEnvironment.PrecompiledHeaderFile = PCHOutput.PrecompiledHeaderFile;
ModulePCHEnvironment.OutputObjectFiles.Clear();
ModulePCHEnvironment.OutputObjectFiles.AddRange( PCHOutput.ObjectFiles );
}
else if( CPPFilesToBuild.Count < MinFilesUsingPrecompiledHeader )
{
Log.TraceVerbose( "Module " + Name + " doesn't use a Shared PCH, and only has " + CPPFilesToBuild.Count.ToString() + " unity source file(s). No Unique PCH will be generated." );
}
}
if( ModulePCHEnvironment.PrecompiledHeaderFile != null )
{
// Link in the object files produced by creating the precompiled header.
LinkInputFiles.AddRange( ModulePCHEnvironment.OutputObjectFiles );
// if pch action was generated for the environment then use pch
ModulePCHCompileEnvironment.PrecompiledHeaderFile = ModulePCHEnvironment.PrecompiledHeaderFile;
// Use this compile environment from now on
CPPCompileEnvironment = ModulePCHCompileEnvironment;
}
LinkInputFiles.AddRange( CPPCompileEnvironment.CompileFiles( Target, CPPFilesToBuild, Name ).ObjectFiles );
bWasModuleCodeCompiled = true;
}
if( BuildConfiguration.bPrintPerformanceInfo )
{
var PCHGenTime = ( DateTime.UtcNow - PCHGenTimerStart ).TotalSeconds;
TotalPCHGenTime += PCHGenTime;
}
}
if( !bWasModuleCodeCompiled && SourceFilesToBuild.CPPFiles.Count > 0 )
{
var CPPFilesToCompile = SourceFilesToBuild.CPPFiles;
if (bModuleUsesUnityBuild)
{
CPPFilesToCompile = Unity.GenerateUnityCPPs( Target, CPPFilesToCompile, CPPCompileEnvironment, Name );
}
LinkInputFiles.AddRange( CPPCompileEnvironment.CompileFiles( Target, CPPFilesToCompile, Name ).ObjectFiles );
}
if (AutoGenerateCppInfo != null && AutoGenerateCppInfo.BuildInfo != null && !CPPCompileEnvironment.bHackHeaderGenerator)
{
string[] GeneratedFiles = Directory.GetFiles(Path.GetDirectoryName(AutoGenerateCppInfo.BuildInfo.FileWildcard), Path.GetFileName(AutoGenerateCppInfo.BuildInfo.FileWildcard));
foreach (string GeneratedFilename in GeneratedFiles)
{
var GeneratedCppFileItem = FileItem.GetItemByPath(GeneratedFilename);
CachePCHUsageForModuleSourceFile(this.Target, CPPCompileEnvironment, GeneratedCppFileItem);
// @todo fastubt: Check for ALL other places where we might be injecting .cpp or .rc files for compiling without caching CachedCPPIncludeInfo first (anything platform specfic?)
LinkInputFiles.AddRange(CPPCompileEnvironment.CompileFiles(Target, new List<FileItem> { GeneratedCppFileItem }, Name).ObjectFiles);
}
}
// Compile C files directly.
LinkInputFiles.AddRange(CPPCompileEnvironment.CompileFiles( Target, SourceFilesToBuild.CFiles, Name).ObjectFiles);
// Compile CC files directly.
LinkInputFiles.AddRange(CPPCompileEnvironment.CompileFiles( Target, SourceFilesToBuild.CCFiles, Name).ObjectFiles);
// Compile MM files directly.
LinkInputFiles.AddRange(CPPCompileEnvironment.CompileFiles( Target, SourceFilesToBuild.MMFiles, Name).ObjectFiles);
// If we're building Rocket, generate a static library for this module
if(RedistStaticLibraryPaths != null)
{
// Create a link environment for it
LinkEnvironment RedistLinkEnvironment = new LinkEnvironment();
RedistLinkEnvironment.InputFiles.AddRange(LinkInputFiles);
RedistLinkEnvironment.Config.Target = CompileEnvironment.Config.Target;
RedistLinkEnvironment.Config.bIsBuildingDLL = false;
RedistLinkEnvironment.Config.bIsBuildingLibrary = true;
RedistLinkEnvironment.Config.IntermediateDirectory = Binary.Config.IntermediateDirectory;
RedistLinkEnvironment.Config.OutputFilePaths = RedistStaticLibraryPaths != null ? (string[])RedistStaticLibraryPaths.Clone() : null;
// Replace the items built so far with the library
RedistLinkEnvironment.LinkExecutable(false);
LinkInputFiles.Clear();
}
// Compile RC files.
LinkInputFiles.AddRange(CPPCompileEnvironment.CompileRCFiles(Target, SourceFilesToBuild.RCFiles).ObjectFiles);
return LinkInputFiles;
}