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


C# CPPEnvironment.DeepCopy方法代码示例

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


在下文中一共展示了CPPEnvironment.DeepCopy方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateModuleCompileEnvironment

        /// <summary>
        /// Creates a compile environment from a base environment based on the module settings.
        /// </summary>
        /// <param name="BaseCompileEnvironment">An existing environment to base the module compile environment on.</param>
        /// <returns>The new module compile environment.</returns>
        public CPPEnvironment CreateModuleCompileEnvironment(CPPEnvironment BaseCompileEnvironment)
        {
            var Result = BaseCompileEnvironment.DeepCopy();

            // Override compile environment
            Result.Config.bFasterWithoutUnity                    = bFasterWithoutUnity;
            Result.Config.OptimizeCode                           = OptimizeCode;
            Result.Config.bUseRTTI                               = bUseRTTI;
            Result.Config.bUseAVX                                = bUseAVX;
            Result.Config.bEnableBufferSecurityChecks            = bEnableBufferSecurityChecks;
            Result.Config.bFasterWithoutUnity                    = bFasterWithoutUnity;
            Result.Config.MinFilesUsingPrecompiledHeaderOverride = MinFilesUsingPrecompiledHeaderOverride;
            Result.Config.bBuildLocallyWithSNDBS				 = bBuildLocallyWithSNDBS;
            Result.Config.bEnableExceptions                      = bEnableExceptions;
            Result.Config.bEnableShadowVariableWarning          = bEnableShadowVariableWarnings;
            Result.Config.bUseStaticCRT							 = (Target.Rules != null && Target.Rules.bUseStaticCRT);
            Result.Config.OutputDirectory                        = Path.Combine(Binary.Config.IntermediateDirectory, Name);

            // Switch the optimization flag if we're building a game module. Also pass the definition for building in DebugGame along (see ModuleManager.h for notes).
            if (Target.Configuration == UnrealTargetConfiguration.DebugGame)
            {
                if(!Utils.IsFileUnderDirectory(ModuleDirectory, BuildConfiguration.RelativeEnginePath))
                {
                    Result.Config.Target.Configuration = CPPTargetConfiguration.Debug;
                    Result.Config.Definitions.Add("UE_BUILD_DEVELOPMENT_WITH_DEBUGGAME=1");
                }
            }

            // Add the module's private definitions.
            Result.Config.Definitions.AddRange(Definitions);

            // Setup the compile environment for the module.
            SetupPrivateCompileEnvironment(Result.Config.CPPIncludeInfo.IncludePaths, Result.Config.CPPIncludeInfo.SystemIncludePaths, Result.Config.Definitions, Result.Config.AdditionalFrameworks);

            // @hack to skip adding definitions to compile environment, they will be baked into source code files
            if (bSkipDefinitionsForCompileEnvironment)
            {
                Result.Config.Definitions.Clear();
                Result.Config.CPPIncludeInfo.IncludePaths = new HashSet<string>(BaseCompileEnvironment.Config.CPPIncludeInfo.IncludePaths);
            }

            return Result;
        }
开发者ID:colwalder,项目名称:unrealengine,代码行数:48,代码来源:UEBuildModule.cs

示例2: Compile

        // UEBuildModule interface.
        public override List<FileItem> Compile( CPPEnvironment GlobalCompileEnvironment, CPPEnvironment CompileEnvironment )
        {
            var ModuleCLREnvironment = CompileEnvironment.DeepCopy();

            // Setup the module environment for the project CLR mode
            ModuleCLREnvironment.Config.CLRMode = CPPCLRMode.CLREnabled;

            // Add the private assembly references to the compile environment.
            foreach(var PrivateAssemblyReference in PrivateAssemblyReferences)
            {
                ModuleCLREnvironment.AddPrivateAssembly(PrivateAssemblyReference);
            }

            // Pass the CLR compilation environment to the standard C++ module compilation code.
            return base.Compile(GlobalCompileEnvironment, ModuleCLREnvironment );
        }
开发者ID:colwalder,项目名称:unrealengine,代码行数:17,代码来源:UEBuildModule.cs

