Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 4 additions & 44 deletions OpenUtauMobile.MacOS/OpenUtauMobile.MacOS.csproj
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0-maccatalyst</TargetFramework>
<TargetPlatformVersion>26.0</TargetPlatformVersion>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<DefineConstants>MACOS</DefineConstants>
<RuntimeIdentifiers>maccatalyst-x64;maccatalyst-arm64</RuntimeIdentifiers>
<ApplicationId>$(ApplicationId)</ApplicationId>
<RuntimeIdentifiers>osx-x64;osx-arm64</RuntimeIdentifiers>
</PropertyGroup>

<!-- 苹果配置 -->
<PropertyGroup>
<!-- 禁用 IL 链接器以避免 DryWetMidi 等库的问题 -->
<MtouchLink>None</MtouchLink>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Avalonia.Desktop" Version="$(AvaloniaVersion)" />
</ItemGroup>
Expand All @@ -29,37 +22,4 @@
</None>
</ItemGroup>

<!-- OnnxRuntime 没有提供 Mac Catalyst 原生库(只有 osx-x64/osx-arm64),
将 macOS dylib 手动引入 Mac Catalyst 构建并传递给链接器 -->
<Target Name="IncludeOnnxRuntimeNativeForMacCatalyst" AfterTargets="ResolvePackageAssets" BeforeTargets="_ComputePublishLocation" Condition="'$(RuntimeIdentifier)' == 'maccatalyst-x64' Or '$(RuntimeIdentifier)' == 'maccatalyst-arm64'">
<PropertyGroup>
<_ORT_NativeRid Condition="'$(RuntimeIdentifier)' == 'maccatalyst-x64'">osx-x64</_ORT_NativeRid>
<_ORT_NativeRid Condition="'$(RuntimeIdentifier)' == 'maccatalyst-arm64'">osx-arm64</_ORT_NativeRid>
<_ORT_DylibSource>$(NuGetPackageRoot)microsoft.ml.onnxruntime/1.23.2/runtimes/$(_ORT_NativeRid)/native/libonnxruntime.dylib</_ORT_DylibSource>
<_ORT_DylibDest>$(IntermediateOutputPath)nativelibraries/Contents/MonoBundle/libonnxruntime.dylib</_ORT_DylibDest>
</PropertyGroup>

<Warning Text="OnnxRuntime dylib not found at $(_ORT_DylibSource) — OnnxRuntime will not work on Mac Catalyst"
Condition="!Exists('$(_ORT_DylibSource)')" />

<MakeDir Directories="$([System.IO.Path]::GetDirectoryName($(_ORT_DylibDest)))"
Condition="Exists('$(_ORT_DylibSource)')" />
<Copy SourceFiles="$(_ORT_DylibSource)" DestinationFiles="$(_ORT_DylibDest)"
Condition="Exists('$(_ORT_DylibSource)')" />

<ItemGroup Condition="Exists('$(_ORT_DylibSource)')">
<ResolvedFileToPublish Include="$(_ORT_DylibDest)">
<RelativePath>libonnxruntime.dylib</RelativePath>
<AssetType>native</AssetType>
<NuGetPackageId>Microsoft.ML.OnnxRuntime</NuGetPackageId>
<NuGetPackageVersion>1.23.2</NuGetPackageVersion>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</ResolvedFileToPublish>
</ItemGroup>

<PropertyGroup Condition="Exists('$(_ORT_DylibSource)')">
<MtouchExtraArgs>$(MtouchExtraArgs) --gcc_flags=-Wl,$(_ORT_DylibDest)</MtouchExtraArgs>
</PropertyGroup>
</Target>
</Project>

</Project>
3 changes: 2 additions & 1 deletion OpenUtauMobile.iOS/OpenUtauMobile.iOS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0-ios</TargetFramework>
<SupportedOSPlatformVersion>13.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion>18.0</SupportedOSPlatformVersion>
<Nullable>enable</Nullable>
</PropertyGroup>

Expand All @@ -14,6 +14,7 @@

<ItemGroup>
<PackageReference Include="Avalonia.iOS" Version="$(AvaloniaVersion)"/>
<PackageReference Include="Microsoft.ML.OnnxRuntime.Extensions" Version="0.14.0" />
</ItemGroup>

<ItemGroup>
Expand Down