Skip to content

Commit c901ad4

Browse files
skottmckayankitm3k
authored andcommitted
Rework the native library usage so that a pre-built ORT native package can be easily used (microsoft#22345)
### Description The local build of the native library was being included by almost every project, but is only needed to run tests. Due to the multiple inclusions attempting to use a pre-built package was clashing with any local builds that were available. Create a helper file to include either a local built of a pre-built package and include that in the two test projects. Cleanup various miscellaous things. ### Motivation and Context Create setup to simplify running on-device tests with the nuget packages.
1 parent 1d00718 commit c901ad4

File tree

8 files changed

+447
-575
lines changed

8 files changed

+447
-575
lines changed

csharp/OnnxRuntime.CSharp.proj

+1-8
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,6 @@ CMake creates a target to this project
6464
<Error Text="Building via this file is not supported. Please build using the appropriate .sln file in this directory." />
6565
</Target>
6666

67-
<Target Name="RunTest">
68-
<Message Importance="High" Text="Running CSharp tests..." />
69-
<Exec Command="$(DotNetExe) test test\Microsoft.ML.OnnxRuntime.Tests\Microsoft.ML.OnnxRuntime.Tests.csproj -c $(Configuration) --no-build --blame -v n" ConsoleToMSBuild="true">
70-
<Output TaskParameter="ConsoleOutput" PropertyName="OutputOfExec" />
71-
</Exec>
72-
</Target>
73-
7467
<Target Name="ObtainPackageVersion" BeforeTargets="Build;CreatePackage;CreateWindowsAIPackage;CreateNativePackage">
7568
<ReadLinesFromFile File="..\VERSION_NUMBER">
7669
<Output TaskParameter="Lines" ItemName="MajorVersionNumber"/>
@@ -153,7 +146,7 @@ CMake creates a target to this project
153146
<!-- Create Microsoft.ML.OnnxRuntime.Managed with the C# bindings using the C# project -->
154147
<Message Condition="'$(IsPlatformSpecificSubPackage)'!='True'" Importance="High" Text="Creating Microsoft.ML.OnnxRuntime.Managed nuget package..." />
155148
<MSBuild Condition="'$(IsPlatformSpecificSubPackage)'!='True'" Projects="src\Microsoft.ML.OnnxRuntime\Microsoft.ML.OnnxRuntime.csproj"
156-
Targets="CopyMiscFiles;Pack"
149+
Targets="RenameFilesToPack;Pack"
157150
Properties="NoBuild=true;Platform=AnyCPU;PackageVersion=$(PackageVersion);OrtPackageId=$(OrtPackageId);IncludeMobileTargets=$(IncludeMobileTargets)"/>
158151

159152
<MSBuild Projects ="$(MSBuildProjectFullPath)"

csharp/src/Microsoft.ML.OnnxRuntime/Microsoft.ML.OnnxRuntime.csproj

+88-184
Large diffs are not rendered by default.

csharp/test/Microsoft.ML.OnnxRuntime.Tests.Common/Microsoft.ML.OnnxRuntime.Tests.Common.csproj

+27-50
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<IsWindowsBuild Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))' == 'true'">true</IsWindowsBuild>
4+
<IsLinuxBuild Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true'">true</IsLinuxBuild>
5+
<IsMacOSBuild Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' == 'true'">true</IsMacOSBuild>
6+
7+
<OnnxRuntimeRoot>$(ProjectDir)..\..\..</OnnxRuntimeRoot>
8+
</PropertyGroup>
29

310
<PropertyGroup>
411
<!-- netstandard2.0 is used by most platforms. net8.0 is required for linux. -->
512
<TargetFrameworks>netstandard2.0;net8.0</TargetFrameworks>
613
<IsPackable>false</IsPackable>
7-
<OnnxRuntimeCsharpRoot>$(ProjectDir)..\..</OnnxRuntimeCsharpRoot>
814
<Platforms>AnyCPU</Platforms>
915
<OutputPath>bin\$(Configuration)\</OutputPath>
10-
<IsLinuxBuild Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true'">true</IsLinuxBuild>
11-
<IsWindowsBuild Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))' == 'true'">true</IsWindowsBuild>
12-
<IsMacOSBuild Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' == 'true'">true</IsMacOSBuild>
13-
<ProtoSrc>$(OnnxRuntimeCsharpRoot)\..\cmake\external\onnx</ProtoSrc>
16+
<ProtoSrc>$(OnnxRuntimeRoot)\cmake\external\onnx</ProtoSrc>
1417

