From 998441899f807421417644fbddeba427d721ea2b Mon Sep 17 00:00:00 2001 From: BlueRose <378100977@qq.com> Date: Tue, 4 Jul 2023 14:16:27 +0800 Subject: [PATCH] vault backup: 2023-07-04 14:16:27 --- 07-Other/MAC/安装Mac UE开发环境.md | 47 +++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/07-Other/MAC/安装Mac UE开发环境.md b/07-Other/MAC/安装Mac UE开发环境.md index f3f5cd7..6f5cd89 100644 --- a/07-Other/MAC/安装Mac UE开发环境.md +++ b/07-Other/MAC/安装Mac UE开发环境.md @@ -62,7 +62,10 @@ https://github.com/trulyspinach/SMCAMDProcessor/releases/tag/0.7.1 ## ATOMIC_VAR_INIT错误 https://forums.unrealengine.com/t/cannot-build-ue-5-1-1-from-source-on-macos-ventura-13-3-1-xcode-14-3/885545 -macOS 13.4 Xcode 14.3编译UE5.1会报错,解决方法是: +macOS 13.4 Xcode 14.3编译UE5.1会报错,其原因是: +>So it seems the error is related to the deprecation of `ATOMIC_VAR_INIT` [since C++20 2](https://en.cppreference.com/w/cpp/atomic/ATOMIC_VAR_INIT). I gather [from this table 3](https://en.wikipedia.org/wiki/Xcode#Xcode_11.0_-_14.x_(since_SwiftUI_framework)_2) that Xcode 14.3 includes a clang patch version bump from 14.0.0 to 14.0.3, and a llvm major version bump from 14.0.0 to 15.0.0. With my limited understanding of clang and llvm, I would guess that llvm 15 compiles at C++20, and therefore throws the build error, whereas the build is successful with Xcode 14.2. + +解决方法是: - ShaderCompileWorker.target.cs添加下面的代码。 - UnrealEditor.Target.cs添加下面的代码(去掉bOverrideBuildEnvironment那一行)。 @@ -85,5 +88,47 @@ public class YourGameTarget : TargetRules } ``` +我对文件做了一些修改`Engine/Source/Programs/UnrealBuildTool/Platform/Mac/MacToolChain.cs`,错误消失了。 +```c++ +if (CompilerVersionGreaterOrEqual(14, 0, 0)) +{ + Arguments.Add("-Wno-deprecated-pragma"); +} ``` + +功能齐全: +```csharp +protected override void GetCompileArguments_Global(CppCompileEnvironment CompileEnvironment, List Arguments) +{ + base.GetCompileArguments_Global(CompileEnvironment, Arguments); + + Arguments.Add("-fasm-blocks"); + + if (CompileEnvironment.bEnableOSX109Support) + { + Arguments.Add("-faligned-new"); // aligned operator new is supported only on macOS 10.14 and above + } + + // Pass through architecture and OS info + Arguments.Add("" + FormatArchitectureArg(CompileEnvironment.Architecture)); + Arguments.Add($"-isysroot \"{SDKPath}\""); + Arguments.Add("-mmacosx-version-min=" + (CompileEnvironment.bEnableOSX109Support ? "10.9" : Settings.MacOSVersion)); + + List FrameworksSearchPaths = new List(); + foreach (UEBuildFramework Framework in CompileEnvironment.AdditionalFrameworks) + { + FileReference FrameworkPath = new FileReference(Path.GetFullPath(Framework.Name)); + if (!FrameworksSearchPaths.Contains(FrameworkPath.Directory.FullName)) + { + Arguments.Add($"-F \"{NormalizeCommandLinePath(FrameworkPath.Directory)}\""); + FrameworksSearchPaths.Add(FrameworkPath.Directory.FullName); + } + } + + + if (CompilerVersionGreaterOrEqual(14, 0, 0)) + { + Arguments.Add("-Wno-deprecated-pragma"); + } +} ``` \ No newline at end of file