查看: 790|回复: 6

UE4编译工具部分文档翻译

[复制链接]

1

主题

342

帖子

7万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
75866
发表于 2015-9-30 21:31:19 | 显示全部楼层 |阅读模式




一篇不错的文章,有关于UE4的多模块编程,本人英语比较烂,翻译了2个小时,可能有很多错误,还请大家多多捧场http://tyrealgray.tumblr.com/post/120276870607/4原文地址http://docs.unrealengine.com/latest/INT/Programming/UnrealBuildSystem/TargetFiles/index.htmlUnreal BuildSystem Target Files虚幻构建操作系统的目标文件Unreal Engine 4.5Overview总览The Unreal BuildSystem makes use of Target files for each application UnrealBuildTool builds thatget compiledinto the dynamic Rules module. These files replace the old UEBuild*.cs files that were originallycompiled directly into UnrealBuildTool. Each target file defines a class usedby UnrealBuildtool to determine how a game or program is built.虚幻构建操作系统使用每个目标文件给每个使用虚幻构建工具所编译的应用程序设定了动态的规则模式。(这句是我脑补的,意思就是这个目标文件就是用于设定编译规则的)那些编译成动态规则模式。这些文件取代了那些旧的,直接使用虚幻构建工具编译的UEBuild*.cs文件。每个目标文件定义了一个类用于虚幻构建工具去决定,一个游戏或者一个程序如何构建。UnrealBuildToolnow retrieves the proper target for the project being built from the RulesModule.dll.这句不会翻译There are 2types of target:他们有2种目标·  Game - This is a target that utilizes the 'shared' UE4executable.·  游戏-这个目标是使用虚幻4的‘shared’来实现的。·  Program - This is a target that is a stand-alone executable. ShaderCompileWorker,SlateViewer, and UnrealHeaderTool are this type of target.·  程序 -这个目标是单独实现。ShaderCompileWorker, SlateViewer, 和UnrealHeaderTool都是这种类型。Target FileNaming and Location目标文件的命名与本地目录The Target filemust be located in the root directory of a program or Source directory of a game and be named using the convention:[APPNAME].Target.cs目标文件必须位于程序的根目录或者游戏源文件的目录下。同时需要命名成:你的应用名称.Target.cs(这个你看一下C++新建的工程下的CS文件就知道了)As an example,the ShaderCompileWorkerprogram directory at \UE4\Engine\Source\Programs\ShaderCompileWorker contains theShaderCompileWorker.Target.cs file.一个案例,ShaderCompileWorker程序的目录在\UE4\Engine\Source\Programs\ShaderCompileWorker他的目标文件为ShaderCompileWorker.Target.cs Similarly, theExampleGame Source directory located at UE4\ExampleGame|Source contains the ExampleGame.Target.cs file.上面说的很清楚,这句就不翻译了Target File Contents目标文件内容The classdefined in the Target file for each game or program is derived from TargetRules (found in RulesCompiler.cs).在每个游戏或者程序的目标文件中的类的定义内容都源于TargetRules(目标规则)(具体的在RulesCompiler.cs中)(这句话的意思就是说每个目标文件中定义的内容都是和目标规则有关,所以你想要完全了解这个规则就需要去看RulesCompiler.cs文件)The name of theclass is constructed by adding the name of the tool or game followed by target. For instance, the class defined in the target file forthe ShaderCompileWorker tool would be ShaderCompileWorkerTarget. The Target at the end is REQUIRED. It was added to avoid name collisions with the existing *.Build.cs module rules classes, since they all get compiled intothe same DLL.类的名称是被添加的工具或者游戏的目标文件构建的,比如说,类在目标文件中定义ShaderCompileWorker,(虚幻构建)工具将会生成ShaderCompileWorkerTarget。目标文件在最后悔请求,它会添加避免名字存在重复的 *.Build.cs模式规则类,直到他取得所有的编译完的DLL文件。UnrealBuildTooltakes [APPNAME] and appends Target when requesting the build target from the Rules DLL. So,using the same example as above, when UnrealBuildTool is passed ShaderCompileWorker Win64 Development it will request ShaderCompileWorkerTarget as theTargetRules class name of interest.当构建目标从规则Dll文件被需求时,虚幻构建工具会取得[应用名称],并且添加目标。所以使用上一个相同的案例(让你看上一个案例)。虚幻构建工具编译64位开发版本的着色器编译器,它将会请求着色器编译目标文件作为目标规则的类的名称。Constructor构造函数The constructorsets the name of the application and the type of target to generate. Here isthe constructor for ExampleGameTarget for comparison:构造函数设置了应用的名称以及需要生成的目标类型,这里是一个案例游戏目标文件的构造函数。public ExampleGameTarget(TargetInfo Target){  Type = TargetType.Game;  Name = ExampleGame ;}Setup Binaries设置二进制文件TargetRules::SetupBinaries() is used to generate a list of UEBuildBinaryConfiguration instances whichUnrealBuildTool will use to fill in the AppBinaries array (these are what itwill generate).TargetRules::SetupBinaries() 函数是用于生成一个UEBuildBinaryConfiguration实例的表,虚幻构建工具将会使用它填充AppBinaries数组(他们就是将要生成的代码)(看了一下ShootGame的代码,这句话的意思就是说想要编译什么就在这个函数里填什么,ShootGame本身就是模块化编程项目) Setup Global Environment设置全局环境TargetRules::SetupGlobalEnvironment() is used to set various build configuration settings forUnrealBuildTool for the target as well as setup the global Compile and Linkenvironments.TargetRules::SetupGlobalEnvironment()这个函数是用于设置给虚幻构建工具构建设置的变量用的,同时也会设定全局编译以及链接环境。Note: The current games do not contain this function, as the UEBuildGameclass takes care of their needs by default. However, if a game needed tooverride these settings, it certainly can do so.注意:当前游戏不能包含这个函数,作为一个UEBuildGame一般只需要保持默认就可以了,当然如果一个游戏需要重写这个函数,它也是会运行的。(意思是,如果你没有特殊需求就不用管这个玩意,在看ShootGame的代码时发现他用了这个函数,里面设定了一下Ps4的东西)Example TargetFile目标文件案例Here is theShaderCompileWorker.Target.cs file as a complete example:haderCompileWorker.Target.cs目标文件案例//Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. using UnrealBuildTool;using System.Collections.Generic; public class ShaderCompileWorkerTarget : TargetRules{  public ShaderCompileWorkerTarget(TargetInfo Target)  {  Type = TargetType.Program;  Name = ShaderCompileWorker ;  }   //  //TargetRules interface.  //   public override void SetupBinaries(  TargetInfo Target,  ref List UEBuildBinaryConfiguration OutBuildBinaryConfigurations,  ref List string OutExtraModuleNames  )  {  List string LinkModules = new List string () { Core , ShaderCore , RenderCore , RHI , WindowsTools , ShaderCompileWorker };  OutBuildBinaryConfigurations.Add(    new UEBuildBinaryConfiguration( InType: UEBuildBinaryType.Executable,              InModuleNames: LinkModules )    );  }   public override void SetupGlobalEnvironment(  TargetInfo Target,
原文地址http://docs.unrealengine.com/latest/INT/Programming/UnrealBuildSystem/Configuration/index.htmlConfiguringUnreal Build System配置虚幻构建操作系统Unreal Engine 4.5
The Unreal BuildSystem can be configured through the BuildConfiguration.cs to modify the build process to suit a variety of needs.虚幻构建操作系统能能通过BuildConfiguration.cs修改配置,改变构建过程来请求多种需求。UnrealBuldToolConfiguration Properties虚幻构建工具配置属性bStopXGECompilationAfterErrorsIf true, compilation with XGE will stop when an error occurs.·  Continuing compiling makes subsequent compiles muchfaster after you fix the odd error.·  It lets you see compile errors in all files beforequitting the build.·  You can use Ctrl + Break to interrupt a failed build.bOmitPCDebugInfoInDevelopmentIf true, debug info is not included when building in Developmentconfiguration.·  Set to false to always include debug info.·  Including debug info slows down compiling, but gives youline numbers and stack info in Development builds.bUseUnityBuildSet to true when rebuilding the engine as a whole. This should bedisabled when using fast iteration mode. See Build Modes for more information.bEnableFastIterationIf true, compile and link times are dramatically decreased. Thisshould be disabled when creating unity builds. See Build Modes for more information.·  Setting to true gives fastest iteration times.·  If you encounter weird RPC or PDB link errors, then you should set bUseIncrementalLinking=false inValidateConfiguration()Build ModesThere are twobuild modes: unity and fast iteration. Unity is good for making changes that requirerebuilding the whole engine e.g. changing an Engine header. Fast iteration isgood when you are making localized changes - it gets your compile/link timedown to less than 4 seconds. To change between the two, open BuildConfiguration.cs and find the lines:bEnableFastIteration= Utils.GetEnvironmentVariable( ue.bEnableFastIteration , false );bUseUnityBuild= Utils.GetEnvironmentVariable( ue.bUseUnityBuild , true);This can bemodified to force the one you want to be true. Unity is the default.
回复