1518
<!-- Generated OnnxML.cs triggers this warning. -->
1619
<NoWarn>8981</NoWarn>
@@ -22,30 +25,22 @@
2225
<AssemblyOriginatorKeyFile>..\..\OnnxRuntime.snk</AssemblyOriginatorKeyFile>
2326
<Configurations>Debug;Release;RelWithDebInfo</Configurations>
2427
<!-- end -->
28+
2529
<RootNamespace>Microsoft.ML.OnnxRuntime.Tests</RootNamespace>
2630
<AssemblyName>Microsoft.ML.OnnxRuntime.Tests.Common</AssemblyName>
2731
</PropertyGroup>
2832

29-
<PropertyGroup Condition="'$(IsLinuxBuild)'=='true'">
30-
<!--internal build related properties for Linux -->
31-
<OnnxRuntimeBuildDirectory Condition="'$(OnnxRuntimeBuildDirectory)'==''">$(OnnxRuntimeCsharpRoot)\..\build\Linux</OnnxRuntimeBuildDirectory>
32-
<NativeBuildOutputDir>$(OnnxRuntimeBuildDirectory)\$(Configuration)</NativeBuildOutputDir>
33-
<ProtocDirectory Condition="'$(ProtocDirectory)'==''">$(OnnxRuntimeBuildDirectory)\$(Configuration)\external\protobuf\cmake</ProtocDirectory>
34-
<ProtocExe>$(ProtocDirectory)\protoc</ProtocExe>
35-
</PropertyGroup>
36-
3733
<PropertyGroup Condition="'$(IsWindowsBuild)'=='true'">
38-
<!--internal build related properties for Windows -->
39-
<OnnxRuntimeBuildDirectory Condition="'$(OnnxRuntimeBuildDirectory)'==''">$(OnnxRuntimeCsharpRoot)\..\build\Windows</OnnxRuntimeBuildDirectory>
40-
<NativeBuildOutputDir>$(OnnxRuntimeBuildDirectory)\$(Configuration)\$(Configuration)</NativeBuildOutputDir>
4134
<ProtocDirectory Condition="'$(ProtocDirectory)'==''">$(OnnxRuntimeBuildDirectory)\$(Configuration)\external\protobuf\cmake\$(Configuration)</ProtocDirectory>
4235
<ProtocExe>$(ProtocDirectory)\protoc.exe</ProtocExe>
4336
</PropertyGroup>
4437

38+
<PropertyGroup Condition="'$(IsLinuxBuild)'=='true'">
39+
<ProtocDirectory Condition="'$(ProtocDirectory)'==''">$(OnnxRuntimeBuildDirectory)\$(Configuration)\external\protobuf\cmake</ProtocDirectory>
40+
<ProtocExe>$(ProtocDirectory)\protoc</ProtocExe>
41+
</PropertyGroup>
42+
4543
<PropertyGroup Condition="'$(IsMacOSBuild)'=='true'">
46-
<!--internal build related properties for OSX -->
47-
<OnnxRuntimeBuildDirectory Condition="'$(OnnxRuntimeBuildDirectory)'==''">$(OnnxRuntimeCsharpRoot)\..\build\MacOS</OnnxRuntimeBuildDirectory>
48-
<NativeBuildOutputDir>$(OnnxRuntimeBuildDirectory)\$(Configuration)</NativeBuildOutputDir>
4944
<ProtocDirectory Condition="'$(ProtocDirectory)'==''">$(OnnxRuntimeBuildDirectory)\$(Configuration)\external\protobuf\cmake</ProtocDirectory>
5045
<ProtocExe>$(ProtocDirectory)\protoc</ProtocExe>
5146
</PropertyGroup>
@@ -102,28 +97,6 @@
10297
</None>
10398
</ItemGroup>
10499