示例3: GeneratePCHCreationAction

        /// <summary>
        /// Creates a precompiled header action to generate a new pch file 
        /// </summary>
        /// <param name="PCHHeaderNameInCode">The precompiled header name as it appeared in an #include statement</param>
        /// <param name="PrecompiledHeaderIncludeFilename">Name of the header used for pch.</param>
        /// <param name="ProjectCPPEnvironment">The environment the C/C++ files in the project are compiled with.</param>
        /// <param name="OutputDirectory">The folder to save the generated PCH file to</param>
        /// <param name="ModuleName">Name of the module this PCH is being generated for</param>
        /// <param name="bAllowDLLExports">True if we should allow DLLEXPORT definitions for this PCH</param>
        /// <returns>the compilation output result of the created pch.</returns>
        public static CPPOutput GeneratePCHCreationAction(UEBuildTarget Target, string PCHHeaderNameInCode, FileItem PrecompiledHeaderIncludeFilename, CPPEnvironment ProjectCPPEnvironment, string OutputDirectory, string ModuleName, bool bAllowDLLExports )
        {
            // Find the header file to be precompiled. Don't skip external headers
            if (PrecompiledHeaderIncludeFilename.bExists)
            {
                // Create a Dummy wrapper around the PCH to avoid problems with #pragma once on clang
                var ToolChain = UEToolChain.GetPlatformToolChain(ProjectCPPEnvironment.Config.Target.Platform);
                string PCHGuardDefine = Path.GetFileNameWithoutExtension(PrecompiledHeaderIncludeFilename.AbsolutePath).ToUpper();
                string LocalPCHHeaderNameInCode = ToolChain.ConvertPath(PrecompiledHeaderIncludeFilename.AbsolutePath);
                string TmpPCHHeaderContents = String.Format("#ifndef __AUTO_{0}_H__\n#define __AUTO_{0}_H__\n//Last Write: {2}\n#include \"{1}\"\n#endif//__AUTO_{0}_H__", PCHGuardDefine, LocalPCHHeaderNameInCode, PrecompiledHeaderIncludeFilename.LastWriteTime);
                string DummyPath = Path.Combine(
                    ProjectCPPEnvironment.Config.OutputDirectory,
                    Path.GetFileName(PrecompiledHeaderIncludeFilename.AbsolutePath));
                FileItem DummyPCH = FileItem.CreateIntermediateTextFile(DummyPath, TmpPCHHeaderContents);

                // Create a new C++ environment that is used to create the PCH.
                var ProjectPCHEnvironment = ProjectCPPEnvironment.DeepCopy();
                ProjectPCHEnvironment.Config.PrecompiledHeaderAction = PrecompiledHeaderAction.Create;
                ProjectPCHEnvironment.Config.PrecompiledHeaderIncludeFilename = PrecompiledHeaderIncludeFilename.AbsolutePath;
                ProjectPCHEnvironment.Config.PCHHeaderNameInCode = PCHHeaderNameInCode;
                ProjectPCHEnvironment.Config.OutputDirectory = OutputDirectory;

                if( !bAllowDLLExports )
                {
                    for( var CurDefinitionIndex = 0; CurDefinitionIndex < ProjectPCHEnvironment.Config.Definitions.Count; ++CurDefinitionIndex )
                    {
                        // We change DLLEXPORT to DLLIMPORT for "shared" PCH headers
                        var OldDefinition = ProjectPCHEnvironment.Config.Definitions[ CurDefinitionIndex ];
                        if( OldDefinition.EndsWith( "=DLLEXPORT" ) )
                        {
                            ProjectPCHEnvironment.Config.Definitions[ CurDefinitionIndex ] = OldDefinition.Replace( "DLLEXPORT", "DLLIMPORT" );
                        }
                    }
                }

                // Cache our CPP environment so that we can check for outdatedness quickly.  Only files that have includes need this.
                DummyPCH.CachedCPPIncludeInfo = ProjectPCHEnvironment.Config.CPPIncludeInfo;

                Log.TraceVerbose( "Found PCH file \"{0}\".", PrecompiledHeaderIncludeFilename );

                // Create the action to compile the PCH file.
                return ProjectPCHEnvironment.CompileFiles(Target, new List<FileItem>() { DummyPCH }, ModuleName);
            }
            throw new BuildException( "Couldn't find PCH file \"{0}\".", PrecompiledHeaderIncludeFilename );
        }
开发者ID:colwalder,项目名称:unrealengine,代码行数:55,代码来源:UEBuildModule.cs

示例4: 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