使用道具 举报

0

主题

834

帖子

2774

积分

vip会员

Rank: 1

积分
2774
发表于 2015-10-12 23:45:40 | 显示全部楼层
任何的限制,都是从自己的内心开始的   
回复 支持 反对

使用道具 举报

0

主题

1260

帖子

4007

积分

vip会员

Rank: 1

积分
4007
发表于 2015-10-13 05:25:08 | 显示全部楼层
加油啊  顶哦     
回复 支持 反对

使用道具 举报

0

主题

885

帖子

2862

积分

vip会员

Rank: 1

积分
2862
发表于 2015-10-13 07:52:15 | 显示全部楼层
顶你一下,好贴要顶   
回复 支持 反对

使用道具 举报

0

主题

1305

帖子

4142

积分

vip会员

Rank: 1

积分
4142
发表于 2015-10-13 09:44:42 | 显示全部楼层
呵呵 哪天得看看         
回复 支持 反对

使用道具 举报

0

主题

835

帖子

2786

积分

vip会员

Rank: 1

积分
2786
发表于 2015-10-13 09:57:29 | 显示全部楼层
不要等到人人都说你丑时才发现自己真的丑     
回复 支持 反对

使用道具 举报

0

主题

1259

帖子

3929

积分

vip会员

Rank: 1

积分
3929
发表于 2015-10-13 10:06:41 | 显示全部楼层
春天我把老公种下去,秋天我就有很多个老公了   
回复 支持 反对

使用道具 举报

*滑块验证:
您需要登录后才可以回帖 登录 | enginedx注册

本版积分规则

 
 



邮件留言:


 
返回顶部