105-
<!--
106-
Microsoft.ML.OnnxRuntime.Tests.MAUI.csproj handles the native lib coming from a local build or a nuget package so we
107-
don't need to duplicate that logic to include the native lib here.
108-
-->
109-
<ItemGroup Condition="$(SkipNativeLibInclude) != 'true'">
110-
<None Condition="'$(IsWindowsBuild)'=='true'"
111-
Include="$(NativeBuildOutputDir)\onnxruntime.dll;$(NativeBuildOutputDir)\onnxruntime.pdb">
112-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
113-
<Visible>false</Visible>
114-
</None>
115-
116-
<None Condition="'$(IsLinuxBuild)'=='true'" Include="$(NativeBuildOutputDir)\libonnxruntime.so">
117-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
118-
<Visible>false</Visible>
119-
</None>
120-
121-
<None Condition="'$(IsMacOSBuild)'=='true'" Include="$(NativeBuildOutputDir)\libonnxruntime.dylib">
122-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
123-
<Visible>false</Visible>
124-
</None>
125-
</ItemGroup>
126-
127100
<ItemGroup>
128101
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.0" />
129102
<PackageReference Include="Google.Protobuf" Version="3.21.12" />
@@ -132,16 +105,20 @@
132105
</ItemGroup>
133106

134107
<ItemGroup>
135-
<ProjectReference Include="$(OnnxRuntimeCsharpRoot)\src\Microsoft.ML.OnnxRuntime\Microsoft.ML.OnnxRuntime.csproj" />
108+
<ProjectReference Include="$(OnnxRuntimeRoot)\csharp\src\Microsoft.ML.OnnxRuntime\Microsoft.ML.OnnxRuntime.csproj" />
136109
</ItemGroup>
137110

138111
<!-- generate OnnxMl.cs from ONNX protobuf definition -->
139112
<Target Name="ProtoGen" BeforeTargets="BeforeBuild" Condition="Exists('$(ProtocExe)')">
140-
<Exec Command="$(ProtocExe) -I=$(ProtoSrc) --csharp_out=. $(ProtoSrc)\onnx\onnx-ml.proto3" ContinueOnError="false"></Exec>
113+
<Exec Command="$(ProtocExe) -I=$(ProtoSrc) --csharp_out=. $(ProtoSrc)\onnx\onnx-ml.proto3"
114+
ContinueOnError="false">
115+
</Exec>
141116
</Target>
142117

143118
<Target Name="ProtoDataGen" BeforeTargets="BeforeBuild" Condition="Exists('$(ProtocExe)')">
144-
<Exec Command="$(ProtocExe) -I=$(ProtoSrc) --csharp_out=. $(ProtoSrc)\onnx\onnx-data.proto3" ContinueOnError="false"></Exec>
119+
<Exec Command="$(ProtocExe) -I=$(ProtoSrc) --csharp_out=. $(ProtoSrc)\onnx\onnx-data.proto3"
120+
ContinueOnError="false">
121+
</Exec>
145122
</Target>
146123

147124
<ItemGroup>
@@ -152,20 +129,20 @@
152129
<WriteLinesToFile File="$(OutputPath)\Properties.txt" Lines="@(BuildEnvVars)" Overwrite="true" />
153130
</Target>
154131

132+
<!-- Test Data that is used in MAUI and NetCore test app. Loaded via embedded resource for that to be possible -->
155133
<ItemGroup>
156134
<EmbeddedResource Include="..\..\testdata\*">
157-
<Link>TestData\%(Filename)%(Extension)</Link>
135+
<Link>TestData\%(Filename)%(Extension)</Link>
158136
</EmbeddedResource>
159-
<EmbeddedResource Include="$(OnnxRuntimeCSharpRoot)\..\onnxruntime\test\testdata\overridable_initializer.onnx">
160-
<Link>TestData\overridable_initializer.onnx</Link>
137+
<EmbeddedResource Include="$(OnnxRuntimeRoot)\onnxruntime\test\testdata\overridable_initializer.onnx">
138+
<Link>TestData\overridable_initializer.onnx</Link>
161139
</EmbeddedResource>
162-
<EmbeddedResource Include="$(OnnxRuntimeCSharpRoot)\..\onnxruntime\test\testdata\capi_symbolic_dims.onnx">
163-
<Link>TestData\capi_symbolic_dims.onnx</Link>
140+
<EmbeddedResource Include="$(OnnxRuntimeRoot)\onnxruntime\test\testdata\capi_symbolic_dims.onnx">
141+
<Link>TestData\capi_symbolic_dims.onnx</Link>
164142
</EmbeddedResource>
165143
</ItemGroup>
166144