示例5: CreateModuleCompileEnvironment

		/// <summary>
		/// Creates a compile environment from a base environment based on the module settings.
		/// </summary>
		/// <param name="BaseCompileEnvironment">An existing environment to base the module compile environment on.</param>
		/// <returns>The new module compile environment.</returns>
		public CPPEnvironment CreateModuleCompileEnvironment(UEBuildTarget Target, CPPEnvironment BaseCompileEnvironment)
		{
			CPPEnvironment Result = BaseCompileEnvironment.DeepCopy();

            if (Binary == null)
            {
                // Adding this check here as otherwise the call to Binary.Config.IntermediateDirectory will give an 
                // unhandled exception
                throw new BuildException("UEBuildBinary not set up for module {0}", this.ToString());
            }

			// Override compile environment
			Result.Config.bFasterWithoutUnity = Rules.bFasterWithoutUnity;
			Result.Config.OptimizeCode = Rules.OptimizeCode;
			Result.Config.bUseRTTI = Rules.bUseRTTI;
			Result.Config.bUseAVX = Rules.bUseAVX;
			Result.Config.bEnableBufferSecurityChecks = Rules.bEnableBufferSecurityChecks;
			Result.Config.MinSourceFilesForUnityBuildOverride = Rules.MinSourceFilesForUnityBuildOverride;
			Result.Config.MinFilesUsingPrecompiledHeaderOverride = Rules.MinFilesUsingPrecompiledHeaderOverride;
			Result.Config.bBuildLocallyWithSNDBS = Rules.bBuildLocallyWithSNDBS;
			Result.Config.bEnableExceptions = Rules.bEnableExceptions;
			Result.Config.bEnableShadowVariableWarning = Rules.bEnableShadowVariableWarnings;
			Result.Config.bUseStaticCRT = (Target.Rules != null && Target.Rules.bUseStaticCRT);
			Result.Config.OutputDirectory = DirectoryReference.Combine(Binary.Config.IntermediateDirectory, Name);

			// Switch the optimization flag if we're building a game module. Also pass the definition for building in DebugGame along (see ModuleManager.h for notes).
			if (Target.Configuration == UnrealTargetConfiguration.DebugGame)
			{
				if (!ModuleDirectory.IsUnderDirectory(UnrealBuildTool.EngineDirectory))
				{
					Result.Config.Target.Configuration = CPPTargetConfiguration.Debug;
					Result.Config.Definitions.Add("UE_BUILD_DEVELOPMENT_WITH_DEBUGGAME=1");
				}
			}

			// Add the module's private definitions.
			Result.Config.Definitions.AddRange(Definitions);

			// Setup the compile environment for the module.
			SetupPrivateCompileEnvironment(Result.Config.CPPIncludeInfo.IncludePaths, Result.Config.CPPIncludeInfo.SystemIncludePaths, Result.Config.Definitions, Result.Config.AdditionalFrameworks);

			// @hack to skip adding definitions to compile environment, they will be baked into source code files
			if (bSkipDefinitionsForCompileEnvironment)
			{
				Result.Config.Definitions.Clear();
				Result.Config.CPPIncludeInfo.IncludePaths = new HashSet<string>(BaseCompileEnvironment.Config.CPPIncludeInfo.IncludePaths);
			}

			return Result;
		}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:55,代码来源:UEBuildModule.cs

示例6: CreateModuleCompileEnvironment

        /// <summary>
        /// Creates a compile environment from a base environment based on the module settings.
        /// </summary>
        /// <param name="BaseCompileEnvironment">An existing environment to base the module compile environment on.</param>
        /// <returns>The new module compile environment.</returns>
        public CPPEnvironment CreateModuleCompileEnvironment(CPPEnvironment BaseCompileEnvironment)
        {
            var Result = BaseCompileEnvironment.DeepCopy();

            // Override compile environment
            Result.Config.bFasterWithoutUnity                    = bFasterWithoutUnity;
            Result.Config.OptimizeCode                           = OptimizeCode;
            Result.Config.bUseRTTI                               = bUseRTTI;
            Result.Config.bEnableBufferSecurityChecks            = bEnableBufferSecurityChecks;
            Result.Config.bFasterWithoutUnity                    = bFasterWithoutUnity;
            Result.Config.MinFilesUsingPrecompiledHeaderOverride = MinFilesUsingPrecompiledHeaderOverride;
            Result.Config.bEnableExceptions                      = bEnableExceptions;
            Result.Config.bUseStaticCRT							 = (Target.Rules != null && Target.Rules.bUseStaticCRT);
            Result.Config.OutputDirectory                        = Path.Combine(Binary.Config.IntermediateDirectory, Name);

            // Switch the optimization flag if we're building a game module. Also pass the definition for building in DebugGame along (see ModuleManager.h for notes).
            if (Target.Configuration == UnrealTargetConfiguration.DebugGame)
            {
                PluginInfo Plugin = Plugins.GetPluginInfoForModule(Name);
                if((Plugin != null && Plugin.LoadedFrom == PluginInfo.LoadedFromType.GameProject) || Type == UEBuildModuleType.Game)
                {
                    Result.Config.Target.Configuration = CPPTargetConfiguration.Debug;
                    Result.Config.Definitions.Add("UE_BUILD_DEVELOPMENT_WITH_DEBUGGAME=1");
                }
            }

            // Add the module's private definitions.
            Result.Config.Definitions.AddRange(Definitions);

            // Setup the compile environment for the module.
            SetupPrivateCompileEnvironment(ref Result.Config.CPPIncludeInfo.IncludePaths, ref Result.Config.CPPIncludeInfo.SystemIncludePaths, ref Result.Config.Definitions, ref Result.Config.AdditionalFrameworks);

            // @hack to skip adding definitions to compile environment, they will be baked into source code files
            if (bSkipDefinitionsForCompileEnvironment)
            {
                Result.Config.Definitions.Clear();
                Result.Config.CPPIncludeInfo.IncludePaths = new HashSet<string>(BaseCompileEnvironment.Config.CPPIncludeInfo.IncludePaths);
            }

            return Result;
        }
开发者ID:kidaa,项目名称:UnrealEngineVR,代码行数:46,代码来源:UEBuildModule.cs


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