Mac 编译 Unreal 源码版本

Mac M3 Pro、XCode 16.0、Unreal 5.4

流程

分享下我本地操作的全流程和遇到的问题

  • 安装 XCode
  • GithubDesktop 克隆自己 Fork 的仓库
  • 运行 Setup.command
  • 运行 GenerateProjectFiles.command
    • 出现警告:Platform Mac is not a valid platform to build. Check that the SDK is installed properly and that you have the necessary platorm support files
    • 造成的问题为 XCode 打开后没有项目
    • 原因:Engine/Config/Apple/Apple_SDK.json 内限制了 XCode 的版本为 15.9.0,但是本地的版本为 16.0.0
    • 解决办法:修改 json 内的 MaxVersion 为 16.0.0 即可
json 复制代码
{
	// Xcode versions
	"MainVersion": "14.1",
	"MinVersion": "14.1.0",
	"MaxVersion": "15.9.0",

	// The versions on Windows are iTunes versions
	"MinVersion_Win64": "1100.0.0.0",
	"MaxVersion_Win64": "8999.0"
}
  • 打开 UE5 (Mac).xcworkspace

  • XCode 上方栏内的目标项目改为 UnrealEditor

  • 菜单栏 - Product - Build

  • 左侧项目目录界面的右侧可以查看日志

  • 然后就是漫长的编译了,编译慢的一批

  • 编译后就可以Run了,跑编辑器,后续流程同Windows

  • 原有项目的.uproject 右键 switch engine version

  • 然后 generate xcode project,我这边没有用,改用命令行后才成功:

    sh "/Users/XXX/Documents/Projects/UnrealEngine/Engine/Build/BatchFiles/Mac/GenerateProjectFiles.sh" -project="/Users/XXX/Documents/Projects/XXX/XXX.uproject" -game

  • XCode 上方栏内的目标项目改为 XXXEditor,编译运行即可

编译问题

cpp 复制代码
declaration shadows a field of 'XXX' [-Werror,-Wshadow]

implicit capture of 'this' with a capture default of '=' is deprecated [-Werror,-Wdeprecated-this-capture]

encoding prefix 'u' on an unevaluated string literal has no effect and is incompatible with c++2c [-Werror,-Winvalid-unevaluated-string]

第一个问题:

cpp 复制代码
// Engine/Source/Programs/UnrealBuildTool/ToolChain/ClangWarnings.cs

if (CompileEnvironment.ShadowVariableWarningLevel != WarningLevel.Off)
{
	// Arguments.Add("-Wshadow" + ((CompileEnvironment.ShadowVariableWarningLevel == WarningLevel.Error) ? "" : " -Wno-error=shadow"));
}

第二个问题:

https://www.emmtrix.com/wiki/Clang:Diag/warn_deprecated_this_capture

C++20 不在允许隐式捕获this,加一下就好了:

cpp 复制代码
[=, this]

第三个问题:

https://github.com/llvm/llvm-project/issues/64711

https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2741r3.pdf

把static_assert内的TEXT宏去掉即可

相关推荐
zhangzhangkeji17 小时前
UE5 C++(54)动态创建材质实例,类 UMateriallnstance 的继承关系,与矢量 FLinearColor、FColor
ue5
zhangzhangkeji1 天前
UE5 C++(56)获取文件的路径名、文件名,还有后缀名。处理文件名与路径的类 FPaths 及其成员函数 GetPathLeaf(..)获取叶子节点,
ue5
AI视觉网奇1 天前
ue5 设置灯光
笔记·ue5
1204157137 肖哥1 天前
ue5 蓝图动画:计算位移线速度来设置车轮转速
ue5·点积·蓝图动画
朗迹 - 张伟2 天前
UE5 City Traffic Pro 交通插件学习笔记
笔记·学习·ue5
*小天屎*2 天前
UE5 项目打包与 Pixel Streaming 浏览器部署指南
ue5·node.js·虚幻引擎
zhangzhangkeji3 天前
UE5 C++(48-3):共享指针的老师讲解的例题。以及 共享指针 TSharedPtr<T, ESPMode> 的源代码
ue5
暮志未晚Webgl4 天前
UE5Niagara粒子系统性能优化
ue5
努力的小钟5 天前
UObject创建系统深度分析
ue5
速冻鱼Kiel5 天前
Lyra的相机系统
笔记·ue5·游戏引擎·虚幻