当前位置: 首页>>代码示例>>C#>>正文


C# LinkEnvironment.DeepCopy方法代码示例

本文整理汇总了C#中UnrealBuildTool.LinkEnvironment.DeepCopy方法的典型用法代码示例。如果您正苦于以下问题:C# LinkEnvironment.DeepCopy方法的具体用法?C# LinkEnvironment.DeepCopy怎么用?C# LinkEnvironment.DeepCopy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UnrealBuildTool.LinkEnvironment的用法示例。


在下文中一共展示了LinkEnvironment.DeepCopy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
        }
开发者ID:mymei,项目名称:UE4,代码行数:70,代码来源:UEBuildBinary.cs

示例2: SetupBinaryLinkEnvironment

        private LinkEnvironment SetupBinaryLinkEnvironment(LinkEnvironment LinkEnvironment, CPPEnvironment CompileEnvironment)
        {
            var BinaryLinkEnvironment = LinkEnvironment.DeepCopy();
            var LinkEnvironmentVisitedModules = new Dictionary<UEBuildModule, bool>();
            var BinaryDependencies = new List<UEBuildBinary>();
            CompileEnvironment.Config.bIsBuildingDLL = IsBuildingDll(Config.Type);
            CompileEnvironment.Config.bIsBuildingLibrary = IsBuildingLibrary(Config.Type);

            var BinaryCompileEnvironment = CompileEnvironment.DeepCopy();
            // @Hack: This to prevent UHT from listing CoreUObject.generated.cpp as its dependency.
            // We flag the compile environment when we build UHT so that we don't need to check
            // this for each file when generating their dependencies.
            BinaryCompileEnvironment.bHackHeaderGenerator = (Target.GetAppName() == "UnrealHeaderTool");

            // @todo: This should be in some Windows code somewhere...
            // Set the original file name macro; used in PCLaunch.rc to set the binary metadata fields.
            var OriginalFilename = (Config.OriginalOutputFilePaths != null) ?
                Path.GetFileName(Config.OriginalOutputFilePaths[0]) :
                Path.GetFileName(Config.OutputFilePaths[0]);
            BinaryCompileEnvironment.Config.Definitions.Add("ORIGINAL_FILE_NAME=\"" + OriginalFilename + "\"");

            foreach (var ModuleName in ModuleNames)
            {
                var Module = Target.GetModuleByName(ModuleName);

                List<FileItem> LinkInputFiles;
                if(Module.Binary == null || Module.Binary == this)
                {
                    // Compile each module.
                    Log.TraceVerbose("Compile module: " + ModuleName);
                    LinkInputFiles = Module.Compile(CompileEnvironment, BinaryCompileEnvironment);

                    // NOTE: Because of 'Shared PCHs', in monolithic builds the same PCH file may appear as a link input
                    // multiple times for a single binary.  We'll check for that here, and only add it once.  This avoids
                    // a linker warning about redundant .obj files.
                    foreach (var LinkInputFile in LinkInputFiles)
                    {
                        if (!BinaryLinkEnvironment.InputFiles.Contains(LinkInputFile))
                        {
                            BinaryLinkEnvironment.InputFiles.Add(LinkInputFile);
                        }
                    }
                }
                else
                {
                    BinaryDependencies.Add(Module.Binary);
                }

                if (!BuildConfiguration.bRunUnrealCodeAnalyzer)
                {
                    // Allow the module to modify the link environment for the binary.
                    Module.SetupPrivateLinkEnvironment(this, BinaryLinkEnvironment, BinaryDependencies, LinkEnvironmentVisitedModules);
                }
            }

            // Allow the binary dependencies to modify the link environment.
            foreach (var BinaryDependency in BinaryDependencies)
            {
                BinaryDependency.SetupDependentLinkEnvironment(BinaryLinkEnvironment);
            }

            // Remove the default resource file on Windows (PCLaunch.rc) if the user has specified their own
            if (BinaryLinkEnvironment.InputFiles.Select(Item => Path.GetFileName(Item.AbsolutePath).ToLower()).Any(Name => Name.EndsWith(".res") && !Name.EndsWith(".inl.res") && Name != "pclaunch.rc.res"))
            {
                BinaryLinkEnvironment.InputFiles.RemoveAll(x => Path.GetFileName(x.AbsolutePath).ToLower() == "pclaunch.rc.res");
            }

            // Set the link output file.
            BinaryLinkEnvironment.Config.OutputFilePaths = Config.OutputFilePaths != null ? (string[])Config.OutputFilePaths.Clone() : null;

            // 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.OutputFilePaths[0]);

            // Setup link output type
            BinaryLinkEnvironment.Config.bIsBuildingDLL = IsBuildingDll(Config.Type);
            BinaryLinkEnvironment.Config.bIsBuildingLibrary = IsBuildingLibrary(Config.Type);

            return BinaryLinkEnvironment;
        }
开发者ID:mymei,项目名称:UE4,代码行数:85,代码来源:UEBuildBinary.cs


注:本文中的UnrealBuildTool.LinkEnvironment.DeepCopy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。