Skip to content

Commit

Permalink
Detect MacCatalyst platform.
Browse files Browse the repository at this point in the history
  • Loading branch information
emgucv committed Apr 18, 2024
1 parent 4efc19b commit bbeb004
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
5 changes: 3 additions & 2 deletions Emgu.CV/PInvoke/CvInvoke.cs
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,8 @@ static CvInvoke()
#if ( UNITY_WEBGL && ! UNITY_EDITOR )
_libraryLoaded = true;
#else
if (Emgu.Util.Platform.OperationSystem == Emgu.Util.Platform.OS.IOS)
if (Emgu.Util.Platform.OperationSystem == Emgu.Util.Platform.OS.IOS ||
Emgu.Util.Platform.OperationSystem == Emgu.Util.Platform.OS.MacCatalyst)
{
/*
Assembly assembly = Assembly.GetExecutingAssembly();
Expand All @@ -468,7 +469,7 @@ static CvInvoke()
};
*/

//For iOS, library are static linked, assume correct loading by default.
//iOS or MacCatalyst libraries are static linked, assume correct loading by default.
_libraryLoaded = true;
return;
}
Expand Down
22 changes: 16 additions & 6 deletions Emgu.Util/Platform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,24 +42,30 @@ static Platform()
_os = OS.Android;
_runtime = Clr.Mono;
}
else if (Emgu.Util.Toolbox.FindAssembly("Microsoft.Android.dll") != null)
{
//MAUI Android
_os = OS.Android;
_runtime = Clr.DotNet;
}
else if (Emgu.Util.Toolbox.FindAssembly("Xamarin.iOS.dll") != null)
{
//Xamarin iOS
_os = OS.IOS;
_runtime = Clr.Mono;
}
else if (Emgu.Util.Toolbox.FindAssembly("Microsoft.Android.dll") != null)
{
//MAUI Android
_os = OS.Android;
_runtime = Clr.DotNet;
}
else if (Emgu.Util.Toolbox.FindAssembly("Microsoft.iOS.dll") != null)
{
//MAUI iOS
_os = OS.IOS;
_runtime = Clr.DotNet;
}
else if (Emgu.Util.Toolbox.FindAssembly("Microsoft.MacCatalyst.dll") != null)
{
//MAUI MacCatalyst
_os = OS.MacCatalyst;
_runtime = Clr.DotNet;
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
_os = OS.MacOS;
Expand Down Expand Up @@ -114,6 +120,10 @@ public enum OS
/// </summary>
MacOS,
/// <summary>
/// Mac Catalyst. IPad app running on Mac OS.
/// </summary>
MacCatalyst,
/// <summary>
/// iOS devices. iPhone, iPad, iPod Touch
/// </summary>
IOS,
Expand Down

0 comments on commit bbeb004

Please sign in to comment.