当前位置: 首页 > news >正文

青岛外贸网站建设费用wordpress直接连接数据库文件

青岛外贸网站建设费用,wordpress直接连接数据库文件,网站建设跑业务,简单建网站年底了#xff0c;把之前的草稿文章整理一下#xff0c;整理好的发出来 UnrealBuildTool简介 参考#xff1a;https://docs.unrealengine.com/4.27/en-US/ProductionPipelines/BuildTools/UnrealBuildTool/ UE里的项目代码、包括UE本身的源码#xff0c;都是划分成一个…年底了把之前的草稿文章整理一下整理好的发出来 UnrealBuildTool简介 参考https://docs.unrealengine.com/4.27/en-US/ProductionPipelines/BuildTools/UnrealBuildTool/ UE里的项目代码、包括UE本身的源码都是划分成一个个module的dll的每个Module用build.cs文件来控制对应module的相关信息比如对其他module的依赖、include路径等然后这些dll会一起编译成最后的single executable里后面还会详细介绍下。 关于build.cs与target.cs文件 看到一个新创建的名为MyDemo的C工程里面的这三个文件让我产生了疑惑它们的路径如下 F:\UnrealProjects\MyDemo\Source\MyDemo.Target.csF:\UnrealProjects\MyDemo\Source\MyDemoEditor.Target.csF:\UnrealProjects\MyDemo\Source\MyDemo\MyDemo.Build.cs Source文件夹下出现了X和XEditor名字的target.cs文件而Source\X文件夹下出现了X名字的build.cs文件。俩target.cs文件内容差不多 // MyDemo.Target.cs using UnrealBuildTool; using System.Collections.Generic;public class MyDemoTarget : TargetRules {public MyDemoTarget(TargetInfo Target) : base(Target){Type TargetType.Game;// build目标类型为GameDefaultBuildSettings BuildSettingsVersion.V2;IncludeOrderVersion EngineIncludeOrderVersion.Unreal5_1;ExtraModuleNames.Add(MyDemo);} }// MyDemoEditor.Target.cs using UnrealBuildTool; using System.Collections.Generic;public class MyDemoEditorTarget : TargetRules {public MyDemoEditorTarget(TargetInfo Target) : base(Target){Type TargetType.Editor;// build目标类型为EditorDefaultBuildSettings BuildSettingsVersion.V2;IncludeOrderVersion EngineIncludeOrderVersion.Unreal5_1;ExtraModuleNames.Add(MyDemo);} }build.cs文件则貌似是个runtime only的东西 using UnrealBuildTool;public class MyDemo : ModuleRules {public MyDemo(ReadOnlyTargetRules Target) : base(Target){PCHUsage PCHUsageMode.UseExplicitOrSharedPCHs;PublicDependencyModuleNames.AddRange(new string[] { Core, CoreUObject, Engine, InputCore, HeadMountedDisplay, EnhancedInput });} }看了下它们的内容可以大概了解这些文件的干啥的了。Visual Studio里一个正常的Solution会有多个projects在这里相当于每个Module对应一个project而且Module的output类型都是dll这里的文件作用分别为 .uproject文件记录项目引用了哪些moduletarget.cs文件负责设置project的Configuration Type还额外添加了UHT的一些版本信息build.cs文件负责设置project的依赖、include路径等 大概意思是像Configuration、引擎版本、编译器这种所有Module对应的dll都共享的内容可以放到Target.cs文件里至于各自Module的依赖关系、PCH引用关系则使用各自Module的Build.cs文件来记录 所以这里的target.cs表示了项目的build类型一共也没多少种无非就是类似于Debug、Release这种类型的设置而build.cs则相当于记录了每个module的project的相关project settings信息。比如说我新创建的UE C工程自然会有Runtime的Game类型和Editor下的编辑类型所以会有MyDemo.Target.cs和MyDemoEditor.Target.cs俩文件产生。而我如果是创建一个Plugin那不需要创建任何.Target.cs文件只需要创建Runtime和Editor下各自对应的Build.cs文件即可 在UE源码里有四种主要的引擎对应的Target.cs文件 UnrealClient.Target.csUnrealEditor.Target.csUnrealGame.Target.csUnreamServer.Target.cs 引擎里的所有Plugin和各自Module应该都是随着引擎一起共享Target.cs文件所以项目里build.cs文件应该是更多的UE源码里我验证了一下确实是这样里面的build.cs文件有1923个但target.cs只有124个 BuildConfiguration.cs 另外可以在BuildConfiguration.cs文件里选择一些全局的引擎build设置这个文件属于引擎源码级别的代码里面基本都是一堆bool值具体路径为 D:\UE_5.1\Engine\Source\Programs\UnrealBuildTool\Configuration\BuildConfiguration.cs 查看生成VS项目失败的log 参考https://community.gamedev.tv/t/could-not-be-compiled-try-rebuilding-from-source-manually/7953/25 加了点新东西常常就会编译失败提示could not be compiled Try rebuilding from source如果是生成VS项目失败可以打开对应的LOG文件 MyDemo\Saved\Logs\MyDemo.log.uproject文件里的AdditionalDependencies与.Build.cs里的PublicDependencyModuleNames 参考https://forums.unrealengine.com/t/what-does-the-additionaldependencies-field-mean-in-uproject-modules-section/589091 貌似都是用来描述Module之间的依赖情况的貌似在.uproject文件里写AdditionalDependencies的方式已经过时了 Attach到项目 多的不说了网上都有主要是源码Attach到具体的项目的设置 我发现路径里好像不能有空格而且Epic Games这玩意儿可开可不开attach之后如果还让选择项目应该就是前面输入的路径不对了 Debug蓝图工程和C工程 二者好像Debug方法不一样参考https://answers.unrealengine.com/questions/449653/how-to-run-visual-studio-debugger-on-ue4-source.html 如果用对应的UE4的exe(应该是源码搞出来的exe)打开了项目然后用vs源码工程attach到对应的process即可 如果要Debug蓝图项目直接在UE4的C工程里F5打开对应的项目即可。如果是Debug C项目这样做好像不行不知道为啥会报错。这种情况下好像只能在Source里创建对应的C工程然后打开对应C工程的sln文件在里面可以Debug UE4的源码不过这里好像要rebuild ue4源码 感觉很麻烦不知道有没有更好的方法 UE4的icon路径 E:\UnrealEngine\Engine\Content\Editor\Slate\ UE4的Build方式 参考https://www.reddit.com/r/unrealengine/comments/d2dqen/unreal_engine_source_code_overviewguidestutorials/ 在Runtime或者Editor文件夹里里面有很多文件夹每一个都包含一个或者多个modules每个module都有一个build.cs文件来表明如何build这个模块它也表明了模块之间的依赖关系。 当编译和启动UE4引擎时它会启动一个UnreaBuildTool工具它会去寻找所有modules里的build.cs文件使用它来Compile和Link模块感觉这玩意儿类似于CmakeList和Premake5.lua文件对于每个module它生成的东西会放到Binary文件夹里比如dll、obj等文件会在run Editor的时候加载这些玩意儿。把引擎module化是为了防止每次修改内容都需要rebuild整个引擎而是 只会rebuild对应的module和受其影响的其他部分。 I recommend looking at Rama’s tutorials on the wiki for building modules and looking at his plugins he’s released. You’ll get a good idea about how the editor works. 详细的参考https://www.cnblogs.com/FlyingZiming/p/15017445.html 这玩意儿还挺恶心的比如我引入了一个类的头文件然后编译报错提示找不到对应类的函数定义然后查了半天才发现要在项目对应的Build.cs文件里添加对应的模块的引用而这玩意儿貌似是不会反映到VS的项目属性上的 为什么模块代码文件要区分Public和Private目录? 参考https://zhuanlan.zhihu.com/p/107270501 由于有的API是可以暴露出去的有的不可以所以UE4把所有导出的API的对应头文件放到了Public文件夹下如果这里的模块不会被任何模块引用那么可以不区分Public和Private目录 UE4哪些文件被包含在PCH里 最近很容易一不小心改了代码就改到了PCH里的东西就要全部Rebuild很头疼 看了下UE4的核心Engine.Build.cs文件发现里面有这个 PrivatePCHHeaderFile Private/EnginePrivatePCH.h; SharedPCHHeaderFile Public/EngineSharedPCH.h;然后发现我改动的一个文件叫AnimationAsset.h在两个文件里都出现了表示它是PCH里的东西好吧下次不改这个了。 不过PrivatePCH和SharedPCH有啥区别呢 PrivatePCH是给本模块用的PCHShared PCH是给依赖本模块的模块用的PCH可以看到EngineSharedPCH里的内容比EnginePrivatePCH的内容略多 UE源码工程每次都重新编译 参考https://forums.unrealengine.com/t/how-to-compile-in-non-unity-mode/94863/3 参考https://forums.unrealengine.com/t/waiting-for-git-status-command-to-complete-making-for-long-compile-times/412358/3 就算我有一个不重要的cpp的微小改动也会重新编译整个工程耗时很久。看了下好像跟UE默认的unity build有关。Build信息如下所示 19------ Build started: Project: SlateViewer, Configuration: Development_Program x64 ------ 7Log file: D:\UnrealSource\UnrealEngine\Engine\Programs\UnrealBuildTool\Log.txt 7Using git status to determine working set for adaptive non-unity build (D:\UnrealSource\UnrealEngine).上面提示可以使用git status来决定使用non-unity build查了下好像跟引擎默认的Build设置有关默认设置是只要有git就会使用它把它记录的这些文件从unity build里排除掉从而减少编译时间。 排除掉之后应该是走的正常的Build流程了不过看他这个意思开着这玩意儿不是能减少编译时间的 具体做法如下在路径UnrealSource\UnrealEngine\Engine\Saved\UnrealBuildTool下把文件改成 ?xml version1.0 encodingutf-8 ? Configuration xmlnshttps://www.unrealengine.com/BuildConfiguration SourceFileWorkingSet ProviderNone/Provider RepositoryPath/RepositoryPath GitPath/GitPath /SourceFileWorkingSet /Configuration还有一些类似的设置: ?xml version1.0 encodingutf-8 ?Configuration xmlnshttps://www.unrealengine.com/BuildConfigurationBuildConfigurationbUseUnityBuildfalse/bUseUnityBuildbUsePCHFilesfalse/bUsePCHFiles/BuildConfiguration /Configuration然后又要重新整个编译。。。。。 试了下这个黑科技http://www.morecpp.cn/ue-opensource-project-trigger-compile/没用 关于Makefile类型的C Project 主要是看到UE里创建的C项目类型为Makefile而且相关的属性配置设置非常少所以有这个疑问如下图所示 参考https://learn.microsoft.com/en-us/cpp/build/reference/creating-a-makefile-project?viewmsvc-170 A makefile is a text file that contains instructions for how to compile and link (or build) a set of source code files. A program (often called a make program) reads the makefile and invokes a compiler, linker, and possibly other programs to make an executable file. The Microsoft program is called NMAKE. 什么是Makefile其实我是知道的早在没有VS这种大型IDE之前就是使用makefile来把各个cpp和头文件整合到一起编译出结果的Makefile本质就是个text文件。但这里的Makefile Project我就不是特别清楚了。 这里创建一个Windows上的起始Makefile项目看看需要输入这些东西 创建之后发现仍然可以加入cpp文件 但是加入cpp之后直接编译项目并没有什么东西生成而是提示我没有加commandline: warning MSB8005: The property NMakeReBuildCommandLine doesnt exist. Skipping...所以我理解的是VS里的makefile project应该就是把传统makefile的规则存到了vsproject里用于自定义命令行的项目构建就是套了VS的壳再用makefile的方式去构建项目。 拿我这个UE项目对应的makefile project举例它的两个重要设置为 Commandline Argumens“$(SolutionDir)MyProject.uproject” -skipcompileBuild CommandlineD:\UE_5.1\Engine\Build\BatchFiles\Build.bat MyProjectEditor Win64 DebugGame -Project“$(SolutionDir)MyProject.uproject” -WaitMutex -FromMsBuild 最后我rebuild工程时执行的命令是这样的 Running UnrealBuildTool: dotnet ..\..\Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.dll MyProjectEditor Win64 DebugGame -ProjectF:\UnrealProjects\MyProject\MyProject.uproject -WaitMutex -FromMsBuild -Rebuild就是调用UnrealBuildTool去分析这个MyProject.uproject文件而已后续应该做了具体的项目build设置。 总结下来就是这个Makefile Project没有做真正的build工作在build这个工程时它只是调用了UE的UnrealBuildTool然后基于项目的uproject文件让UnrealBuildTool去进行真正的build工作。 UE的IWYU 参考https://docs.unrealengine.com/5.2/en-US/include-what-you-use-iwyu-for-unreal-engine-programming/ 我之前搭建引擎的时候引擎用到的核心头文件都放到hzpch.h文件里然后引擎里的每个cpp都要在第一行#include hzpch.h大概是这样 #pragma once #include iostream #include sstream #include vector #include string #include memory #include map #include unordered_map #include set #include functional #include Hazel/Core/Log.h // include了引擎自定义的头文件 #include fstream#include filesystem ...老版本的UE里比如UE4.0的引擎源码里基本也是这种模式它把核心常用的文件全部放到了Engine.h里内部有众多Include文件 // 它这里应该没用啥标准库的东西, 所以都是include的自定义头文件 #include BlueprintUtilities.h #include Tickable.h // FTickableGameObject interface. #include RenderingThread.h // for FRenderCommandFence #include GenericOctreePublic.h // for FOctreeElementId #include RenderResource.h // for FRenderResource #include HitProxies.h // Hit proxy definitions. #include Engine/EngineBaseTypes.h ...然后每个cpp都在第一行引用Engine,h也就是常用的pch模式Editor模块下的代码应该是统一引用UnrealEd.h 这种做法叫做including monolithic header files对于引擎里的cpp而言很多时候其实没必要include这么多内容所以UE引入了IWYUInclude What You Use这项技术一般只有引擎内部会使用IMYU而项目是禁用IMYU的。注意IMYU并不是传统的cpp include header的方法它仍然使用了PCH文件只不过是不再需要在cpp的第一行include pch文件了相关操作会借助UBT在命令行参数里执行 相关要点如下 如果需要启用IMYU需要在module的build.cs里在ModuleRules的构造函数里设置PCHUsage类型为UseExplicitOrSharedPCHs使用IMYU的前提有cpp里不再include pch对应的Monolithic文件而是要在第一行Include对应的头文件UE源码默认开IMYUUE C项目默认禁用IMYU可以在项目里开启IMYU加快编译速度 [Adaptive Build] Excluded from PoseSearch unity file: xxx.cpp 编译源码工程的时候出现的提示貌似只是说这些代码不在原本的联合编译里需要单独编译而已应该不影响最终编译结果 UE Rebuild的头疼问题 参考https://forums.unrealengine.com/t/how-to-prevent-plugin-recompilation/473557/5 参考https://forums.unrealengine.com/t/engine-constantly-recompiles/438846/3 分为以下几种细分情况 改变源码时Rebuild如果是改了PCH文件也还可以理解但是改动插件里东西也全部Rebuild就不合理了用源码创建的VS工程再去Build会连带重新Rebuild依赖的源码工程UE游戏项目工程里从Market上或者外部放进去的Plugin即使没改动也每次都随游戏工程Rebuild 有几个疑问 在对应Module的Build.cs文件里可以设置bUsePrecompiled true貌似可以防止Plugin Rebuild这个参数怎么用 使用源码工程创建的VS项目需要Rebuild 仔细看看Configuration需要确保VS项目跟源码工程的Configuration Type相同如果不是改下VS项目的Configuration即可应该就不需要Rebuild了 关于UE的Unreal Build Tool(UBT) 参考https://docs.unrealengine.com/5.0/en-US/unreal-engine-build-tool-target-reference/ 几个问题 UBT是不是用于打包项目的设置插件对应intermediate文件夹下的Module.PoseSearchEditor.cpp代码是由谁生成的、有什么用 前言 正常Build VS工程时拿我写的游戏引擎举例里面有这么些项目除了Glad和GLFW里都是c语言的文件其他的都是cpp工程 imguiYAML_CPPGladGLFW2DPhysicsEngineHazelHazelEditor 一共七个项目其中HazelEditor为启动项目它依赖Hazel而Hazel又依赖其他的五个项目 如果此时从零开始Build此时会多线程一起开始build这五个前置项目命令行输出的为 Build started... 1------ Build started: Project: imgui, Configuration: Debug x64 ------ 2------ Build started: Project: YAML_CPP, Configuration: Debug x64 ------ 3------ Build started: Project: Glad, Configuration: Debug x64 ------ 4------ Build started: Project: GLFW, Configuration: Debug x64 ------ 5------ Build started: Project: 2DPhysicsEngine, Configuration: Debug x64 ------ 1imgui.cpp 2binary.cpp 3glad.c 4context.c 5b2_broad_phase.cpp 5b2_chain_shape.cpp 4egl_context.c 2graphbuilder.cpp 5b2_circle_shape.cpp 5b2_collide_circle.cpp ... 3Glad.vcxproj - D:\GitRepositories\Hazel\Hazel\vendor\Glad\bin\Debug-windows-x86_64\Glad\Glad.lib ... 1Generating Code... ... 1imgui.vcxproj - D:\GitRepositories\Hazel\Hazel\vendor\imgui\bin\Debug-windows-x86_64\imgui\imgui.lib 5Generating Code... ... 4Generating Code... ... 5Generating Code... 5Compiling... 5b2_weld_joint.cpp 4GLFW.vcxproj - D:\GitRepositories\Hazel\Hazel\vendor\GLFW\bin\Debug-windows-x86_64\GLFW\GLFW.lib 5Generating Code... 52DPhysicsEngine.vcxproj - D:\GitRepositories\Hazel\Hazel\vendor\box2D\bin\Debug-windows-x86_64\2DPhysicsEngine\2DPhysicsEngine.lib ... 2Generating Code... 2Compiling... 2Generating Code... 2YAML_CPP.vcxproj - D:\GitRepositories\Hazel\Hazel\vendor\yaml-cpp\bin\Debug-windows-x86_64\YAML_CPP\YAML_CPP.lib.大概流程应该是: Build Startxxx项目输出Generating Code...、或者Compiling...之类的指令应该是隔一段时间或编译一些文件就会打一次这个Log最后打印xxx.vcxproj - Path\output 接下来也是类似的 6------ Build started: Project: Hazel, Configuration: Debug x64 ------ hzpch.cpp ... 6Generating Code... ... 6Compiling... 6Ws2_32.lib(WS2_32.dll) : warning LNK4006: __NULL_IMPORT_DESCRIPTOR already defined in opengl32.lib(OPENGL32.dll); second definition ignored 6Bcrypt.lib(bcrypt.dll) : warning LNK4006: __NULL_IMPORT_DESCRIPTOR already defined in opengl32.lib(OPENGL32.dll); second definition ignored 6Version.lib(VERSION.dll) : warning LNK4006: __NULL_IMPORT_DESCRIPTOR already defined in opengl32.lib(OPENGL32.dll); second definition ignored 6Winmm.lib(WINMM.dll) : warning LNK4006: __NULL_IMPORT_DESCRIPTOR already defined in opengl32.lib(OPENGL32.dll); second definition ignored 6shaderc_sharedd.lib(shaderc_sharedd.dll) : warning LNK4006: __NULL_IMPORT_DESCRIPTOR already defined in opengl32.lib(OPENGL32.dll); second definition ignored 6Hazel.vcxproj - D:\GitRepositories\Hazel\bin\Debug-windows-x86_64\Hazel\Hazel.lib 6Done building project Hazel.vcxproj. 7------ Build started: Project: HazelEditor, Configuration: Debug x64 ------ xxx.cpp ... 7Defining YAML_CPP_API for DLL import ... 7Generating Code... 7D:\GitRepositories\Hazel\Hazel\Src\Hazel\Scripting\Scripting.h(36): warning C4172: returning address of local variable or temporary: value 7Hazel.lib(object.obj) : warning LNK4099: PDB was not found with Hazel.lib(object.obj) or at ; linking object as if no debug info ... 7HazelEditor.vcxproj - D:\GitRepositories\Hazel\bin\Debug-windows-x86_64\HazelEditor\HazelEditor.exe 7Done building project HazelEditor.vcxproj.Build: 7 succeeded, 0 failed, 0 up-to-date, 0 skipped Build started at 4:25 PM and took 44.797 seconds 当每个单独的Project build完毕后打印一个总结 再来看看UE的build日志UE5的build start project就叫UE5它只依赖UnrealBuildTool如下图所示 由于它使用了UBT其Build Log会不太一样因为工程太大了这里选择Build而不是Rebuild开头如下所示 Build started... 1------ Build started: Project: UE5, Configuration: Debug_Editor x64 ------ 1Using bundled DotNet SDK version: 6.0.302 1Running UnrealBuildTool: dotnet ..\..\Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.dll -TargetUnrealEditor Win64 Debug -TargetShaderCompileWorker Win64 Development -Quiet -WaitMutex -FromMsBuild第三行并没有直接编译cpp的log信息是因为UE5的Project Configuration Type并不是exe或者lib而是Makefile类型可以看到当前项目下的它的build命令行 这意味着它会去调用Build.bat文件看了下该文件大概是以下步骤 检查一些文件夹的存在、CD到对应路径检查.NET的SDK检查UnrealBuildTool.dll的存在若不存在则用Visual Studio build UnrealBuildTool项目调用UnrealBuildTool.exe Build.bat文件信息如下可以参考下 setlocal enabledelayedexpansion// 1. cd到Source文件夹 if not exist %~dp0..\..\Source goto Error_BatchFileInWrongLocationpushd %~dp0\..\..\Source if not exist ..\Build\BatchFiles\Build.bat goto Error_BatchFileInWrongLocation// UBTPath为UnrealBuildTool.dll的相对路径 set UBTPath..\..\Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.dll// 2. 调用当前目录的GetDotnetPath.bat获取.NET call %~dp0GetDotnetPath.bat if errorlevel 1 goto Error_NoDotnetSDK REM ## Skip msbuild detection if using dotnet as this is done for us by dotnet-clirem ## If this is an installed build, we dont need to rebuild UBT. Go straight to building. if exist ..\Build\InstalledBuild.txt goto ReadyToBuildrem ## Compile UBT if the project file exists :ReadyToBuildUBT set ProjectFilePrograms\UnrealBuildTool\UnrealBuildTool.csproj if not exist %ProjectFile% goto NoProjectFilerem ## Only build if UnrealBuildTool.dll is missing, as Visual Studio or GenerateProjectFiles should be building UnrealBuildTool rem ## Note: It is possible UnrealBuildTool will be out of date if the solution was generated with -NoDotNet or is VS2019 rem ## Historically this batch file did not compile UnrealBuildTool if not exist %UBTPath% (rem ## If this script was called from Visual Studio 2022, build UBT with Visual Studio to prevent unnecessary rebuilds.if %VisualStudioVersion% GEQ 17.0 (echo Building UnrealBuildTool with %VisualStudioEdition%...%VSAPPIDDIR%..\..\MSBuild\Current\Bin\MSBuild.exe %ProjectFile% -t:Build -p:ConfigurationDevelopment -verbosity:quiet -noLogoif errorlevel 1 goto Error_UBTCompileFailed) else (echo Building UnrealBuildTool with dotnet...dotnet build %ProjectFile% -c Development -v quietif errorlevel 1 goto Error_UBTCompileFailed) ) :NoProjectFilerem ## Run UBT :ReadyToBuild if not exist %UBTPath% goto Error_UBTMissing echo Running UnrealBuildTool: dotnet %UBTPath% %* dotnet %UBTPath% %* EXIT /B !ERRORLEVEL!:Error_BatchFileInWrongLocation echo ERROR: The batch file does not appear to be located in the Engine/Build/BatchFiles directory. This script must be run from within that directory. EXIT /B 999:Error_NoDotnetSDK echo ERROR: Unable to find an install of Dotnet SDK. Please make sure you have it installed and that dotnet is a globally available command. EXIT /B 999:Error_UBTCompileFailed echo ERROR: Failed to build UnrealBuildTool. EXIT /B 999:Error_UBTMissing echo ERROR: UnrealBuildTool.dll not found in %UBTPath% EXIT /B 999 总的来说在Build UE5这个project时它这个Makefile工程所做的其实就是调用UnrealBuildTool.exe而已只是个空壳子我试了下可以直接在Build.bat路径下直接在命令行输入以下指令一样会触发编译 F:\UnrealEngine\Engine\Build\BatchFilesdotnet ..\..\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.dll -TargetUnrealEditor Win64 Debug -TargetShaderCompileWorker Win64 Development -Quiet -WaitMutex -FromMsBuild这里的dotnet貌似是.NET Core提供的命令行关键字用于调用.NET程序不过这里居然调用的是dll不是exe也是挺奇怪的如下图所示是该命令的介绍 UnrealBuildTool 参考UE4 UnrealBuildTool 执行流程 参考Build flow of the Unreal Engine4 project Build.bat会把参数都传给UnrealBuildTool.exe参数可以在bat里看到 rem ## %1 is the game name rem ## %2 is the platform name rem ## %3 is the configuration name rem ## additional args are passed directly to UnrealBuildTool命令行举例 三个参数分别为game name、 platform name、configuration name UnrealBuildTool.exe MyTest Win64 Development C:\Users\visionsmile\Documents\Unreal Projects\Examples\MyTest \MyTest .uproject -WaitMutex -FromMsBuild对应到下面的参数就是这上面的六个参数最后一个为-FromMsBuild /// summary /// Main entry point. Parses any global options and initializes the logging system, then invokes the appropriate command. /// NB: That the entry point is deliberately NOT async, since we have a single-instance mutex that cannot be disposed from a different thread. /// /summary /// param nameArgumentsArrayCommand line arguments/param /// returnsZero on success, non-zero on error/returns private static int Main(string[] ArgumentsArray) {...虽然这里的Build.bat传入了三个参数但UBT实际需要四个参数 %1 is the game name %2 is the platform name %3 is the configuration name %4 is the ProjectPath 直接打开UBT对应的.sln文件在Main函数里可以输入Commandline参数直接Debug进行编译 private static int Main(string[] ArgumentsArray) {ArgumentsArray new string[]{-TargetUnrealEditor Win64 Debug,-TargetShaderCompileWorker Win64 Development -Quiet,-WaitMutex,-FromMsBuild};... }UBT会创建帮助编译的Makefile.bin文件比如生成以下路径的MakeFile F:\UnrealEngine\Engine\Intermediate\Build\Win64\x64\UnrealEditor\Debug\Makefile.bin这玩意儿是个二进制文件很难直接阅读这里来研究一下UBT写入了什么内容。为了生成MakeFileUBT首先要确定build的目标因而创建一个UEBuildTarget类的对象如下所示 // If we couldnt load a makefile, create a new one if(Makefile null) {// Create the targetUEBuildTarget Target;... }看了下创建出来的BuildTarget对象貌似它要Build的分为四种Module Binary Module最终打出的exe对象只有一个即这里的UnrealEditor.exe也叫做Launch ModuleProject Module每个引擎内的Plugin一般要出至少两个dll一个用在Editor下一个用于Runtime这里应该是每个Build.cs文件对应一个dllPlugin Module每个引擎内的Module也应该是每个Build.cs文件对应一个dllExtraModule特殊的引擎Module比如Build UnrealEditor.exe需要UnrealGame这个ExtraModule 这个Extra Module是在Target.cs里决定的如下所示是引擎的UnrealEditor.Target.cs public class UnrealEditorTarget : TargetRules {public UnrealEditorTarget( TargetInfo Target ) : base(Target){Type TargetType.Editor;IncludeOrderVersion EngineIncludeOrderVersion.Latest;BuildEnvironment TargetBuildEnvironment.Shared;bBuildAllModules true;ExtraModuleNames.Add(UnrealGame);} }各自的Module都对应了各自的Build.cs文件路径依次为 ModuleNameToModuleFile[Launch] {F:\UnrealEngine\Engine\Source\Runtime\Launch\Launch.Build.cs} EpicGames.Core.FileReference · 数了下引擎里有1743个Build.cs文件这里创建的BuildTarget里的Binaries数组有1453个元素感觉是差不多对应的上的这里会先处理Launch Module处理的过程应该是个DFS的过程如下图所示可以看到它依赖了63个Module应该是全游戏需要的Module的Root Launch Module对应了文件也即UE提供的四个引擎Target.cs文件之一 TargetRulesFile {F:\UnrealEngine\Engine\Source\UnrealEditor.Target.cs} EpicGames.Core.FileReferenceintermediate文件夹下的Module.PoseSearchEditor.cpp代码 这个cpp是由UBT生成的可以看下里面的内容 // This file is automatically generated at compile-time to include some subset of the user-created cpp files. #include ../Plugins/Experimental/Animation/PoseSearch/Intermediate/Build/Win64/UnrealEditor/Inc/PoseSearchEditor/UHT/AnimationBlendStackGraph.gen.cpp ... #include ../Plugins/Experimental/Animation/PoseSearch/Source/Editor/Private/AnimationBlendStackGraphSchema.cpp ...貌似是把项目里所有的cpp文件和.gen.cpp文件都include进来了这里有几个问题 为啥cpp也要include进来它们不是自身就会被编译吗搞这个联合编译cpp是做啥的 我顺便查了下我之前写的AnimationPreviewLibrary的Editor Plugin里面创建了四个cppUE的UBT同样在对应的intermediate文件夹里生成了Module.AnimationPreviewLibrary.cpp如下所示 // This file is automatically generated at compile-time to include some subset of the user-created cpp files. #include F:/UnrealProjects/MyProjectUE5_1_0/Plugins/AnimationPreviewLibrary/Source/AnimationPreviewLibrary/Private/AnimationPreviewLibrary.cpp #include F:/UnrealProjects/MyProjectUE5_1_0/Plugins/AnimationPreviewLibrary/Source/AnimationPreviewLibrary/Private/AnimationPreviewLibraryCommands.cpp #include F:/UnrealProjects/MyProjectUE5_1_0/Plugins/AnimationPreviewLibrary/Source/AnimationPreviewLibrary/Private/AnimationPreviewLibraryStyle.cpp #include F:/UnrealProjects/MyProjectUE5_1_0/Plugins/AnimationPreviewLibrary/Source/AnimationPreviewLibrary/Private/SAnimPreviewLibraryWindowMenu.cpp我理解这个文件就是为了方便编译的搞个unity file把一个模块的所有的cpp都引入进去方便管理这样一来比如UE有130个Module那就只需要编译和link这130个各自Module对应的cpp文件(类似于Translation Unit)即可 如下是UBT的流程 UBT生成的Definition.xxx.h文件 UBT会为Module生成一个特殊的cpp文件Build的时候去编译这个cppLink对应的object即可在此过程中UBT还生成了涉及到宏的Definition.xxx.h文件如下图所示 几个问题 此文件是基于什么生成的是Build.cs文件吗 这个文件还有别于这里的Module.xxxx.cpp因为实际工程里是不需要后者这个unity file的而这个Definitions.xxx.h里的宏则是实际工程里需要的如下图所示我这里的工程貌似没找到此文件所以辨认不出这个宏 宏的颜色应该是紫色的这里的intellisense都没辨认出来是宏所以相关的intellisense都失效了虽然build是没有任何问题的但这个问题很影响我看代码了我可以临时参照Definition文件加一句这个 #ifndef POSESEARCH_API #define POSESEARCH_API DLLIMPORT #endif但还是挺难受的所以这里的问题是这里面定义的宏是如何影响到VS项目里的高亮的为啥有的项目里F12能直接跳转到Definition.xxx.h文件但是工程里又搜不到此文件 UE Editor添加C的Plugin失败 C工程创建插件时报错显示Unable to create plugin如下图所示 有时候删除所有的中间文件(包括Plugin的中间文件)、在Regenerate Sln文件后就可以打开了。但我在创建第三方插件时怎么做都会报这个错。图中的Output log应该指的是Console重点信息如下 Building 5 actions with 5 processes... [1/5] Resource Default.rc2 [2/5] Link [x64] UnrealEditor-ffff3213213-Win64-DebugGame.dll cancelled [3/5] Link [x64] UnrealEditor-ffff3213213-Win64-DebugGame.lib cancelled [4/5] Compile [x64] ffff3213213.cpp F:\UnrealProjects\MotionMatchingDemoDebug\Plugins\ffff3213213\Source\ffff3213213\Private\ffff3213213.cpp(7): fatal error C1083: Cannot open include file: ffff3213213Library/ExampleLibrary.h: No such file or directory [5/5] WriteMetadata MotionMatchingDemoEditor-Win64-DebugGame.target cancelled最后大概找到原因了我是用自己的引擎版本创建的VS工程然后我删除中间文件后右键uproject Regenerate Sln文件却是用的安装好的UE引擎此时去创建就会有问题具体原因是为什么我还不确定中间文件不是都删除了么跟引擎版本应该没有关系啊 我把中间文件全删了然后源码直接attach uproject文件再在Editor里生成VS工程再去创建第三方插件就可以了。
http://www.zqtcl.cn/news/347131/