167145
<ItemGroup>
168146
<Service Include="{508349b6-6b84-4df5-91f0-309beebad82d}" />
169147
</ItemGroup>
170-
171148
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
<!--
2+
Add the native libraries from either a local build or a prebuilt native nuget package.
3+
4+
This has to be imported by the test project with the actual target platform/frameworks to work correctly as the common
5+
test project only targets net8 and netstandard2.0.
6+
-->
7+
<Project>
8+
<PropertyGroup>
9+
<!-- build host system -->
10+
<IsWindowsBuild Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))' == 'true'">true</IsWindowsBuild>
11+
<IsLinuxBuild Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true'">true</IsLinuxBuild>
12+
<IsMacOSBuild Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' == 'true'">true</IsMacOSBuild>
13+
14+
<!-- set for MAUI targets -->
15+
<IsWindowsTarget Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">true</IsWindowsTarget>
16+
<IsAndroidTarget Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">true</IsAndroidTarget>
17+
<IsIOSTarget Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">true</IsIOSTarget>
18+
<IsMacCatalystTarget Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">true</IsMacCatalystTarget>
19+
20+
<!--
21+
Allow a pre-built ORT native nuget package (Microsoft.ML.OnnxRuntime.<version>.nupkg) to be used.
22+
23+
The test projects that include this file must be built from the command-line to enable using a prebuilt package.
24+
Current test projects:
25+
- Microsoft.ML.OnnxRuntime.Tests.NetCoreApp
26+
- Microsoft.ML.OnnxRuntime.Tests.MAUI
27+
28+
If running from the repo root the below is an example command.
29+
Note that '==' represents a double '-' which isn't allowed in an XML comment
30+
Properties can also be set via environment variables.
31+
32+
dotnet build csharp\test\Microsoft.ML.OnnxRuntime.Tests.MAUI\Microsoft.ML.OnnxRuntime.Tests.MAUI.csproj
33+
==property:UsePrebuiltNativePackage=true
34+
==property:CurrentOnnxRuntimeVersion=1.19.2
35+
==source <path containing the Microsoft.ML.OnnxRuntime.<version>.nupkg>
36+
==source https://api.nuget.org/v3/index.json
37+
38+
The <version> of the nupkg must match the value provided in CurrentOnnxRuntimeVersion.
39+
40+
The "==source" args are not required if a released Microsoft.ML.OnnxRuntime package is being used.
41+
If using a previous release you must ensure it is compatible with the entries in NativeMethods.shared.cs.
42+
If new bindings have been added recently you will get error when those are initialized if the native code is out
43+
of date and does not match.
44+
-->
45+
<UsePrebuiltNativePackage Condition="'$(UsePrebuiltNativePackage)' == ''">false</UsePrebuiltNativePackage>
46+
<CurrentOnnxRuntimeVersion Condition="'$(CurrentOnnxRuntimeVersion)' == ''">1.20.0-dev-20241007</CurrentOnnxRuntimeVersion>
47+
</PropertyGroup>
48+
49+
<!-- debug output - makes finding/fixing any issues with the the conditions easy. -->
50+
<Target Name="DumpValues" BeforeTargets="PreBuildEvent">
51+
<Message Text="NativeLibraryInclude: TargetPlatform='$(TargetPlatform)' TargetPlatformIdentifier='$(TargetPlatformIdentifier)' " />
52+
<Message Text="TargetFramework='$(TargetFramework)' TargetFrameworkIdentifier='$(TargetFrameworkIdentifier)' " />
53+
<Message Text="[MSBuild]::GetTargetPlatformIdentifier(TargetFramework)='$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)'))' " />
54+
<Message Text="[MSBuild]::GetTargetFrameworkIdentifier(TargetFramework)='$([MSBuild]::GetTargetFrameworkIdentifier('$(TargetFramework)'))' " />
55+
<Message Text="IsWindowsBuild='$(IsWindowsBuild)' IsLinuxBuild='$(IsLinuxBuild)' IsMacOSBuild='$(IsMacOSBuild)'" />
56+
<Message Text="IsWindowsTarget='$(IsWindowsTarget)' IsAndroidTarget='$(IsAndroidTarget)' IsIOSTarget='$(IsIOSTarget)' IsMacCatalystTarget='$(IsMacCatalystTarget)'" />
57+
</Target>
58+
59+
<ItemGroup Condition="'$(UsePrebuiltNativePackage)' == 'true'">
60+
<!-- Use the prebuilt package -->
61+
<PackageReference Include="Microsoft.ML.OnnxRuntime" Version="$(CurrentOnnxRuntimeVersion)" />
62+
</ItemGroup>
63+
64+
<!-- 'Choose' so we don't need the UsePrebuiltNativePackage condition on all the PropertyGroup/ItemGroup elements -->
65+
<Choose>
66+
<When Condition="'$(UsePrebuiltNativePackage)' != 'true'">
67+
<PropertyGroup Condition="'$(IsWindowsBuild)'=='true' OR '$(IsWindowsTarget)'=='true'">
68+
<OnnxRuntimeBuildDirectory Condition="'$(OnnxRuntimeBuildDirectory)'==''">$(OnnxRuntimeRoot)\build\Windows</OnnxRuntimeBuildDirectory>
69+
<NativeBuildOutputDir>$(OnnxRuntimeBuildDirectory)\$(Configuration)\$(Configuration)</NativeBuildOutputDir>
70+
</PropertyGroup>
71+
72+
<PropertyGroup Condition="'$(IsLinuxBuild)'=='true'">
73+
<OnnxRuntimeBuildDirectory Condition="'$(OnnxRuntimeBuildDirectory)'==''">$(OnnxRuntimeRoot)\build\Linux</OnnxRuntimeBuildDirectory>
74+
<NativeBuildOutputDir>$(OnnxRuntimeBuildDirectory)\$(Configuration)</NativeBuildOutputDir>
75+
</PropertyGroup>
76+
77+
<PropertyGroup Condition="'$(IsMacOSBuild)'=='true'">
78+
<OnnxRuntimeBuildDirectory Condition="'$(OnnxRuntimeBuildDirectory)'==''">$(OnnxRuntimeRoot)\build\MacOS</OnnxRuntimeBuildDirectory>
79+
<NativeBuildOutputDir>$(OnnxRuntimeBuildDirectory)\$(Configuration)</NativeBuildOutputDir>
80+
</PropertyGroup>
81+
82+
<PropertyGroup Condition="'$(IsAndroidTarget)' == 'true'">
83+
<OnnxRuntimeBuildDirectory Condition="'$(OnnxRuntimeBuildDirectory)'==''">$(OnnxRuntimeRoot)\build\Android</OnnxRuntimeBuildDirectory>
84+
<NativeBuildOutputDir>$(OnnxRuntimeBuildDirectory)\$(Configuration)</NativeBuildOutputDir>
85+
</PropertyGroup>
86+
87+
<PropertyGroup Condition="'$(IsIOSTarget)' == 'true'">
88+
<OnnxRuntimeBuildDirectory Condition="'$(OnnxRuntimeBuildDirectory)'==''">$(OnnxRuntimeRoot)\build\iOS</OnnxRuntimeBuildDirectory>
89+
<Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
90+
<PlatformLower>$(Platform.ToLower())</PlatformLower>
91+
<NativeBuildOutputDir>$(OnnxRuntimeBuildDirectory)\$(Configuration)\$(Configuration)-$(PlatformLower)</NativeBuildOutputDir>
92+
</PropertyGroup>
93+
94+
<PropertyGroup Condition="'$(IsMacCatalystTarget)' == 'true'">
95+
<OnnxRuntimeBuildDirectory Condition="'$(OnnxRuntimeBuildDirectory)'==''">$(OnnxRuntimeRoot)\build\macOS</OnnxRuntimeBuildDirectory>
96+
<NativeBuildOutputDir>$(OnnxRuntimeBuildDirectory)\$(Configuration)</NativeBuildOutputDir>
97+
</PropertyGroup>
98+
99+
<ItemGroup Condition="'$(IsWindowsBuild)' == 'true' OR '$(IsWindowsTarget)'=='true'">
100+
<None Condition="Exists('$(NativeBuildOutputDir)\onnxruntime.dll')"
101+
Include="$(NativeBuildOutputDir)\*.dll;$(NativeBuildOutputDir)\*.pdb">
102+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
103+
<Visible>true</Visible>
104+
</None>
105+
</ItemGroup>
106+
107+
<ItemGroup Condition="'$(IsLinuxBuild)' == 'true'">
108+
<None Condition="Exists('$(NativeBuildOutputDir)\libonnxruntime.so')"
109+
Include="$(NativeBuildOutputDir)\libonnxruntime.so">
110+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
111+
<Visible>false</Visible>
112+
</None>
113+
</ItemGroup>
114+
115+
<ItemGroup Condition="'$(IsMacOSBuild)' == 'true'">
116+
<None Condition="Exists('$(NativeBuildOutputDir)\libonnxruntime.dylib')"
117+
Include="$(NativeBuildOutputDir)\libonnxruntime.dylib">
118+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
119+
<Visible>false</Visible>
120+
</None>
121+
</ItemGroup>
122+
123+
<ItemGroup Condition="'$(IsAndroidTarget)' == 'true'">
124+
<AndroidNativeLibrary Condition="Exists('$(NativeBuildOutputDir)\libonnxruntime.so')"
125+
Include="$(NativeBuildOutputDir)\libonnxruntime.so">
126+
<Link>libs\libonnxruntime.so</Link>
127+
</AndroidNativeLibrary>
128+
</ItemGroup>
129+
130+
<ItemGroup Condition="'$(IsIOSTarget)' == 'true'">
131+
<NativeReference Condition="Exists('$(NativeBuildOutputDir)\libonnxruntime.dylib')"
132+
Include="$(NativeBuildOutputDir)\libonnxruntime.dylib">
133+
<Link>libs\libonnxruntime.dylib</Link>
134+
<Kind>Dynamic</Kind>
135+
<ForceLoad>True</ForceLoad>
136+
<IsCxx>True</IsCxx>
137+
</NativeReference>
138+
</ItemGroup>
139+
140+
<ItemGroup Condition="'$(IsMacCatalystTarget)' == 'true'">
141+
<NativeReference Condition="Exists('$(NativeBuildOutputDir)\libonnxruntime.dylib')"
142+
Include="$(NativeBuildOutputDir)\libonnxruntime.dylib">
143+
<Link>libs\libonnxruntime.dylib</Link>
144+
<Kind>Dynamic</Kind>
145+
<ForceLoad>True</ForceLoad>
146+
<IsCxx>True</IsCxx>
147+
</NativeReference>
148+
</ItemGroup>
149+
</When>
150+
</Choose>
151+
152+
<!-- Property debug output. -->
153+
<PropertyGroup>
154+
<!-- local builds-->
155+
<HaveOrtDll>false</HaveOrtDll>
156+
<HaveOrtDll Condition="Exists('$(NativeBuildOutputDir)\onnxruntime.dll')">true</HaveOrtDll>
157+
<HaveOrtSo>false</HaveOrtSo>
158+
<HaveOrtSo Condition="Exists('$(NativeBuildOutputDir)\libonnxruntime.so')">true</HaveOrtSo>
159+
<HaveOrtDylib>false</HaveOrtDylib>
160+
<HaveOrtDylib Condition="Exists('$(NativeBuildOutputDir)\libonnxruntime.dylib')">true</HaveOrtDylib>
161+
</PropertyGroup>
162+
163+
<Target Name="DumpLocalBuild" BeforeTargets="PreBuildEvent">
164+
<Message Text="Prebuilt runtime=$(UsePrebuiltNativePackage)" />
165+
<Message Text="NativeBuildOutputDir=$(NativeBuildOutputDir)" />
166+
<Message Text="onnxruntime.dll from local build=$(HaveOrtDll)" />
167+
<Message Text="libonnxruntime.so from local build=$(HaveOrtSo)" />
168+
<Message Text="libonnxruntime.dylib from local build=$(HaveOrtDylib)" />
169+
</Target>
170+
171+
</Project>

0 commit comments

Comments
 (0)