Skip to content

Commit 5b73e75

Browse files
authored
[mobile] Move to net10 MAUI and add MacCatalyst support (#406)
* [mobile]Move to net8 MAUI and add MacCatalyst support Update onxx runtime Update maui super resolution Add default sln Add Catalyst platform to super resolution Update versions * Remove extra line * Update to net10.0 * Move to slnx * Update RootNamespace MauiVisionSample
1 parent 2c14609 commit 5b73e75

File tree

17 files changed

+216
-104
lines changed

17 files changed

+216
-104
lines changed

mobile/examples/Maui/MauiVisionSample/MauiVisionSample.sln

Lines changed: 0 additions & 27 deletions
This file was deleted.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<Solution>
2+
<Project Path="MauiVisionSample/MauiVisionSample.csproj">
3+
<Deploy />
4+
</Project>
5+
</Solution>

mobile/examples/Maui/MauiVisionSample/MauiVisionSample/MainPage.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public MainPage()
3636
ExecutionProviderOptions.Items.Add(nameof(ExecutionProviders.NNAPI));
3737
}
3838

39-
if (DeviceInfo.Platform == DevicePlatform.iOS)
39+
if (DeviceInfo.Platform == DevicePlatform.iOS || DeviceInfo.Platform == DevicePlatform.MacCatalyst)
4040
{
4141
ExecutionProviderOptions.Items.Add(nameof(ExecutionProviders.CoreML));
4242
}

mobile/examples/Maui/MauiVisionSample/MauiVisionSample/MauiProgram.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33

4+
using Microsoft.Extensions.Logging;
5+
46
namespace MauiVisionSample;
57

68
public static class MauiProgram
@@ -15,7 +17,9 @@ public static MauiApp CreateMauiApp()
1517
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
1618
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
1719
});
18-
19-
return builder.Build();
20+
#if DEBUG
21+
builder.Logging.AddDebug();
22+
#endif
23+
return builder.Build();
2024
}
2125
}
Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net6.0-android;net6.0-ios</TargetFrameworks>
5-
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net6.0-windows10.0.19041.0</TargetFrameworks>
4+
<TargetFrameworks>net10.0-android;net10.0-ios;net10.0-maccatalyst</TargetFrameworks>
5+
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net10.0-windows10.0.19041.0</TargetFrameworks>
6+
7+
<!-- Note for MacCatalyst:
8+
The default runtime is maccatalyst-x64, except in Release config, in which case the default is maccatalyst-x64;maccatalyst-arm64.
9+
When specifying both architectures, use the plural <RuntimeIdentifiers> instead of the singular <RuntimeIdentifier>.
10+
The Mac App Store will NOT accept apps with ONLY maccatalyst-arm64 indicated;
11+
either BOTH runtimes must be indicated or ONLY macatalyst-x64. -->
12+
<!-- For example: <RuntimeIdentifiers>maccatalyst-x64;maccatalyst-arm64</RuntimeIdentifiers> -->
13+
614
<OutputType>Exe</OutputType>
715
<RootNamespace>MauiVisionSample</RootNamespace>
816
<UseMaui>true</UseMaui>
917
<SingleProject>true</SingleProject>
1018
<ImplicitUsings>enable</ImplicitUsings>
19+
<Nullable>enable</Nullable>
1120

1221
<!-- Display name -->
1322
<ApplicationTitle>MauiVisionSample</ApplicationTitle>
@@ -19,24 +28,19 @@
1928
<!-- Versions -->
2029
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
2130
<ApplicationVersion>1</ApplicationVersion>
31+
32+
<!-- To develop, package, and publish an app to the Microsoft Store, see: https://aka.ms/MauiTemplateUnpackaged -->
33+
<WindowsPackageType>None</WindowsPackageType>
2234

23-
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
35+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">15.0</SupportedOSPlatformVersion>
36+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">15.0</SupportedOSPlatformVersion>
2437
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
2538
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
2639
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
40+
2741
<DefaultLanguage>en</DefaultLanguage>
2842
</PropertyGroup>
2943