相关文章:

  • 提供衡水网站建设wordpress游客看小图登陆查看大图
  • 网站开发优势wordpress 密码破解
  • 做网站空间需要多大深圳服装网站建设
  • 建网站wordpress制作app多少钱一个
  • 怎么做装修网站torrentkitty磁力猫
  • 网站建立站点wordpress手机网站模板制作
  • 宁夏建设工程招标投标信息网站教师做网站赚钱
  • 潍坊网站制作价格网站维护入门教程
  • 微信网站怎么做下载附件wordpress英文主题汉化
  • 桂平网站设计python基础教程第二版
  • wordpress hermit杭州企业seo网站优化
  • 贵州做团队培训的网站法学网站阵地建设
  • 网站死链是什么西宁高端网站开发公司
  • 做团购网站的公司wordpress附件存放位置
  • 成都最专业做网站的仿win8网站模板
  • 国外设计类网站男女做暖暖试看网站
  • 网站设计哪个好珠海微网站进入
  • 云主机开网站教程模板网会员
  • 网站建设无锡虚拟网站官网
  • 品牌网站设计联系东莞网站优化公
  • 自己做整个网站的流程php装修网站源码
  • 天津网站建设班模拟网站建设软件有哪些
  • 服务类的网站怎么做做软件的网站担保网站
  • 最新电子产品网站模板海口网站排名提升
  • 北京社保网站减员怎么做phpcms v9 实现网站搜索
  • 视频运营管理网站济南网站建设 济南货梯
  • html电影网站模板下载工具阿里云网站建设 部署与发布笔记
  • 建设跨境网站微信seo是什么意思
  • 我做彩票网站开发彩票网站搭建织梦如何仿手机网站源码下载
  • 东仓建设网站手机便宜的网站建设