Skip to content

Commit 5b61c2b

Browse files
authored
feat: partial support for Mac Silicon (#414)
* add target architecture for apple plugin build * update mac bundle. Contains both x64 and arm64 target * update mac bundle meta info * disable showing preview images on Mac Silicon, due to editor crashes. The fix will be committed later.
1 parent 88a396f commit 5b61c2b

5 files changed

Lines changed: 28 additions & 14 deletions

File tree

Editor/Scripts/Preview/PreviewUtility.cs

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using UnityEngine;
66
using UnityEditor;
77
using UnityEngine.Assertions;
8+
using System.Runtime.InteropServices;
89

910

1011
namespace Unity.StreamingImageSequence.Editor {
@@ -118,8 +119,12 @@ static double FindFrameXPos(double frameTime, double visibleLocalStartTime, doub
118119

119120
//----------------------------------------------------------------------------------------------------------------------
120121

121-
internal static void DrawPreviewImage(ref PreviewDrawInfo drawInfo, string imagePath)
122-
{
122+
internal static void DrawPreviewImage(ref PreviewDrawInfo drawInfo, string imagePath) {
123+
#if UNITY_EDITOR_OSX
124+
//[TODO-sin: 2022-4-4] Disabling. There is a bug in Mac Silicon which causes crash when resizing images
125+
if (IsUsingOSX_Silicon())
126+
return;
127+
#endif
123128
if (!File.Exists(imagePath))
124129
return;
125130

@@ -155,9 +160,17 @@ internal static void DrawPreviewImage(ref PreviewDrawInfo drawInfo, string image
155160
} else {
156161
Graphics.DrawTexture(drawInfo.DrawRect, tex);
157162
}
158-
159163
}
160-
164+
165+
#if UNITY_EDITOR_OSX
166+
static bool IsUsingOSX_Silicon() {
167+
#if UNITY_2021_2_OR_NEWER
168+
return (Architecture.Arm64 == RuntimeInformation.ProcessArchitecture);
169+
#else
170+
return false;
171+
#endif
172+
}
173+
#endif
161174
//----------------------------------------------------------------------------------------------------------------------
162175
static Material GetOrCreateLinearToGammaMaterial() {
163176
if (null != m_linearToGammaMaterial)

Plugins~/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.13)
33
# Mac deployment target
44
if(APPLE)
55
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.12" CACHE STRING "Minimum OS X deployment version")
6+
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "Target Architecture" FORCE)
67
endif()
78

89
PROJECT(StreamingImageSequencePlugin)

Runtime/Plugins/OSX/StreamingImageSequence.bundle.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Runtime/Plugins/OSX/StreamingImageSequence.bundle/Contents/Info.plist

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<plist version="1.0">
44
<dict>
55
<key>BuildMachineOSBuild</key>
6-
<string>18G6032</string>
6+
<string>21E258</string>
77
<key>CFBundleDevelopmentRegion</key>
88
<string>English</string>
99
<key>CFBundleExecutable</key>
@@ -20,24 +20,24 @@
2020
<array>
2121
<string>MacOSX</string>
2222
</array>
23-
<key>CFBundleVersion</key>
24-
<string></string>
2523
<key>CSResourcesFileMapped</key>
2624
<true/>
2725
<key>DTCompiler</key>
2826
<string>com.apple.compilers.llvm.clang.1_0</string>
2927
<key>DTPlatformBuild</key>
30-
<string>11C504</string>
28+
<string>13E113</string>
29+
<key>DTPlatformName</key>
30+
<string>macosx</string>
3131
<key>DTPlatformVersion</key>
32-
<string>GM</string>
32+
<string>12.3</string>
3333
<key>DTSDKBuild</key>
34-
<string>19B90</string>
34+
<string>21E226</string>
3535
<key>DTSDKName</key>
36-
<string>macosx10.15</string>
36+
<string>macosx12.3</string>
3737
<key>DTXcode</key>
38-
<string>1131</string>
38+
<string>1330</string>
3939
<key>DTXcodeBuild</key>
40-
<string>11C504</string>
40+
<string>13E113</string>
4141
<key>LSMinimumSystemVersion</key>
4242
<string>10.12</string>
4343
<key>NSHumanReadableCopyright</key>
Binary file not shown.

0 commit comments

Comments
 (0)