30-
<!--
31-
Short term workaround for issue with publishing the iOS IPA by manually adding CoreML to the frameworks we link against.
32-
https://github.com/microsoft/onnxruntime/issues/12420
33-
-->
34-
<Target Name="AddCoreML" Condition="'$(TargetFramework)' == 'net6.0-ios'" AfterTargets="_LoadLinkerOutput" BeforeTargets="_ComputeLinkNativeExecutableInputs">
35-
<ItemGroup>
36-
<_LinkerFrameworks Include="CoreML" />
37-
</ItemGroup>
38-
</Target>
39-
4044
<ItemGroup>
4145
<!-- App Icon -->
4246
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />
@@ -55,12 +59,10 @@
5559
</ItemGroup>
5660

5761
<ItemGroup>
58-
<PackageReference Include="Microsoft.ML.OnnxRuntime" Version="1.12.1" />
59-
<PackageReference Include="SkiaSharp" Version="2.88.6" />
62+
<PackageReference Include="SkiaSharp" Version="2.88.8" />
63+
<PackageReference Include="Microsoft.Maui.Controls" Version="10.0.11" />
64+
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="10.0.1" />
65+
<PackageReference Include="Microsoft.ML.OnnxRuntime" Version="1.19.2" />
66+
<PackageReference Include="Microsoft.ML.OnnxRuntime.Extensions" Version="0.13.0-dev-20240909-2349-9164f54e" />
6067
</ItemGroup>
61-
62-
<!--<ItemGroup>
63-
<Folder Include="Resources\Images\" />
64-
</ItemGroup>-->
65-
6668
</Project>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using Foundation;
2+
3+
namespace MauiVisionSample;
4+
5+
[Register("AppDelegate")]
6+
public class AppDelegate : MauiUIApplicationDelegate
7+
{
8+
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
9+
}
10+
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<!-- See https://aka.ms/maui-publish-app-store#add-entitlements for more information about adding entitlements.-->
5+
<dict>
6+
<!-- App Sandbox must be enabled to distribute a MacCatalyst app through the Mac App Store. -->
7+
<key>com.apple.security.app-sandbox</key>
8+
<true/>
9+
<!-- When App Sandbox is enabled, this value is required to open outgoing network connections. -->
10+
<key>com.apple.security.network.client</key>
11+
<true/>
12+
</dict>
13+
</plist>
14+
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<!-- The Mac App Store requires you specify if the app uses encryption. -->
6+
<!-- Please consult https://developer.apple.com/documentation/bundleresources/information_property_list/itsappusesnonexemptencryption -->
7+
<!-- <key>ITSAppUsesNonExemptEncryption</key> -->
8+
<!-- Please indicate <true/> or <false/> here. -->
9+
10+
<!-- Specify the category for your app here. -->
11+
<!-- Please consult https://developer.apple.com/documentation/bundleresources/information_property_list/lsapplicationcategorytype -->
12+
<!-- <key>LSApplicationCategoryType</key> -->
13+
<!-- <string>public.app-category.YOUR-CATEGORY-HERE</string> -->
14+
<key>UIDeviceFamily</key>
15+
<array>
16+
<integer>2</integer>
17+
</array>
18+
<key>UIRequiredDeviceCapabilities</key>
19+
<array>
20+
<string>arm64</string>
21+
</array>
22+
<key>UISupportedInterfaceOrientations</key>
23+
<array>
24+
<string>UIInterfaceOrientationPortrait</string>
25+
<string>UIInterfaceOrientationLandscapeLeft</string>
26+
<string>UIInterfaceOrientationLandscapeRight</string>
27+
</array>
28+
<key>UISupportedInterfaceOrientations~ipad</key>
29+
<array>
30+
<string>UIInterfaceOrientationPortrait</string>
31+
<string>UIInterfaceOrientationPortraitUpsideDown</string>
32+
<string>UIInterfaceOrientationLandscapeLeft</string>
33+
<string>UIInterfaceOrientationLandscapeRight</string>
34+
</array>
35+
<key>XSAppIconAssets</key>
36+
<string>Assets.xcassets/appicon.appiconset</string>
37+
</dict>
38+
</plist>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using ObjCRuntime;
2+
using UIKit;
3+
4+
namespace MauiVisionSample;
5+
6+
public class Program
7+
{
8+
// This is the main entry point of the application.
9+
static void Main(string[] args)
10+
{
11+
// if you want to use a different Application Delegate class from "AppDelegate"
12+
// you can specify it here.
13+
UIApplication.Main(args, null, typeof(AppDelegate));
14+
}
15+
}
16+

mobile/examples/super_resolution/MAUI/MauiSuperResolution.sln

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)