Add arm64 support for macOS
This commit is contained in:
@@ -115,6 +115,12 @@ API_ENUM() enum class BuildPlatform
|
||||
/// </summary>
|
||||
API_ENUM(Attributes="EditorDisplay(null, \"Mac x64\")")
|
||||
MacOSx64 = 12,
|
||||
|
||||
/// <summary>
|
||||
/// MacOS (ARM64 Apple Silicon)
|
||||
/// </summary>
|
||||
API_ENUM(Attributes="EditorDisplay(null, \"Mac ARM64\")")
|
||||
MacOSARM64 = 13,
|
||||
};
|
||||
|
||||
extern FLAXENGINE_API const Char* ToString(const BuildPlatform platform);
|
||||
|
||||
@@ -139,6 +139,8 @@ const Char* ToString(const BuildPlatform platform)
|
||||
return TEXT("PlayStation 5");
|
||||
case BuildPlatform::MacOSx64:
|
||||
return TEXT("Mac x64");
|
||||
case BuildPlatform::MacOSARM64:
|
||||
return TEXT("Mac ARM64");
|
||||
default:
|
||||
return TEXT("?");
|
||||
}
|
||||
@@ -340,6 +342,9 @@ PlatformTools* GameCooker::GetTools(BuildPlatform platform)
|
||||
case BuildPlatform::MacOSx64:
|
||||
result = New<MacPlatformTools>(ArchitectureType::x64);
|
||||
break;
|
||||
case BuildPlatform::MacOSARM64:
|
||||
result = New<MacPlatformTools>(ArchitectureType::ARM64);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
Tools.Add(platform, result);
|
||||
@@ -470,7 +475,7 @@ void GameCooker::GetCurrentPlatform(PlatformType& platform, BuildPlatform& build
|
||||
buildPlatform = BuildPlatform::PS5;
|
||||
break;
|
||||
case PlatformType::Mac:
|
||||
buildPlatform = BuildPlatform::MacOSx64;
|
||||
buildPlatform = PLATFORM_ARCH_ARM ? BuildPlatform::AndroidARM64 : BuildPlatform::MacOSx64;
|
||||
break;
|
||||
default: ;
|
||||
}
|
||||
|
||||
@@ -103,6 +103,7 @@ namespace FlaxEditor
|
||||
case BuildPlatform.AndroidARM64: return PlatformType.Android;
|
||||
case BuildPlatform.XboxScarlett: return PlatformType.XboxScarlett;
|
||||
case BuildPlatform.Switch: return PlatformType.Switch;
|
||||
case BuildPlatform.MacOSARM64:
|
||||
case BuildPlatform.MacOSx64: return PlatformType.Mac;
|
||||
default: throw new ArgumentOutOfRangeException(nameof(buildPlatform), buildPlatform, null);
|
||||
}
|
||||
|
||||
@@ -201,7 +201,15 @@ bool MacPlatformTools::OnPostProcess(CookingData& data)
|
||||
|
||||
dict.append_child(PUGIXML_TEXT("key")).set_child_value(PUGIXML_TEXT("LSMinimumSystemVersionByArchitecture"));
|
||||
xml_node LSMinimumSystemVersionByArchitecture = dict.append_child(PUGIXML_TEXT("dict"));
|
||||
LSMinimumSystemVersionByArchitecture.append_child(PUGIXML_TEXT("key")).set_child_value(PUGIXML_TEXT("x86_64"));
|
||||
switch (_arch)
|
||||
{
|
||||
case ArchitectureType::x64:
|
||||
LSMinimumSystemVersionByArchitecture.append_child(PUGIXML_TEXT("key")).set_child_value(PUGIXML_TEXT("x86_64"));
|
||||
break;
|
||||
case ArchitectureType::ARM64:
|
||||
LSMinimumSystemVersionByArchitecture.append_child(PUGIXML_TEXT("key")).set_child_value(PUGIXML_TEXT("arm64"));
|
||||
break;
|
||||
}
|
||||
LSMinimumSystemVersionByArchitecture.append_child(PUGIXML_TEXT("string")).set_child_value(PUGIXML_TEXT("10.14"));
|
||||
|
||||
#undef ADD_ENTRY
|
||||
|
||||
@@ -204,6 +204,10 @@ bool CompileScriptsStep::Perform(CookingData& data)
|
||||
platform = TEXT("Mac");
|
||||
architecture = TEXT("x64");
|
||||
break;
|
||||
case BuildPlatform::MacOSARM64:
|
||||
platform = TEXT("Mac");
|
||||
architecture = TEXT("ARM64");
|
||||
break;
|
||||
default:
|
||||
LOG(Error, "Unknown or unsupported build platform.");
|
||||
return true;
|
||||
|
||||
@@ -528,6 +528,7 @@ bool ProcessShaderBase(CookAssetsStep::AssetCookData& data, ShaderAssetBase* ass
|
||||
#endif
|
||||
#if PLATFORM_TOOLS_MAC
|
||||
case BuildPlatform::MacOSx64:
|
||||
case BuildPlatform::MacOSARM64:
|
||||
{
|
||||
const char* platformDefineName = "PLATFORM_MAC";
|
||||
COMPILE_PROFILE(Vulkan_SM5, SHADER_FILE_CHUNK_INTERNAL_VULKAN_SM5_CACHE);
|
||||
|
||||
@@ -387,6 +387,8 @@ void ScriptsBuilder::GetBinariesConfiguration(const Char*& target, const Char*&
|
||||
architecture = TEXT("x64");
|
||||
#elif PLATFORM_ARCH_X86
|
||||
architecture = TEXT("x86");
|
||||
#elif PLATFORM_ARCH_ARM64
|
||||
architecture = TEXT("arm64");
|
||||
#else
|
||||
#error "Unknown architecture"
|
||||
#endif
|
||||
|
||||
@@ -7,10 +7,17 @@
|
||||
#include "../Unix/UnixDefines.h"
|
||||
|
||||
// Platform description
|
||||
#define PLATFORM_TYPE PlatformType::Mac
|
||||
#if __aarch64__
|
||||
#define PLATFORM_64BITS 1
|
||||
#define PLATFORM_ARCH_ARM64 1
|
||||
#define PLATFORM_ARCH ArchitectureType::ARM64
|
||||
#else
|
||||
sss;
|
||||
#define PLATFORM_64BITS 1
|
||||
#define PLATFORM_ARCH_X64 1
|
||||
#define PLATFORM_ARCH ArchitectureType::x64
|
||||
#define PLATFORM_TYPE PlatformType::Mac
|
||||
#endif
|
||||
#define PLATFORM_DESKTOP 1
|
||||
#define PLATFORM_CACHE_LINE_SIZE 128
|
||||
#define PLATFORM_HAS_HEADLESS_MODE 1
|
||||
|
||||
@@ -28,6 +28,7 @@ public class FlaxEditor : EngineTarget
|
||||
Architectures = new[]
|
||||
{
|
||||
TargetArchitecture.x64,
|
||||
TargetArchitecture.ARM64,
|
||||
};
|
||||
GlobalDefinitions.Add("USE_EDITOR");
|
||||
Win32ResourceFile = Path.Combine(Globals.EngineRoot, "Source", "FlaxEditor.rc");
|
||||
|
||||
@@ -314,7 +314,7 @@ namespace Flax.Build
|
||||
case TargetPlatform.PS5: return targetArchitecture == TargetArchitecture.x64;
|
||||
case TargetPlatform.Android: return targetArchitecture == TargetArchitecture.ARM64;
|
||||
case TargetPlatform.Switch: return targetArchitecture == TargetArchitecture.ARM64;
|
||||
case TargetPlatform.Mac: return targetArchitecture == TargetArchitecture.x64;
|
||||
case TargetPlatform.Mac: return targetArchitecture == TargetArchitecture.ARM64 || targetArchitecture == TargetArchitecture.x64;
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,10 +131,23 @@ namespace Flax.Build.Platforms
|
||||
commonArgs.Add("-pipe");
|
||||
commonArgs.Add("-x");
|
||||
commonArgs.Add("objective-c++");
|
||||
commonArgs.Add("-std=c++14");
|
||||
commonArgs.Add("-stdlib=libc++");
|
||||
AddArgsCommon(options, commonArgs);
|
||||
|
||||
switch (compileEnvironment.CppVersion)
|
||||
{
|
||||
case CppVersion.Cpp14:
|
||||
commonArgs.Add("-std=c++14");
|
||||
break;
|
||||
case CppVersion.Cpp17:
|
||||
case CppVersion.Latest:
|
||||
commonArgs.Add("-std=c++17");
|
||||
break;
|
||||
case CppVersion.Cpp20:
|
||||
commonArgs.Add("-std=c++20");
|
||||
break;
|
||||
}
|
||||
|
||||
switch (Architecture)
|
||||
{
|
||||
case TargetArchitecture.x64:
|
||||
|
||||
@@ -226,6 +226,7 @@ namespace Flax.Build.Platforms
|
||||
switch (architecture)
|
||||
{
|
||||
case TargetArchitecture.x64: return "x86_64-apple-macos" + Configuration.MacOSXMinVer;
|
||||
case TargetArchitecture.ARM64: return "aarch64-apple-macos" + Configuration.MacOSXMinVer;
|
||||
default: throw new InvalidArchitectureException(architecture);
|
||||
}
|
||||
default: throw new InvalidPlatformException(platform);
|
||||
|
||||
Reference in New Issue
Block a user