UBT是如何处理Target.cs和Build.cs的?-Unreal4源码拆解-UnrealBuildTool功能流程解析

UBT是如何处理Target.cs和Build.cs-Unreal4源码拆解-UnrealBuildTool功能流程解析

专栏链接

知乎专栏:UBT源码解析

功能漫谈

我们项目和引擎里面的每个模块都有build.cs,我们的项目本身有Target.cs,UE4是如何处理这两种文件呢?
  • UBT会把两种文件编译到DLL里面。
  • 不管是项目还是引擎,DLL都在Intermediate\Build\BuildRules
在内存里面是如何组织的呢?
  • 对每一个Build.csUBT会在内存中创建一个ModuleRulesContext实例保存相关信息
  • 之后会创建一个RulesAssembly实例,根据Target.cs和Build.cs编译出对应的DLL
  • RulesAssembly实例中
    • 保存ModuleRulesContext
    • 对应的Target.cs和Build.cs文件本身
    • 编译出来的DLL的引用
    • 以及一些其他信息。。。

什么是Rule

其实我们看枚举就知道RuleUE4中有3种

		public enum RulesFileType
		{
			/// <summary>
			/// .build.cs files
			/// </summary>
			Module,

			/// <summary>
			/// .target.cs files
			/// </summary>
			Target,

			/// <summary>
			/// .automation.csproj files
			/// </summary>
			AutomationModule
		}

什么是Assembly

一个DLL或者一个程序

实例展示

UE4引擎分所有的build.cs和Target.cs会编译为2个DLL

在这里插入图片描述

UE4Rules.dll的源文件来源:插件和模块

在这里插入图片描述
在这里插入图片描述

UE4Rules.dll的DLL内容实录(DLL反编译)

在这里插入图片描述

UE4ProgramRules.dll的源文件来源:程序和UE4本身的Target.cs

在这里插入图片描述

UE4ProgramRules.dll的DLL内容实录(DLL反编译)

在这里插入图片描述

自己的项目在一个DLL中

在这里插入图片描述

文件清单

在这里插入图片描述

文件清单内容

在这里插入图片描述

  • 0
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
UATHelper: 打包 (Linux): Running: C:\Program Files\Epic Games\UE_5.2\Engine\Binaries\ThirdParty\DotNet\6.0.302\windows\dotnet.exe "C:\Program Files\Epic Games\UE_5.2\Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.dll" Cesium Linux Development -Project="C:\Users\卓翼\Documents\Unreal Projects\Cesium\Cesium.uproject" "C:\Users\卓翼\Documents\Unreal Projects\Cesium\Cesium.uproject" -NoUBTMakefiles -remoteini="C:\Users\卓翼\Documents\Unreal Projects\Cesium" -skipdeploy -Manifest="C:\Users\卓翼\Documents\Unreal Projects\Cesium\Intermediate\Build\Manifest.xml" -NoHotReload -log="C:\Users\卓翼\AppDat a\Roaming\Unreal Engine\AutomationTool\Logs\C+Program+Files+Epic+Games+UE_5.2\UBT-Cesium-Linux-Development.txt" UATHelper: 打包 (Linux): Log file: C:\Users\׿��\AppData\Roaming\Unreal Engine\AutomationTool\Logs\C+Program+Files+Epic+Games+UE_5.2\UBT-Cesium-Linux-Development.txt UATHelper: 打包 (Linux): Missing precompiled manifest for 'CesiumRuntime', 'C:\Program Files\Epic Games\UE_5.2\Engine\Plugins\Marketplace\CesiumForUnreal\Intermediate\Build\Linux\UnrealGame\Development\CesiumRuntime\CesiumRuntime.precompiled'. This module was most likely not flagged for being included in a precompiled build - set 'PrecompileForTargets = PrecompileTargetsType.Any;' in CesiumRuntime.build.cs to override. If part of a plugin, also check if its 'Type' is correct. UATHelper: 打包 (Linux): Took 1.1931896s to run dotnet.exe, ExitCode=6 UATHelper: 打包 (Linux): UnrealBuildTool failed. See log for more details. (C:\Users\卓翼\AppData\Roaming\Unreal Engine\AutomationTool\Logs\C+Program+Files+Epic+Games+UE_5.2\UBT-Cesium-Linux-Development.txt) UATHelper: 打包 (Linux): AutomationTool executed for 0h 0m 3s UATHelper: 打包 (Linux): AutomationTool exiting with ExitCode=6 (6) UATHelper: 打包 (Linux): BUILD FAILED PackagingResults: Error: Unknown Error
07-13

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值