mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-29 20:14:01 +00:00
Create a separate Nuget hosting just managed assemblies (#3020)
* Initial commit * More changes * More changes * More changes 3 * More changes 4 * More changes 5 * More changes 5 * More changes 6 * More changes 7 * More changes 8 * Remove C# ifdefs * More changes 10 * More changes 11 * YAML changes for other release pipelines * Add release notes metadata * Props and Targets change * Add CSHarp proj * More changes 12 * More changes * Minor fix * Minor fix * Fix yaml * Some missing logic for winml * Minor update * Fix casing for winmd file * Fix casing * Add targets and props for managed section into native nuget * revert file * a
This commit is contained in:
parent
5008fc5b00
commit
86b755774f
14 changed files with 476 additions and 210 deletions
|
|
@ -8,10 +8,20 @@ CMake creates a target to this project
|
|||
<Project DefaultTargets="Build">
|
||||
|
||||
<PropertyGroup>
|
||||
<OrtPackageId Condition=" '$(OrtPackageId)' == '' ">Microsoft.ML.OnnxRuntime</OrtPackageId>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
|
||||
<DotNetExe Condition= " '$(DotNetExe)' == '' ">dotnet</DotNetExe>
|
||||
<NugetExe Condition= " '$(NugetExe)' == '' ">nuget</NugetExe>
|
||||
<TargetArchitecture Condition=" '$(TargetArchitecture)' == '' ">x64</TargetArchitecture>
|
||||
<IsReleaseBuild Condition=" '$(IsReleaseBuild)' == '' ">false</IsReleaseBuild>
|
||||
|
||||
<!--internal build related properties-->
|
||||
<OnnxRuntimeSourceDirectory Condition="'$(OnnxRuntimeSourceDirectory)'==''">..</OnnxRuntimeSourceDirectory>
|
||||
<OnnxRuntimeBuildDirectory Condition="'$(OnnxRuntimeBuildDirectory)'==''">..\build\Windows</OnnxRuntimeBuildDirectory>
|
||||
<NativeBuildOutputDir>$(OnnxRuntimeBuildDirectory)\$(Configuration)\$(Configuration)</NativeBuildOutputDir>
|
||||
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
|
||||
|
|
@ -61,12 +71,51 @@ CMake creates a target to this project
|
|||
</Exec>
|
||||
</Target>
|
||||
|
||||
<Target Name="ObtainPackageVersion" BeforeTargets="CreatePackage">
|
||||
<ReadLinesFromFile File="..\VERSION_NUMBER">
|
||||
<Output TaskParameter="Lines" ItemName="MajorVersionNumber"/>
|
||||
</ReadLinesFromFile>
|
||||
<Exec Command="git rev-parse --short HEAD" ConsoleToMSBuild="true">
|
||||
<Output TaskParameter="ConsoleOutput" PropertyName="GitCommitHashShort" />
|
||||
</Exec>
|
||||
<Exec Command="git rev-parse HEAD" ConsoleToMSBuild="true">
|
||||
<Output TaskParameter="ConsoleOutput" PropertyName="GitCommitHash" />
|
||||
</Exec>
|
||||
<ConvertToAbsolutePath Paths="$(OnnxRuntimeBuildDirectory)">
|
||||
<Output TaskParameter="AbsolutePaths" PropertyName="OnnxRuntimeBuildDirectoryAbs"/>
|
||||
</ConvertToAbsolutePath>
|
||||
<ConvertToAbsolutePath Paths="$(NativeBuildOutputDir)">
|
||||
<Output TaskParameter="AbsolutePaths" PropertyName="NativeBuildOutputDirAbs"/>
|
||||
</ConvertToAbsolutePath>
|
||||
<ConvertToAbsolutePath Paths="$(OnnxRuntimeSourceDirectory)">
|
||||
<Output TaskParameter="AbsolutePaths" PropertyName="OnnxRuntimeSourceDirectoryAbs"/>
|
||||
</ConvertToAbsolutePath>
|
||||
<PropertyGroup>
|
||||
<CurrentDate>$([System.DateTime]::UtcNow.ToString(yyyyMMdd))</CurrentDate>
|
||||
<CurrentTime>$([System.DateTime]::UtcNow.ToString(hhmm))</CurrentTime>
|
||||
<PackageVersion>@(MajorVersionNumber)</PackageVersion>
|
||||
<Version>$(PackageVersion)</Version>
|
||||
<PackageVersion Condition="'$(IsReleaseBuild)'!='true'">$(PackageVersion)-dev-$(CurrentDate)-$(CurrentTime)-$(GitCommitHashShort)</PackageVersion>
|
||||
</PropertyGroup>
|
||||
<Message Importance="High" Text="PackageVersion=$(PackageVersion)" />
|
||||
</Target>
|
||||
|
||||
<Target Name="CreatePackage">
|
||||
<Message Importance="High" Text="Bundling NuGet package ..." />
|
||||
<Message Importance="High" Text="Bundling managed assemblies into a NuGet package ..." />
|
||||
<MSBuild Projects="src\Microsoft.ML.OnnxRuntime\Microsoft.ML.OnnxRuntime.csproj"
|
||||
Targets="ObtainPackageVersion;Pack"
|
||||
Properties="NoBuild=true;Platform=AnyCPU"
|
||||
/>
|
||||
Targets="CopyMiscFiles;Pack"
|
||||
Properties="NoBuild=true;Platform=AnyCPU;PackageVersion=$(PackageVersion);OrtPackageId=$(OrtPackageId)"/>
|
||||
|
||||
<Message Importance="High" Text="Generating nuspec for the native Nuget package ..." />
|
||||
<Exec ContinueOnError="False" Command="python ..\tools\nuget\generate_nuspec_for_native_nuget.py --package_version $(PackageVersion) --package_name $(OrtPackageId) --target_architecture $(TargetArchitecture) --build_config $(Configuration) --native_build_path $(NativeBuildOutputDirAbs) --ort_build_path $(OnnxRuntimeBuildDirectoryAbs) --sources_path $(OnnxRuntimeSourceDirectoryAbs) --commit_id $(GitCommitHash) --is_release_build $(IsReleaseBuild)" ConsoleToMSBuild="true">
|
||||
<Output TaskParameter="ConsoleOutput" PropertyName="GenerateNuspecOutput" />
|
||||
</Exec>
|
||||
|
||||
<Message Importance="High" Text="Bundling native shared library artifacts into a NuGet package ..." />
|
||||
<Exec ContinueOnError="False" Command="$(NugetExe) pack NativeNuget.nuspec" ConsoleToMSBuild="true" WorkingDirectory="$(NativeBuildOutputDirAbs)">
|
||||
<Output TaskParameter="ConsoleOutput" PropertyName="OutputOfExec" />
|
||||
</Exec>
|
||||
|
||||
</Target>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.28010.2003
|
||||
|
|
|
|||
|
|
@ -13,12 +13,17 @@
|
|||
<OnnxRuntimeCsharpRoot>..\..</OnnxRuntimeCsharpRoot>
|
||||
<OnnxRuntimeBuildDirectory Condition="'$(OnnxRuntimeBuildDirectory)'==''">$(OnnxRuntimeCsharpRoot)\..\build\Windows</OnnxRuntimeBuildDirectory>
|
||||
<NativeBuildOutputDir>$(OnnxRuntimeBuildDirectory)\$(Configuration)\$(Configuration)</NativeBuildOutputDir>
|
||||
<TargetArchitecture Condition=" '$(TargetArchitecture)' == '' ">x64</TargetArchitecture>
|
||||
<TargetArchitecture Condition=" '$(TargetArchitecture)' == '' ">x64</TargetArchitecture>
|
||||
|
||||
<!--- packaging properties -->
|
||||
<OrtPackageId Condition=" '$(OrtPackageId)' == '' ">Microsoft.ML.OnnxRuntime</OrtPackageId>
|
||||
<PackageId>$(OrtPackageId)</PackageId>
|
||||
|
||||
<!--- The package name is always hardcoded as the package created by this project only contains managed assemblies -->
|
||||
<!--- The parameter OrtPackageId is only used for some conditional logic below -->
|
||||
<PackageId>Microsoft.ML.OnnxRuntime.Managed</PackageId>
|
||||
<Authors>Microsoft</Authors>
|
||||
<PackageVersion Condition=" '$(PackageVersion)' == '' ">0.0</PackageVersion>
|
||||
<Version>$(PackageVersion)</Version>
|
||||
<Description>This package contains ONNX Runtime for .Net platforms</Description>
|
||||
<PackageTags>ONNX;ONNX Runtime;Machine Learning</PackageTags>
|
||||
<PackageProjectUrl>https://github.com/Microsoft/onnxruntime</PackageProjectUrl>
|
||||
|
|
@ -44,46 +49,46 @@
|
|||
<ItemGroup>
|
||||
<None Include="$(OnnxRuntimeCsharpRoot)\..\include\onnxruntime\core\session\onnxruntime_*.h"
|
||||
PackagePath="\build\native\include"
|
||||
Pack="true"
|
||||
Pack="false"
|
||||
CopyToOutputDirectory="Never"
|
||||
Visible="false"
|
||||
/>
|
||||
<None Include="$(OnnxRuntimeCsharpRoot)\..\include\onnxruntime\core\providers\cpu\cpu_provider_factory.h"
|
||||
PackagePath="\build\native\include"
|
||||
Pack="true"
|
||||
Pack="false"
|
||||
CopyToOutputDirectory="Never"
|
||||
Visible="false"
|
||||
/>
|
||||
<None Include="$(OnnxRuntimeCsharpRoot)\..\include\onnxruntime\core\providers\cuda\cuda_provider_factory.h"
|
||||
Condition="'$(OrtPackageId)' != 'Microsoft.ML.OnnxRuntime.DirectML'"
|
||||
PackagePath="\build\native\include"
|
||||
Pack="true"
|
||||
Pack="false"
|
||||
CopyToOutputDirectory="Never"
|
||||
Visible="false"
|
||||
/>
|
||||
<None Include="$(OnnxRuntimeCsharpRoot)\..\include\onnxruntime\core\providers\dml\dml_provider_factory.h"
|
||||
Condition="'$(OrtPackageId)' == 'Microsoft.ML.OnnxRuntime.DirectML'"
|
||||
PackagePath="\build\native\include"
|
||||
Pack="true"
|
||||
Pack="false"
|
||||
CopyToOutputDirectory="Never"
|
||||
Visible="false"
|
||||
/>
|
||||
<None Include="$(NativeBuildOutputDir)\onnxruntime.lib"
|
||||
PackagePath="\runtimes\win-$(TargetArchitecture)\native"
|
||||
Pack="true"
|
||||
Pack="false"
|
||||
CopyToOutputDirectory="Never"
|
||||
Visible="false"
|
||||
/>
|
||||
<None Include="$(NativeBuildOutputDir)\onnxruntime.dll"
|
||||
PackagePath="\runtimes\win-$(TargetArchitecture)\native"
|
||||
Pack="true"
|
||||
Pack="false"
|
||||
CopyToOutputDirectory="Always"
|
||||
Visible="false"
|
||||
/>
|
||||
<None Include="$(NativeBuildOutputDir)\onnxruntime.pdb"
|
||||
Condition="Exists('$(NativeBuildOutputDir)\onnxruntime.pdb')"
|
||||
PackagePath="\runtimes\win-$(TargetArchitecture)\native"
|
||||
Pack="true"
|
||||
Pack="false"
|
||||
CopyToOutputDirectory="Always"
|
||||
Visible="false"
|
||||
/>
|
||||
|
|
@ -92,7 +97,7 @@
|
|||
And ('$(OrtPackageId)' == 'Microsoft.ML.OnnxRuntime.DirectML'
|
||||
Or '$(OrtPackageId)' == 'Microsoft.ML.OnnxRuntime')"
|
||||
PackagePath="\runtimes\win-$(TargetArchitecture)\native"
|
||||
Pack="true"
|
||||
Pack="false"
|
||||
CopyToOutputDirectory="Always"
|
||||
Visible="false"
|
||||
/>
|
||||
|
|
@ -101,7 +106,7 @@
|
|||
And ('$(OrtPackageId)' == 'Microsoft.ML.OnnxRuntime.DirectML'
|
||||
Or '$(OrtPackageId)' == 'Microsoft.ML.OnnxRuntime')"
|
||||
PackagePath="\runtimes\win-$(TargetArchitecture)\native"
|
||||
Pack="true"
|
||||
Pack="false"
|
||||
CopyToOutputDirectory="Never"
|
||||
Visible="false"
|
||||
/>
|
||||
|
|
@ -110,7 +115,7 @@
|
|||
And ('$(OrtPackageId)' == 'Microsoft.ML.OnnxRuntime.DirectML'
|
||||
Or '$(OrtPackageId)' == 'Microsoft.ML.OnnxRuntime')"
|
||||
PackagePath="\runtimes\win-$(TargetArchitecture)\native"
|
||||
Pack="true"
|
||||
Pack="false"
|
||||
CopyToOutputDirectory="Always"
|
||||
Visible="false"
|
||||
/>
|
||||
|
|
@ -119,7 +124,7 @@
|
|||
And ('$(OrtPackageId)' == 'Microsoft.ML.OnnxRuntime.DirectML'
|
||||
Or '$(OrtPackageId)' == 'Microsoft.ML.OnnxRuntime')"
|
||||
PackagePath="\build\native\metadata"
|
||||
Pack="true"
|
||||
Pack="false"
|
||||
CopyToOutputDirectory="Always"
|
||||
Visible="false"
|
||||
/>
|
||||
|
|
@ -128,7 +133,7 @@
|
|||
And ('$(OrtPackageId)' == 'Microsoft.ML.OnnxRuntime.DirectML'
|
||||
Or '$(OrtPackageId)' == 'Microsoft.ML.OnnxRuntime')"
|
||||
PackagePath="\build\native\include"
|
||||
Pack="true"
|
||||
Pack="false"
|
||||
CopyToOutputDirectory="Never"
|
||||
Visible="false"
|
||||
/>
|
||||
|
|
@ -137,7 +142,7 @@
|
|||
And ('$(OrtPackageId)' == 'Microsoft.ML.OnnxRuntime.DirectML'
|
||||
Or '$(OrtPackageId)' == 'Microsoft.ML.OnnxRuntime')"
|
||||
PackagePath="\build\native\include"
|
||||
Pack="true"
|
||||
Pack="false"
|
||||
CopyToOutputDirectory="Never"
|
||||
Visible="false"
|
||||
/>
|
||||
|
|
@ -145,35 +150,35 @@
|
|||
Condition="Exists('$(NativeBuildOutputDir)\DirectML.dll')
|
||||
And '$(OrtPackageId)' == 'Microsoft.ML.OnnxRuntime.DirectML'"
|
||||
PackagePath="\runtimes\win-$(TargetArchitecture)\native"
|
||||
Pack="true"
|
||||
Pack="false"
|
||||
CopyToOutputDirectory="Always"
|
||||
Visible="false"
|
||||
/>
|
||||
<None Include="$(NativeBuildOutputDir)\dnnl.dll"
|
||||
Condition="Exists('$(NativeBuildOutputDir)\dnnl.dll')"
|
||||
PackagePath="\runtimes\win-$(TargetArchitecture)\native"
|
||||
Pack="true"
|
||||
Pack="false"
|
||||
CopyToOutputDirectory="Always"
|
||||
Visible="false"
|
||||
/>
|
||||
<None Include="$(NativeBuildOutputDir)\mklml.dll"
|
||||
Condition="Exists('$(NativeBuildOutputDir)\mklml.dll')"
|
||||
PackagePath="\runtimes\win-$(TargetArchitecture)\native"
|
||||
Pack="true"
|
||||
Pack="false"
|
||||
CopyToOutputDirectory="Always"
|
||||
Visible="false"
|
||||
/>
|
||||
<None Include="$(NativeBuildOutputDir)\libiomp5md.dll"
|
||||
Condition="Exists('$(NativeBuildOutputDir)\libiomp5md.dll')"
|
||||
PackagePath="\runtimes\win-$(TargetArchitecture)\native"
|
||||
Pack="true"
|
||||
Pack="false"
|
||||
CopyToOutputDirectory="Always"
|
||||
Visible="false"
|
||||
/>
|
||||
<None Include="$(NativeBuildOutputDir)\tvm.dll"
|
||||
Condition="Exists('$(NativeBuildOutputDir)\tvm.dll')"
|
||||
PackagePath="\runtimes\win-$(TargetArchitecture)\native"
|
||||
Pack="true"
|
||||
Pack="false"
|
||||
CopyToOutputDirectory="Always"
|
||||
Visible="false"
|
||||
/>
|
||||
|
|
@ -188,27 +193,23 @@
|
|||
Visible="false"
|
||||
/>
|
||||
<None Include="$(PackageId).targets"
|
||||
PackagePath="\build\$(TargetFramework);\build\native"
|
||||
Pack="true"
|
||||
Visible="false"
|
||||
/>
|
||||
<None Include="$(PackageId).props"
|
||||
PackagePath="\build\$(TargetFramework);\build\native"
|
||||
PackagePath="\build\$(TargetFramework)"
|
||||
Pack="true"
|
||||
Visible="false"
|
||||
/>
|
||||
|
||||
<!-- Some tools to be packaged in nightly build only, should not be released -->
|
||||
<!-- These are copied to the runtimes folder for convenience of loading with the dlls -->
|
||||
<None Include="$(NativeBuildOutputDir)\onnxruntime_perf_test.exe"
|
||||
Condition="('$(IsReleaseBuild)' != 'true') And ($(TargetArchitecture)=='x64') And Exists('$(NativeBuildOutputDir)\onnxruntime_perf_test.exe')"
|
||||
PackagePath="\runtimes\win-$(TargetArchitecture)\native"
|
||||
Pack="true"
|
||||
Pack="false"
|
||||
Visible="false"
|
||||
/>
|
||||
<None Include="$(NativeBuildOutputDir)\onnx_test_runner.exe"
|
||||
Condition="('$(IsReleaseBuild)' != 'true') And ($(TargetArchitecture)=='x64') And Exists('$(NativeBuildOutputDir)\onnx_test_runner.exe')"
|
||||
PackagePath="\runtimes\win-$(TargetArchitecture)\native"
|
||||
Pack="true"
|
||||
Pack="false"
|
||||
Visible="false"
|
||||
/>
|
||||
|
||||
|
|
@ -216,28 +217,11 @@
|
|||
|
||||
<ItemGroup>
|
||||
<LicenseFile Include="$(OnnxRuntimeCsharpRoot)\..\LICENSE"/>
|
||||
<PropertiesFile Include="$(OnnxRuntimeCsharpRoot)\src\Microsoft.ML.OnnxRuntime\props.xml"/>
|
||||
<TargetsFile Include="$(OnnxRuntimeCsharpRoot)\src\Microsoft.ML.OnnxRuntime\targets.xml"/>
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="ObtainPackageVersion" BeforeTargets="Build;Pack">
|
||||
<ReadLinesFromFile File="$(OnnxRuntimeCsharpRoot)\..\VERSION_NUMBER">
|
||||
<Output TaskParameter="Lines" ItemName="MajorVersionNumber"/>
|
||||
</ReadLinesFromFile>
|
||||
<Exec Command="git rev-parse --short HEAD" ConsoleToMSBuild="true">
|
||||
<Output TaskParameter="ConsoleOutput" PropertyName="GitCommitHashShort" />
|
||||
</Exec>
|
||||
|
||||
<PropertyGroup>
|
||||
<CurrentDate>$([System.DateTime]::UtcNow.ToString(yyyyMMdd))</CurrentDate>
|
||||
<CurrentTime>$([System.DateTime]::UtcNow.ToString(hhmm))</CurrentTime>
|
||||
<PackageVersion>@(MajorVersionNumber)</PackageVersion>
|
||||
<Version>$(PackageVersion)</Version>
|
||||
<PackageVersion Condition="'$(IsReleaseBuild)'!='true'">$(PackageVersion)-dev-$(CurrentDate)-$(CurrentTime)-$(GitCommitHashShort)</PackageVersion>
|
||||
</PropertyGroup>
|
||||
<Message Importance="High" Text="PackageVersion=$(PackageVersion)" />
|
||||
<Target Name="CopyMiscFiles" BeforeTargets="Pack">
|
||||
<Copy SourceFiles="@(LicenseFile)" DestinationFiles="@(LicenseFile->'$(OnnxRuntimeCsharpRoot)\..\%(Filename).txt')"/>
|
||||
<Copy SourceFiles="@(PropertiesFile)" DestinationFiles="@(PropertiesFile->'$(OnnxRuntimeCsharpRoot)\src\\Microsoft.ML.OnnxRuntime\$(PackageId).props')"/>
|
||||
<Copy SourceFiles="@(TargetsFile)" DestinationFiles="@(TargetsFile->'$(OnnxRuntimeCsharpRoot)\src\\Microsoft.ML.OnnxRuntime\$(PackageId).targets')"/>
|
||||
|
||||
</Target>
|
||||
|
|
|
|||
|
|
@ -412,41 +412,28 @@ namespace Microsoft.ML.OnnxRuntime
|
|||
[DllImport(nativeLib, CharSet = charSet)]
|
||||
public static extern IntPtr /*(OrtStatus*)*/ OrtSessionOptionsAppendExecutionProvider_CPU(IntPtr /*(OrtSessionOptions*) */ options, int use_arena);
|
||||
|
||||
#if USE_DNNL
|
||||
[DllImport(nativeLib, CharSet = charSet)]
|
||||
public static extern IntPtr /*(OrtStatus*)*/ OrtSessionOptionsAppendExecutionProvider_Dnnl(IntPtr /*(OrtSessionOptions*) */ options, int use_arena);
|
||||
#endif
|
||||
|
||||
#if USE_CUDA
|
||||
[DllImport(nativeLib, CharSet = charSet)]
|
||||
public static extern IntPtr /*(OrtStatus*)*/ OrtSessionOptionsAppendExecutionProvider_CUDA(IntPtr /*(OrtSessionOptions*) */ options, int device_id);
|
||||
#endif
|
||||
|
||||
#if USE_NGRAPH
|
||||
[DllImport(nativeLib, CharSet = charSet)]
|
||||
public static extern IntPtr /*(OrtStatus*)*/ OrtSessionOptionsAppendExecutionProvider_NGraph(IntPtr /*(OrtSessionOptions*) */ options, string /*(const char*)*/ ng_backend_type);
|
||||
#endif
|
||||
|
||||
#if USE_OPENVINO
|
||||
[DllImport(nativeLib, CharSet = charSet)]
|
||||
public static extern IntPtr /*(OrtStatus*)*/ OrtSessionOptionsAppendExecutionProvider_OpenVINO(
|
||||
IntPtr /*(OrtSessionOptions*)*/ options, string /*(const char*)*/ device_id);
|
||||
#endif
|
||||
|
||||
#if USE_TENSORRT
|
||||
[DllImport(nativeLib, CharSet = charSet)]
|
||||
public static extern IntPtr /*(OrtStatus*)*/ OrtSessionOptionsAppendExecutionProvider_Tensorrt(IntPtr /*(OrtSessionOptions*)*/ options, int device_id);
|
||||
#endif
|
||||
|
||||
#if USE_NNAPI
|
||||
[DllImport(nativeLib, CharSet = charSet)]
|
||||
public static extern IntPtr /*(OrtStatus*)*/ OrtSessionOptionsAppendExecutionProvider_Nnapi(IntPtr /*(OrtSessionOptions*)*/ options);
|
||||
#endif
|
||||
|
||||
#if USE_NUPHAR
|
||||
[DllImport(nativeLib, CharSet = charSet)]
|
||||
public static extern IntPtr /*(OrtStatus*)*/ OrtSessionOptionsAppendExecutionProvider_Nuphar(IntPtr /*(OrtSessionOptions*) */ options, int allow_unaligned_buffers, string settings);
|
||||
#endif
|
||||
|
||||
//[DllImport(nativeLib, CharSet = charSet)]
|
||||
//public static extern void OrtAddCustomOp(IntPtr /*(OrtSessionOptions*)*/ options, string custom_op_path);
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,6 @@ namespace Microsoft.ML.OnnxRuntime
|
|||
NativeApiStatus.VerifySuccess(NativeMethods.OrtCreateSessionOptions(out _nativePtr));
|
||||
}
|
||||
|
||||
#if USE_CUDA
|
||||
/// <summary>
|
||||
/// A helper method to construct a SessionOptions object for CUDA execution
|
||||
/// </summary>
|
||||
|
|
@ -72,7 +71,7 @@ namespace Microsoft.ML.OnnxRuntime
|
|||
NativeMethods.OrtSessionOptionsAppendExecutionProvider_CPU(options._nativePtr, 1);
|
||||
return options;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endregion
|
||||
|
||||
#region ExecutionProviderAppends
|
||||
|
|
@ -81,49 +80,36 @@ namespace Microsoft.ML.OnnxRuntime
|
|||
NativeApiStatus.VerifySuccess(NativeMethods.OrtSessionOptionsAppendExecutionProvider_CPU(_nativePtr, useArena));
|
||||
}
|
||||
|
||||
#if USE_DNNL
|
||||
public void AppendExecutionProvider_Dnnl(int useArena)
|
||||
{
|
||||
NativeApiStatus.VerifySuccess(NativeMethods.OrtSessionOptionsAppendExecutionProvider_Dnnl(_nativePtr, useArena));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if USE_CUDA
|
||||
public void AppendExecutionProvider_CUDA(int deviceId)
|
||||
{
|
||||
NativeApiStatus.VerifySuccess(NativeMethods.OrtSessionOptionsAppendExecutionProvider_CUDA(_nativePtr, deviceId));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if USE_NGRAPH
|
||||
public void AppendExecutionProvider_NGraph(string nGraphBackendType)
|
||||
{
|
||||
NativeApiStatus.VerifySuccess(NativeMethods.OrtSessionOptionsAppendExecutionProvider_NGraph(_nativePtr, nGraphBackendType));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if USE_OPENVINO
|
||||
public void AppendExecutionProvider_OpenVINO(string deviceId)
|
||||
{
|
||||
NativeApiStatus.VerifySuccess(NativeMethods.OrtSessionOptionsAppendExecutionProvider_OpenVINO(_nativePtr, deviceId));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if USE_TENSORRT
|
||||
public void AppendExecutionProvider_Tensorrt(int deviceId)
|
||||
{
|
||||
NativeApiStatus.VerifySuccess(NativeMethods.OrtSessionOptionsAppendExecutionProvider_Tensorrt(_nativePtr, deviceId));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if USE_NNAPI
|
||||
public void AppendExecutionProvider_Nnapi()
|
||||
{
|
||||
NativeApiStatus.VerifySuccess(NativeMethods.OrtSessionOptionsAppendExecutionProvider_Nnapi(_nativePtr));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if USE_NUPHAR
|
||||
/// <summary>
|
||||
/// A helper method to construct a SessionOptions object for Nuphar execution
|
||||
/// </summary>
|
||||
|
|
@ -139,7 +125,6 @@ namespace Microsoft.ML.OnnxRuntime
|
|||
{
|
||||
NativeApiStatus.VerifySuccess(NativeMethods.OrtSessionOptionsAppendExecutionProvider_Nuphar(_nativePtr, 1, settings));
|
||||
}
|
||||
#endif
|
||||
#endregion //ExecutionProviderAppends
|
||||
|
||||
#region Public Methods
|
||||
|
|
|
|||
|
|
@ -6,35 +6,39 @@ steps:
|
|||
powershell -Command "Invoke-WebRequest http://stahlworks.com/dev/unzip.exe -OutFile unzip.exe"
|
||||
powershell -Command "Invoke-WebRequest http://stahlworks.com/dev/zip.exe -OutFile zip.exe"
|
||||
set PATH=%CD%;%PATH%
|
||||
FOR /R %%i IN (*.nupkg) do (
|
||||
rename %%~ni.nupkg %%~ni.zip
|
||||
unzip %%~ni.zip -d %%~ni
|
||||
del /Q %%~ni.zip
|
||||
unzip win-x86.zip -d win-x86
|
||||
unzip linux-x64.zip -d linux-x64
|
||||
mkdir %%~ni\runtimes\win-x86
|
||||
mkdir %%~ni\runtimes\linux-x64
|
||||
mkdir %%~ni\runtimes\win-x86\native
|
||||
mkdir %%~ni\runtimes\linux-x64\native
|
||||
move win-x86\runtimes\win-x86\native\onnxruntime.dll %%~ni\runtimes\win-x86\native\onnxruntime.dll
|
||||
move win-x86\runtimes\win-x86\native\onnxruntime.lib %%~ni\runtimes\win-x86\native\onnxruntime.lib
|
||||
move win-x86\runtimes\win-x86\native\onnxruntime.pdb %%~ni\runtimes\win-x86\native\onnxruntime.pdb
|
||||
move win-x86\runtimes\win-x86\native\windows.ai.machinelearning.dll %%~ni\runtimes\win-x86\native\windows.ai.machinelearning.dll
|
||||
move win-x86\runtimes\win-x86\native\windows.ai.machinelearning.lib %%~ni\runtimes\win-x86\native\windows.ai.machinelearning.lib
|
||||
move win-x86\runtimes\win-x86\native\windows.ai.machinelearning.pdb %%~ni\runtimes\win-x86\native\windows.ai.machinelearning.pdb
|
||||
move linux-x64\linux-x64\libonnxruntime.so %%~ni\runtimes\linux-x64\native\libonnxruntime.so
|
||||
unzip osx-x64.zip -d osx-x64
|
||||
dir osx-x64 /s
|
||||
mkdir %%~ni\runtimes\osx-x64
|
||||
mkdir %%~ni\runtimes\osx-x64\native
|
||||
move osx-x64\osx-x64\libonnxruntime.dylib %%~ni\runtimes\osx-x64\native\libonnxruntime.dylib
|
||||
move osx-x64\osx-x64\libonnxruntime.dylib.dSYM %%~ni\runtimes\osx-x64\native\libonnxruntime.dylib.dSYM
|
||||
pushd %%~ni
|
||||
zip -r ..\%%~ni.zip .
|
||||
popd
|
||||
move %%~ni.zip %%~ni.nupkg
|
||||
)
|
||||
SETLOCAL EnableDelayedExpansion
|
||||
FOR /R %%i IN (*.nupkg) do (
|
||||
set filename=%%~ni
|
||||
IF NOT "!filename:~25,7!"=="Managed" (
|
||||
rename %%~ni.nupkg %%~ni.zip
|
||||
unzip %%~ni.zip -d %%~ni
|
||||
del /Q %%~ni.zip
|
||||
unzip win-x86.zip -d win-x86
|
||||
unzip linux-x64.zip -d linux-x64
|
||||
mkdir %%~ni\runtimes\win-x86
|
||||
mkdir %%~ni\runtimes\linux-x64
|
||||
mkdir %%~ni\runtimes\win-x86\native
|
||||
mkdir %%~ni\runtimes\linux-x64\native
|
||||
move win-x86\runtimes\win-x86\native\onnxruntime.dll %%~ni\runtimes\win-x86\native\onnxruntime.dll
|
||||
move win-x86\runtimes\win-x86\native\onnxruntime.lib %%~ni\runtimes\win-x86\native\onnxruntime.lib
|
||||
move win-x86\runtimes\win-x86\native\onnxruntime.pdb %%~ni\runtimes\win-x86\native\onnxruntime.pdb
|
||||
move win-x86\runtimes\win-x86\native\windows.ai.machinelearning.dll %%~ni\runtimes\win-x86\native\Windows.AI.MachineLearning.dll
|
||||
move win-x86\runtimes\win-x86\native\windows.ai.machinelearning.lib %%~ni\runtimes\win-x86\native\Windows.AI.MachineLearning.lib
|
||||
move win-x86\runtimes\win-x86\native\windows.ai.machinelearning.pdb %%~ni\runtimes\win-x86\native\Windows.AI.MachineLearning.pdb
|
||||
move linux-x64\linux-x64\libonnxruntime.so %%~ni\runtimes\linux-x64\native\libonnxruntime.so
|
||||
unzip osx-x64.zip -d osx-x64
|
||||
dir osx-x64 /s
|
||||
mkdir %%~ni\runtimes\osx-x64
|
||||
mkdir %%~ni\runtimes\osx-x64\native
|
||||
move osx-x64\osx-x64\libonnxruntime.dylib %%~ni\runtimes\osx-x64\native\libonnxruntime.dylib
|
||||
move osx-x64\osx-x64\libonnxruntime.dylib.dSYM %%~ni\runtimes\osx-x64\native\libonnxruntime.dylib.dSYM
|
||||
pushd %%~ni
|
||||
zip -r ..\%%~ni.zip .
|
||||
popd
|
||||
move %%~ni.zip %%~ni.nupkg
|
||||
)
|
||||
)
|
||||
popd
|
||||
copy $(Build.BinariesDirectory)\nuget-artifact\*.nupkg $(Build.ArtifactStagingDirectory)
|
||||
displayName: 'Bundle NuGet and other binaries'
|
||||
displayName: 'Bundle Native NuGet and other binaries'
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ jobs:
|
|||
NuPackScript: |
|
||||
msbuild $(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.proj /p:Configuration=RelWithDebInfo /t:CreatePackage /p:OrtPackageId=Microsoft.ML.OnnxRuntime.MKLML
|
||||
copy $(Build.SourcesDirectory)\csharp\src\Microsoft.ML.OnnxRuntime\bin\RelWithDebInfo\*.nupkg $(Build.ArtifactStagingDirectory)
|
||||
copy $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\*.nupkg $(Build.ArtifactStagingDirectory)
|
||||
mkdir $(Build.ArtifactStagingDirectory)\testdata
|
||||
copy $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\custom_op_library.* $(Build.ArtifactStagingDirectory)\testdata
|
||||
|
||||
|
|
@ -127,32 +128,36 @@ jobs:
|
|||
powershell -Command "Invoke-WebRequest http://stahlworks.com/dev/unzip.exe -OutFile unzip.exe"
|
||||
powershell -Command "Invoke-WebRequest http://stahlworks.com/dev/zip.exe -OutFile zip.exe"
|
||||
set PATH=%CD%;%PATH%
|
||||
FOR /R %%i IN (*.nupkg) do (
|
||||
rename %%~ni.nupkg %%~ni.zip
|
||||
unzip %%~ni.zip -d %%~ni
|
||||
del /Q %%~ni.zip
|
||||
unzip linux-x64.zip -d linux-x64
|
||||
mkdir %%~ni\runtimes\linux-x64
|
||||
mkdir %%~ni\runtimes\linux-x64\native
|
||||
move linux-x64\linux-x64\libonnxruntime.so %%~ni\runtimes\linux-x64\native\libonnxruntime.so
|
||||
move linux-x64\linux-x64\libiomp5.so %%~ni\runtimes\linux-x64\native\libiomp5.so
|
||||
move linux-x64\linux-x64\libmklml_intel.so %%~ni\runtimes\linux-x64\native\libmklml_intel.so
|
||||
unzip osx-x64.zip -d osx-x64
|
||||
dir osx-x64 /s
|
||||
mkdir %%~ni\runtimes\osx-x64
|
||||
mkdir %%~ni\runtimes\osx-x64\native
|
||||
move osx-x64\osx-x64\libonnxruntime.dylib %%~ni\runtimes\osx-x64\native\libonnxruntime.dylib
|
||||
move osx-x64\osx-x64\libonnxruntime.dylib.dSYM %%~ni\runtimes\osx-x64\native\libonnxruntime.dylib.dSYM
|
||||
move osx-x64\osx-x64\libmklml.dylib %%~ni\runtimes\osx-x64\native\libmklml.dylib
|
||||
move osx-x64\osx-x64\libiomp5.dylib %%~ni\runtimes\osx-x64\native\libiomp5.dylib
|
||||
pushd %%~ni
|
||||
zip -r ..\%%~ni.zip .
|
||||
popd
|
||||
move %%~ni.zip %%~ni.nupkg
|
||||
SETLOCAL EnableDelayedExpansion
|
||||
FOR /R %%i IN (*.nupkg) do (
|
||||
set filename=%%~ni
|
||||
IF NOT "!filename:~25,7!"=="Managed" (
|
||||
rename %%~ni.nupkg %%~ni.zip
|
||||
unzip %%~ni.zip -d %%~ni
|
||||
del /Q %%~ni.zip
|
||||
unzip linux-x64.zip -d linux-x64
|
||||
mkdir %%~ni\runtimes\linux-x64
|
||||
mkdir %%~ni\runtimes\linux-x64\native
|
||||
move linux-x64\linux-x64\libonnxruntime.so %%~ni\runtimes\linux-x64\native\libonnxruntime.so
|
||||
move linux-x64\linux-x64\libiomp5.so %%~ni\runtimes\linux-x64\native\libiomp5.so
|
||||
move linux-x64\linux-x64\libmklml_intel.so %%~ni\runtimes\linux-x64\native\libmklml_intel.so
|
||||
unzip osx-x64.zip -d osx-x64
|
||||
dir osx-x64 /s
|
||||
mkdir %%~ni\runtimes\osx-x64
|
||||
mkdir %%~ni\runtimes\osx-x64\native
|
||||
move osx-x64\osx-x64\libonnxruntime.dylib %%~ni\runtimes\osx-x64\native\libonnxruntime.dylib
|
||||
move osx-x64\osx-x64\libonnxruntime.dylib.dSYM %%~ni\runtimes\osx-x64\native\libonnxruntime.dylib.dSYM
|
||||
move osx-x64\osx-x64\libmklml.dylib %%~ni\runtimes\osx-x64\native\libmklml.dylib
|
||||
move osx-x64\osx-x64\libiomp5.dylib %%~ni\runtimes\osx-x64\native\libiomp5.dylib
|
||||
pushd %%~ni
|
||||
zip -r ..\%%~ni.zip .
|
||||
popd
|
||||
move %%~ni.zip %%~ni.nupkg
|
||||
)
|
||||
)
|
||||
popd
|
||||
copy $(Build.BinariesDirectory)\nuget-artifact\*.nupkg $(Build.ArtifactStagingDirectory)
|
||||
displayName: 'Bundle NuGet and other binaries'
|
||||
displayName: 'Bundle Native NuGet and other binaries'
|
||||
|
||||
- template: ../../templates/esrp_nuget.yml
|
||||
parameters:
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ jobs:
|
|||
NuPackScript: |
|
||||
msbuild $(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.proj /p:Configuration=RelWithDebInfo /t:CreatePackage
|
||||
copy $(Build.SourcesDirectory)\csharp\src\Microsoft.ML.OnnxRuntime\bin\RelWithDebInfo\*.nupkg $(Build.ArtifactStagingDirectory)
|
||||
copy $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\*.nupkg $(Build.ArtifactStagingDirectory)
|
||||
mkdir $(Build.ArtifactStagingDirectory)\testdata
|
||||
copy $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\custom_op_library.* $(Build.ArtifactStagingDirectory)\testdata
|
||||
|
||||
|
|
@ -36,9 +37,9 @@ jobs:
|
|||
DoEsrp: ${{ parameters.DoEsrp }}
|
||||
NuPackScript: |
|
||||
msbuild $(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.proj /p:Configuration=RelWithDebInfo /p:TargetArchitecture=x86 /t:CreatePackage
|
||||
cd $(Build.SourcesDirectory)\csharp\src\Microsoft.ML.OnnxRuntime\bin\RelWithDebInfo\
|
||||
cd $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\
|
||||
ren *.nupkg win-x86.zip
|
||||
copy $(Build.SourcesDirectory)\csharp\src\Microsoft.ML.OnnxRuntime\bin\RelWithDebInfo\*zip $(Build.ArtifactStagingDirectory)
|
||||
copy $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\*zip $(Build.ArtifactStagingDirectory)
|
||||
mkdir $(Build.ArtifactStagingDirectory)\testdata
|
||||
copy $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\custom_op_library.* $(Build.ArtifactStagingDirectory)\testdata
|
||||
|
||||
|
|
@ -175,40 +176,44 @@ jobs:
|
|||
powershell -Command "Invoke-WebRequest http://stahlworks.com/dev/unzip.exe -OutFile unzip.exe"
|
||||
powershell -Command "Invoke-WebRequest http://stahlworks.com/dev/zip.exe -OutFile zip.exe"
|
||||
set PATH=%CD%;%PATH%
|
||||
SETLOCAL EnableDelayedExpansion
|
||||
FOR /R %%i IN (*.nupkg) do (
|
||||
rename %%~ni.nupkg %%~ni.zip
|
||||
unzip %%~ni.zip -d %%~ni
|
||||
del /Q %%~ni.zip
|
||||
unzip win-x86.zip -d win-x86
|
||||
unzip win10-arm.zip -d win10-arm
|
||||
unzip linux-x64.zip -d linux-x64
|
||||
mkdir %%~ni\runtimes\win-x86
|
||||
mkdir %%~ni\runtimes\win10-arm
|
||||
mkdir %%~ni\runtimes\linux-x64
|
||||
mkdir %%~ni\runtimes\win-x86\native
|
||||
mkdir %%~ni\runtimes\win10-arm\native
|
||||
mkdir %%~ni\runtimes\linux-x64\native
|
||||
move win-x86\runtimes\win-x86\native\onnxruntime.dll %%~ni\runtimes\win-x86\native\onnxruntime.dll
|
||||
move win-x86\runtimes\win-x86\native\onnxruntime.lib %%~ni\runtimes\win-x86\native\onnxruntime.lib
|
||||
move win-x86\runtimes\win-x86\native\onnxruntime.pdb %%~ni\runtimes\win-x86\native\onnxruntime.pdb
|
||||
move win10-arm\runtimes\win10-arm\native\onnxruntime.lib %%~ni\runtimes\win10-arm\native\onnxruntime.lib
|
||||
move win10-arm\runtimes\win10-arm\native\onnxruntime.dll %%~ni\runtimes\win10-arm\native\onnxruntime.dll
|
||||
move win10-arm\runtimes\win10-arm\native\onnxruntime.pdb %%~ni\runtimes\win10-arm\native\onnxruntime.pdb
|
||||
move linux-x64\linux-x64\libonnxruntime.so %%~ni\runtimes\linux-x64\native\libonnxruntime.so
|
||||
unzip osx-x64.zip -d osx-x64
|
||||
dir osx-x64 /s
|
||||
mkdir %%~ni\runtimes\osx-x64
|
||||
mkdir %%~ni\runtimes\osx-x64\native
|
||||
move osx-x64\osx-x64\libonnxruntime.dylib %%~ni\runtimes\osx-x64\native\libonnxruntime.dylib
|
||||
move osx-x64\osx-x64\libonnxruntime.dylib.dSYM %%~ni\runtimes\osx-x64\native\libonnxruntime.dylib.dSYM
|
||||
pushd %%~ni
|
||||
zip -r ..\%%~ni.zip .
|
||||
popd
|
||||
move %%~ni.zip %%~ni.nupkg
|
||||
set filename=%%~ni
|
||||
IF NOT "!filename:~25,7!"=="Managed" (
|
||||
rename %%~ni.nupkg %%~ni.zip
|
||||
unzip %%~ni.zip -d %%~ni
|
||||
del /Q %%~ni.zip
|
||||
unzip win-x86.zip -d win-x86
|
||||
unzip win10-arm.zip -d win10-arm
|
||||
unzip linux-x64.zip -d linux-x64
|
||||
mkdir %%~ni\runtimes\win-x86
|
||||
mkdir %%~ni\runtimes\win10-arm
|
||||
mkdir %%~ni\runtimes\linux-x64
|
||||
mkdir %%~ni\runtimes\win-x86\native
|
||||
mkdir %%~ni\runtimes\win10-arm\native
|
||||
mkdir %%~ni\runtimes\linux-x64\native
|
||||
move win-x86\runtimes\win-x86\native\onnxruntime.dll %%~ni\runtimes\win-x86\native\onnxruntime.dll
|
||||
move win-x86\runtimes\win-x86\native\onnxruntime.lib %%~ni\runtimes\win-x86\native\onnxruntime.lib
|
||||
move win-x86\runtimes\win-x86\native\onnxruntime.pdb %%~ni\runtimes\win-x86\native\onnxruntime.pdb
|
||||
move win10-arm\runtimes\win10-arm\native\onnxruntime.lib %%~ni\runtimes\win10-arm\native\onnxruntime.lib
|
||||
move win10-arm\runtimes\win10-arm\native\onnxruntime.dll %%~ni\runtimes\win10-arm\native\onnxruntime.dll
|
||||
move win10-arm\runtimes\win10-arm\native\onnxruntime.pdb %%~ni\runtimes\win10-arm\native\onnxruntime.pdb
|
||||
move linux-x64\linux-x64\libonnxruntime.so %%~ni\runtimes\linux-x64\native\libonnxruntime.so
|
||||
unzip osx-x64.zip -d osx-x64
|
||||
dir osx-x64 /s
|
||||
mkdir %%~ni\runtimes\osx-x64
|
||||
mkdir %%~ni\runtimes\osx-x64\native
|
||||
move osx-x64\osx-x64\libonnxruntime.dylib %%~ni\runtimes\osx-x64\native\libonnxruntime.dylib
|
||||
move osx-x64\osx-x64\libonnxruntime.dylib.dSYM %%~ni\runtimes\osx-x64\native\libonnxruntime.dylib.dSYM
|
||||
pushd %%~ni
|
||||
zip -r ..\%%~ni.zip .
|
||||
popd
|
||||
move %%~ni.zip %%~ni.nupkg
|
||||
)
|
||||
)
|
||||
popd
|
||||
copy $(Build.BinariesDirectory)\nuget-artifact\*.nupkg $(Build.ArtifactStagingDirectory)
|
||||
displayName: 'Bundle NuGet and other binaries'
|
||||
displayName: 'Bundle Native NuGet and other binaries'
|
||||
|
||||
- template: ../../templates/esrp_nuget.yml
|
||||
parameters:
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ jobs:
|
|||
NuPackScript: |
|
||||
msbuild $(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.proj /p:Configuration=RelWithDebInfo /t:CreatePackage
|
||||
copy $(Build.SourcesDirectory)\csharp\src\Microsoft.ML.OnnxRuntime\bin\RelWithDebInfo\*.nupkg $(Build.ArtifactStagingDirectory)
|
||||
copy $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\*.nupkg $(Build.ArtifactStagingDirectory)
|
||||
mkdir $(Build.ArtifactStagingDirectory)\testdata
|
||||
copy $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\custom_op_library.* $(Build.ArtifactStagingDirectory)\testdata
|
||||
|
||||
|
|
@ -38,9 +39,9 @@ jobs:
|
|||
DoEsrp: ${{ parameters.DoEsrp }}
|
||||
NuPackScript: |
|
||||
msbuild $(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.proj /p:Configuration=RelWithDebInfo /p:TargetArchitecture=x86 /t:CreatePackage
|
||||
cd $(Build.SourcesDirectory)\csharp\src\Microsoft.ML.OnnxRuntime\bin\RelWithDebInfo\
|
||||
cd $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\
|
||||
ren *.nupkg win-x86.zip
|
||||
copy $(Build.SourcesDirectory)\csharp\src\Microsoft.ML.OnnxRuntime\bin\RelWithDebInfo\*zip $(Build.ArtifactStagingDirectory)
|
||||
copy $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\*zip $(Build.ArtifactStagingDirectory)
|
||||
mkdir $(Build.ArtifactStagingDirectory)\testdata
|
||||
copy $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\custom_op_library.* $(Build.ArtifactStagingDirectory)\testdata
|
||||
|
||||
|
|
@ -59,9 +60,9 @@ jobs:
|
|||
DoEsrp: ${{ parameters.DoEsrp }}
|
||||
NuPackScript: |
|
||||
msbuild $(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.proj /p:Configuration=RelWithDebInfo /p:TargetArchitecture=arm64 /p:ProtocDirectory=$(Build.BinariesDirectory)\host_protoc\Release /t:CreatePackage
|
||||
cd $(Build.SourcesDirectory)\csharp\src\Microsoft.ML.OnnxRuntime\bin\RelWithDebInfo\
|
||||
cd $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\
|
||||
ren *.nupkg win-arm64.zip
|
||||
copy $(Build.SourcesDirectory)\csharp\src\Microsoft.ML.OnnxRuntime\bin\RelWithDebInfo\*zip $(Build.ArtifactStagingDirectory)
|
||||
copy $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\*zip $(Build.ArtifactStagingDirectory)
|
||||
mkdir $(Build.ArtifactStagingDirectory)\testdata
|
||||
copy $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\custom_op_library.* $(Build.ArtifactStagingDirectory)\testdata
|
||||
|
||||
|
|
@ -80,9 +81,9 @@ jobs:
|
|||
DoEsrp: ${{ parameters.DoEsrp }}
|
||||
NuPackScript: |
|
||||
msbuild $(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.proj /p:Configuration=RelWithDebInfo /p:TargetArchitecture=arm /p:ProtocDirectory=$(Build.BinariesDirectory)\host_protoc\Release /t:CreatePackage
|
||||
cd $(Build.SourcesDirectory)\csharp\src\Microsoft.ML.OnnxRuntime\bin\RelWithDebInfo\
|
||||
cd $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\
|
||||
ren *.nupkg win-arm.zip
|
||||
copy $(Build.SourcesDirectory)\csharp\src\Microsoft.ML.OnnxRuntime\bin\RelWithDebInfo\*zip $(Build.ArtifactStagingDirectory)
|
||||
copy $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\*zip $(Build.ArtifactStagingDirectory)
|
||||
mkdir $(Build.ArtifactStagingDirectory)\testdata
|
||||
copy $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\custom_op_library.* $(Build.ArtifactStagingDirectory)\testdata
|
||||
|
||||
|
|
@ -249,7 +250,7 @@ jobs:
|
|||
Write-Host "##vso[task.setvariable variable=CurrentDate]$date"
|
||||
|
||||
- task: AzureFileCopy@3
|
||||
displayName: 'Copy Signed NuGet Package to Blob Store'
|
||||
displayName: 'Copy Signed Native NuGet Package to Blob Store'
|
||||
condition: ne(variables['IsReleaseBuild'], 'true') # release build has a different package naming scheme
|
||||
inputs:
|
||||
sourcePath: '$(Build.BinariesDirectory)/nuget-artifact/final-package/Microsoft.ML.OnnxRuntime.$(NuGetPackageVersionNumber).nupkg'
|
||||
|
|
@ -260,10 +261,30 @@ jobs:
|
|||
blobPrefix: '$(CurrentDate)/'
|
||||
continueOnError: true
|
||||
|
||||
- task: AzureFileCopy@3
|
||||
displayName: 'Copy Signed Managed NuGet Package to Blob Store'
|
||||
condition: ne(variables['IsReleaseBuild'], 'true') # release build has a different package naming scheme
|
||||
inputs:
|
||||
sourcePath: '$(Build.BinariesDirectory)/nuget-artifact/final-package/Microsoft.ML.OnnxRuntime.Managed.$(NuGetPackageVersionNumber).nupkg'
|
||||
azureSubscription: 'AIInfraBuildOnnxRuntimeOSS'
|
||||
destination: azureBlob
|
||||
storage: ortpackages
|
||||
containerName: ortpackages
|
||||
blobPrefix: '$(CurrentDate)/'
|
||||
continueOnError: true
|
||||
|
||||
- task: DotNetCoreCLI@2
|
||||
displayName: 'Copy Signed NuGet Package to Internal NuGet Feed'
|
||||
displayName: 'Copy Signed Native NuGet Package to Internal NuGet Feed'
|
||||
condition: ne(variables['IsReleaseBuild'], 'true') # release build has a different package naming scheme
|
||||
inputs:
|
||||
command: 'push'
|
||||
searchPatternPush: '$(Build.BinariesDirectory)/nuget-artifact/final-package/Microsoft.ML.OnnxRuntime.$(NuGetPackageVersionNumber).nupkg'
|
||||
feedPublish: 'OnnxRuntime'
|
||||
|
||||
- task: DotNetCoreCLI@2
|
||||
displayName: 'Copy Signed Managed NuGet Package to Internal NuGet Feed'
|
||||
condition: ne(variables['IsReleaseBuild'], 'true') # release build has a different package naming scheme
|
||||
inputs:
|
||||
command: 'push'
|
||||
searchPatternPush: '$(Build.BinariesDirectory)/nuget-artifact/final-package/Microsoft.ML.OnnxRuntime.Managed.$(NuGetPackageVersionNumber).nupkg'
|
||||
feedPublish: 'OnnxRuntime'
|
||||
|
|
@ -9,35 +9,19 @@ steps:
|
|||
workingDirectory: '${{ parameters.packageFolder }}'
|
||||
script: |
|
||||
SETLOCAL EnableDelayedExpansion
|
||||
FOR /R %%i IN (Microsoft.ML.OnnxRuntime*.nupkg) do (
|
||||
FOR /R %%i IN (Microsoft.ML.OnnxRuntime.Managed*.nupkg) do (
|
||||
set filename=%%~ni
|
||||
set ortversion=!filename:~25!
|
||||
IF "!filename:~25,3!"=="Gpu" (
|
||||
set ortversion=!filename:~29!
|
||||
) ELSE (
|
||||
IF "!filename:~25,5!"=="MKLML" (
|
||||
set ortversion=!filename:~31!
|
||||
)
|
||||
)
|
||||
|
||||
set ortversion=!filename:~33!
|
||||
@echo ortversion is !ortversion!
|
||||
@echo ##vso[task.setvariable variable=NuGetPackageVersionNumber;]!ortversion!
|
||||
)
|
||||
|
||||
- task: CmdLine@2
|
||||
condition: not(eq(variables['Agent.OS'], 'Windows_NT'))
|
||||
displayName: 'Extract version number from the NuPkg file, Unix VMs'
|
||||
inputs:
|
||||
workingDirectory: '${{ parameters.packageFolder }}'
|
||||
script: |
|
||||
filenamewithext=$(ls Microsoft.ML.OnnxRuntime*.nupkg)
|
||||
filenamewithext=$(ls Microsoft.ML.OnnxRuntime.Managed*nupkg)
|
||||
filename=${filenamewithext%.*}
|
||||
ortversion=${filename:25}
|
||||
if [ "${filename:25:3}" = "Gpu" ]
|
||||
then
|
||||
ortversion=${filename:29}
|
||||
elif [ "${filename:25:5}" = "MKLML" ]
|
||||
then
|
||||
ortversion=${filename:31}
|
||||
fi
|
||||
ortversion=${filename:33}
|
||||
echo "##vso[task.setvariable variable=NuGetPackageVersionNumber;]$ortversion"
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ jobs:
|
|||
NuPackScript: |
|
||||
msbuild $(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.proj /p:Configuration=RelWithDebInfo /t:CreatePackage /p:OrtPackageId=Microsoft.ML.OnnxRuntime.Gpu
|
||||
copy $(Build.SourcesDirectory)\csharp\src\Microsoft.ML.OnnxRuntime\bin\RelWithDebInfo\*.nupkg $(Build.ArtifactStagingDirectory)
|
||||
copy $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\*.nupkg $(Build.ArtifactStagingDirectory)
|
||||
mkdir $(Build.ArtifactStagingDirectory)\testdata
|
||||
copy $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\custom_op_library.* $(Build.ArtifactStagingDirectory)\testdata
|
||||
|
||||
|
|
@ -88,22 +89,26 @@ jobs:
|
|||
powershell -Command "Invoke-WebRequest http://stahlworks.com/dev/unzip.exe -OutFile unzip.exe"
|
||||
powershell -Command "Invoke-WebRequest http://stahlworks.com/dev/zip.exe -OutFile zip.exe"
|
||||
set PATH=%CD%;%PATH%
|
||||
FOR /R %%i IN (*.nupkg) do (
|
||||
rename %%~ni.nupkg %%~ni.zip
|
||||
unzip %%~ni.zip -d %%~ni
|
||||
del /Q %%~ni.zip
|
||||
unzip linux-x64.zip -d linux-x64
|
||||
mkdir %%~ni\runtimes\linux-x64
|
||||
mkdir %%~ni\runtimes\linux-x64\native
|
||||
move linux-x64\linux-x64\libonnxruntime.so %%~ni\runtimes\linux-x64\native\libonnxruntime.so
|
||||
pushd %%~ni
|
||||
zip -r ..\%%~ni.zip .
|
||||
popd
|
||||
move %%~ni.zip %%~ni.nupkg
|
||||
SETLOCAL EnableDelayedExpansion
|
||||
FOR /R %%i IN (*.nupkg) do (
|
||||
set filename=%%~ni
|
||||
IF NOT "!filename:~25,7!"=="Managed" (
|
||||
rename %%~ni.nupkg %%~ni.zip
|
||||
unzip %%~ni.zip -d %%~ni
|
||||
del /Q %%~ni.zip
|
||||
unzip linux-x64.zip -d linux-x64
|
||||
mkdir %%~ni\runtimes\linux-x64
|
||||
mkdir %%~ni\runtimes\linux-x64\native
|
||||
move linux-x64\linux-x64\libonnxruntime.so %%~ni\runtimes\linux-x64\native\libonnxruntime.so
|
||||
pushd %%~ni
|
||||
zip -r ..\%%~ni.zip .
|
||||
popd
|
||||
move %%~ni.zip %%~ni.nupkg
|
||||
)
|
||||
)
|
||||
popd
|
||||
copy $(Build.BinariesDirectory)\nuget-artifact\*.nupkg $(Build.ArtifactStagingDirectory)
|
||||
displayName: 'Bundle NuGet and other binaries'
|
||||
displayName: 'Bundle Native NuGet and other binaries'
|
||||
|
||||
- template: ../../templates/esrp_nuget.yml
|
||||
parameters:
|
||||
|
|
|
|||
|
|
@ -26,7 +26,10 @@ steps:
|
|||
echo changing directory to artifact download path
|
||||
pushd "${{ parameters.downloadPath }}"
|
||||
echo processing nupkg
|
||||
SETLOCAL EnableDelayedExpansion
|
||||
FOR /R %%i IN (*.nupkg) do (
|
||||
set filename=%%~ni
|
||||
IF NOT "!filename:~25,7!"=="Managed" (
|
||||
echo processing %%~ni.nupkg
|
||||
copy %%~ni.nupkg %%~ni.zip
|
||||
echo copied to zip
|
||||
|
|
@ -39,7 +42,7 @@ steps:
|
|||
7z.exe l -slt %%~ni.zip runtimes\win-x86\native\onnxruntime.dll | findstr /R /C:"^Size = [0-9]*" | for /F "tokens=3" %%a in ('more') do if not "%%a" == "" echo win,x86,openmp,%%a >> binary_size_data.txt
|
||||
echo calling python script to post to database
|
||||
python.exe $(Build.SourcesDirectory)\tools\ci_build\github\windows\post_binary_sizes_to_dashboard.py --commit_hash=${{ parameters.gitCommitHash }} --size_data_file=binary_size_data.txt --build_project=Lotus --build_id=$(Build.BuildId)
|
||||
)
|
||||
|
||||
)
|
||||
)
|
||||
env:
|
||||
DASHBOARD_MYSQL_ORT_PASSWORD: $(dashboard-mysql-ort-password)
|
||||
|
|
|
|||
234
tools/nuget/generate_nuspec_for_native_nuget.py
Normal file
234
tools/nuget/generate_nuspec_for_native_nuget.py
Normal file
|
|
@ -0,0 +1,234 @@
|
|||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License.
|
||||
|
||||
import argparse
|
||||
import sys
|
||||
import os
|
||||
|
||||
def parse_arguments():
|
||||
parser = argparse.ArgumentParser(description="ONNX Runtime create nuget spec script (for hosting native shared library artifacts)",
|
||||
usage='')
|
||||
# Main arguments
|
||||
parser.add_argument("--package_name", required=True, help="ORT package name. Eg: Microsoft.ML.OnnxRuntime.Gpu")
|
||||
parser.add_argument("--package_version", required=True, help="ORT package version. Eg: 1.0.0")
|
||||
parser.add_argument("--target_architecture", required=True, help="Eg: x64")
|
||||
parser.add_argument("--build_config", required=True, help="Eg: RelWithDebInfo")
|
||||
parser.add_argument("--ort_build_path", required=True, help="ORT build directory.")
|
||||
parser.add_argument("--native_build_path", required=True, help="Native build output directory..")
|
||||
parser.add_argument("--sources_path", required=True, help="OnnxRuntime source code root.")
|
||||
parser.add_argument("--commit_id", required=True, help="The last commit id included in this package.")
|
||||
parser.add_argument("--is_release_build", required=False, default=None, type=str, help="Flag indicating if the build is a release build. Accepted values: true/false.")
|
||||
|
||||
return parser.parse_args()
|
||||
|
||||
def generate_id(list, package_name):
|
||||
list.append('<id>' + package_name + '</id>')
|
||||
|
||||
def generate_version(list, package_version):
|
||||
list.append('<version>' + package_version + '</version>')
|
||||
|
||||
def generate_authors(list, authors):
|
||||
list.append('<authors>' + authors + '</authors>')
|
||||
|
||||
def generate_owners(list, owners):
|
||||
list.append('<owners>' + owners + '</owners>')
|
||||
|
||||
def generate_description(list, description):
|
||||
list.append('<description>' + description + '</description>')
|
||||
|
||||
def generate_copyright(list, copyright):
|
||||
list.append('<copyright>' + copyright + '</copyright>')
|
||||
|
||||
def generate_tags(list, tags):
|
||||
list.append('<tags>' + tags + '</tags>')
|
||||
|
||||
def generate_icon_url(list, icon_url):
|
||||
list.append('<iconUrl>' + icon_url + '</iconUrl>')
|
||||
|
||||
def generate_license(list):
|
||||
list.append('<license type="file">LICENSE.txt</license>')
|
||||
|
||||
def generate_project_url(list, project_url):
|
||||
list.append('<projectUrl>' + project_url + '</projectUrl>')
|
||||
|
||||
def generate_repo_url(list, repo_url, commit_id):
|
||||
list.append('<repository type="git" url="' + repo_url + '"' + ' commit="' + commit_id + '" />')
|
||||
|
||||
def generate_dependencies(list, version):
|
||||
list.append('<dependencies>')
|
||||
|
||||
# Support .Net Core
|
||||
list.append('<group targetFramework="NETCOREAPP">')
|
||||
list.append('<dependency id="Microsoft.ML.OnnxRuntime.Managed"' + ' version="' + version + '"/>')
|
||||
list.append('</group>')
|
||||
|
||||
# Support .Net Standard
|
||||
list.append('<group targetFramework="NETSTANDARD">')
|
||||
list.append('<dependency id="Microsoft.ML.OnnxRuntime.Managed"' + ' version="' + version + '"/>')
|
||||
list.append('</group>')
|
||||
|
||||
# Support .Net Framework
|
||||
list.append('<group targetFramework="NETFRAMEWORK">')
|
||||
list.append('<dependency id="Microsoft.ML.OnnxRuntime.Managed"' + ' version="' + version + '"/>')
|
||||
list.append('</group>')
|
||||
|
||||
list.append('</dependencies>')
|
||||
|
||||
def get_env_var(key):
|
||||
return os.environ.get(key)
|
||||
|
||||
def generate_release_notes(list):
|
||||
list.append('<releaseNotes>')
|
||||
list.append('Release Def:')
|
||||
|
||||
branch = get_env_var('BUILD_SOURCEBRANCH')
|
||||
list.append('\t' + 'Branch: ' + (branch if branch != None else ''))
|
||||
|
||||
version = get_env_var('BUILD_SOURCEVERSION')
|
||||
list.append('\t' + 'Commit: ' + (version if version != None else ''))
|
||||
|
||||
build_id = get_env_var('BUILD_BUILDID')
|
||||
list.append('\t' + 'Build: https://aiinfra.visualstudio.com/Lotus/_build/results?buildId=' + (build_id if build_id != None else ''))
|
||||
|
||||
list.append('</releaseNotes>')
|
||||
|
||||
def generate_metadata(list, args):
|
||||
metadata_list = ['<metadata>']
|
||||
generate_id(metadata_list, args.package_name)
|
||||
generate_version(metadata_list, args.package_version)
|
||||
generate_authors(metadata_list, 'Microsoft')
|
||||
generate_owners(metadata_list, 'Microsoft')
|
||||
generate_description(metadata_list, 'This package contains native shared library artifacts for all supported platforms of ONNX Runtime.')
|
||||
generate_copyright(metadata_list, '\xc2\xa9 ' + 'Microsoft Corporation. All rights reserved.')
|
||||
generate_tags(metadata_list, 'ONNX ONNX Runtime Machine Learning')
|
||||
generate_icon_url(metadata_list, 'https://go.microsoft.com/fwlink/?linkid=2049168')
|
||||
generate_license(metadata_list)
|
||||
generate_project_url(metadata_list, 'https://github.com/Microsoft/onnxruntime')
|
||||
generate_repo_url(metadata_list, 'https://github.com/Microsoft/onnxruntime.git', args.commit_id)
|
||||
generate_dependencies(metadata_list, args.package_version)
|
||||
generate_release_notes(metadata_list)
|
||||
metadata_list.append('</metadata>')
|
||||
|
||||
list += metadata_list
|
||||
|
||||
def generate_files(list, args):
|
||||
files_list = ['<files>']
|
||||
|
||||
# Process headers
|
||||
files_list.append('<file src=' + '"' + os.path.join(args.sources_path, 'include\\onnxruntime\\core\\session\\onnxruntime_*.h') + '" target="build\\native\\include" />')
|
||||
files_list.append('<file src=' + '"' + os.path.join(args.sources_path, 'include\\onnxruntime\\core\\providers\\cpu\\cpu_provider_factory.h') + '" target="build\\native\\include" />')
|
||||
|
||||
if (args.package_name != 'Microsoft.ML.OnnxRuntime.DirectML'):
|
||||
files_list.append('<file src=' + '"' + os.path.join(args.sources_path, 'include\\onnxruntime\\core\\providers\\cuda\\cuda_provider_factory.h') + '" target="build\\native\\include" />')
|
||||
else: # it is a DirectML package
|
||||
files_list.append('<file src=' + '"' + os.path.join(args.sources_path, 'include\\onnxruntime\\core\\providers\\dml\\dml_provider_factory.h') + '" target="build\\native\\include" />')
|
||||
# Process DirectML dll
|
||||
if os.path.exists(os.path.join(args.native_build_path, 'DirectML.dll')):
|
||||
files_list.append('<file src=' + '"' + os.path.join(args.native_build_path, 'DirectML.dll') + '" target="runtimes\\win-' + args.target_architecture + '\\native" />')
|
||||
|
||||
|
||||
# Process onnxruntime import lib, dll, and pdb
|
||||
files_list.append('<file src=' + '"' + os.path.join(args.native_build_path, 'onnxruntime.lib') + '" target="runtimes\\win-' + args.target_architecture + '\\native" />')
|
||||
files_list.append('<file src=' + '"' + os.path.join(args.native_build_path, 'onnxruntime.dll') + '" target="runtimes\\win-' + args.target_architecture + '\\native" />')
|
||||
files_list.append('<file src=' + '"' + os.path.join(args.native_build_path, 'onnxruntime.pdb') + '" target="runtimes\\win-' + args.target_architecture + '\\native" />')
|
||||
|
||||
# Process Windows.AI.MachineLearning lib, dll, and pdb
|
||||
if (args.package_name == 'Microsoft.ML.OnnxRuntime.DirectML' or args.package_name == 'Microsoft.ML.OnnxRuntime') and os.path.exists(os.path.join(args.native_build_path, 'windows.ai.machinelearning.lib')):
|
||||
files_list.append('<file src=' + '"' + os.path.join(args.native_build_path, 'windows.ai.machinelearning.lib') + '" target="runtimes\\win-' + args.target_architecture + '\\native\\Windows.AI.MachineLearning.lib" />')
|
||||
|
||||
if (args.package_name == 'Microsoft.ML.OnnxRuntime.DirectML' or args.package_name == 'Microsoft.ML.OnnxRuntime') and os.path.exists(os.path.join(args.native_build_path, 'windows.ai.machinelearning.dll')):
|
||||
files_list.append('<file src=' + '"' + os.path.join(args.native_build_path, 'windows.ai.machinelearning.dll') + '" target="runtimes\\win-' + args.target_architecture + '\\native\\Windows.AI.MachineLearning.dll" />')
|
||||
|
||||
if (args.package_name == 'Microsoft.ML.OnnxRuntime.DirectML' or args.package_name == 'Microsoft.ML.OnnxRuntime') and os.path.exists(os.path.join(args.native_build_path, 'windows.ai.machinelearning.pdb')):
|
||||
files_list.append('<file src=' + '"' + os.path.join(args.native_build_path, 'windows.ai.machinelearning.pdb') + '" target="runtimes\\win-' + args.target_architecture + '\\native\\Windows.AI.MachineLearning.pdb" />')
|
||||
|
||||
# Process windows.ai.machinelearning.winmd
|
||||
if (args.package_name == 'Microsoft.ML.OnnxRuntime.DirectML' or args.package_name == 'Microsoft.ML.OnnxRuntime') and os.path.exists(os.path.join(args.ort_build_path, args.build_config, 'windows.ai.machinelearning.winmd')):
|
||||
files_list.append('<file src=' + '"' + os.path.join(args.ort_build_path, args.build_config, 'windows.ai.machinelearning.winmd') + '" target="build\\native\\metadata\\Windows.AI.MachineLearning.winmd" />')
|
||||
|
||||
# Process windows.ai.machinelearning headers
|
||||
if (args.package_name == 'Microsoft.ML.OnnxRuntime.DirectML' or args.package_name == 'Microsoft.ML.OnnxRuntime') and os.path.exists(os.path.join(args.ort_build_path, args.build_config, 'windows.ai.machinelearning.h')):
|
||||
files_list.append('<file src=' + '"' + os.path.join(args.ort_build_path, args.build_config, 'windows.ai.machinelearning.h') + '" target="build\\native\\include\\Windows.AI.MachineLearning.h" />')
|
||||
|
||||
if (args.package_name == 'Microsoft.ML.OnnxRuntime.DirectML' or args.package_name == 'Microsoft.ML.OnnxRuntime') and os.path.exists(os.path.join(args.ort_build_path, args.build_config, 'windows.ai.machinelearning.native.h')):
|
||||
files_list.append('<file src=' + '"' + os.path.join(args.ort_build_path, args.build_config, 'windows.ai.machinelearning.native.h') + '" target="build\\native\\include\\Windows.AI.MachineLearning.Native.h" />')
|
||||
|
||||
# Process dnll.dll
|
||||
if os.path.exists(os.path.join(args.native_build_path, 'dnnl.dll')):
|
||||
files_list.append('<file src=' + '"' + os.path.join(args.native_build_path, 'dnnl.dll') + '" target="runtimes\\win-' + args.target_architecture + '\\native" />')
|
||||
|
||||
# Process mklml.dll
|
||||
if os.path.exists(os.path.join(args.native_build_path, 'mklml.dll')):
|
||||
files_list.append('<file src=' + '"' + os.path.join(args.native_build_path, 'mklml.dll') + '" target="runtimes\\win-' + args.target_architecture + '\\native" />')
|
||||
|
||||
# Process libiomp5md.dll
|
||||
if os.path.exists(os.path.join(args.native_build_path, 'libiomp5md.dll')):
|
||||
files_list.append('<file src=' + '"' + os.path.join(args.native_build_path, 'libiomp5md.dll') + '" target="runtimes\\win-' + args.target_architecture + '\\native" />')
|
||||
|
||||
# Process tvm.dll
|
||||
if os.path.exists(os.path.join(args.native_build_path, 'tvm.dll')):
|
||||
files_list.append('<file src=' + '"' + os.path.join(args.native_build_path, 'tvm.dll') + '" target="runtimes\\win-' + args.target_architecture + '\\native" />')
|
||||
|
||||
# Process License, ThirdPartyNotices, Privacy, README
|
||||
files_list.append('<file src=' + '"' + os.path.join(args.sources_path, 'LICENSE.txt') + '" target="LICENSE.txt" />')
|
||||
files_list.append('<file src=' + '"' + os.path.join(args.sources_path, 'ThirdPartyNotices.txt') + '" target="ThirdPartyNotices.txt" />')
|
||||
files_list.append('<file src=' + '"' + os.path.join(args.sources_path, 'docs', 'Privacy.md') + '" target="Privacy.md" />')
|
||||
files_list.append('<file src=' + '"' + os.path.join(args.sources_path, 'docs', 'C_API.md') + '" target="README.md" />')
|
||||
|
||||
# Process props file
|
||||
source_props = os.path.join(args.sources_path, 'csharp', 'src', 'Microsoft.ML.OnnxRuntime', 'props.xml')
|
||||
target_props = os.path.join(args.sources_path, 'csharp', 'src', 'Microsoft.ML.OnnxRuntime', args.package_name + '.props')
|
||||
os.system('copy ' + source_props + ' ' + target_props)
|
||||
files_list.append('<file src=' + '"' + target_props + '" target="build\\native" />')
|
||||
files_list.append('<file src=' + '"' + target_props + '" target="build\\netstandard1.1" />')
|
||||
|
||||
# Process targets file
|
||||
source_targets = os.path.join(args.sources_path, 'csharp', 'src', 'Microsoft.ML.OnnxRuntime', 'targets.xml')
|
||||
target_targets = os.path.join(args.sources_path, 'csharp', 'src', 'Microsoft.ML.OnnxRuntime', args.package_name + '.targets')
|
||||
os.system('copy ' + source_targets + ' ' + target_targets)
|
||||
files_list.append('<file src=' + '"' + target_targets + '" target="build\\native" />')
|
||||
files_list.append('<file src=' + '"' + target_targets + '" target="build\\netstandard1.1" />')
|
||||
|
||||
# Some tools to be packaged in nightly build only, should not be released
|
||||
# These are copied to the runtimes folder for convenience of loading with the dlls
|
||||
if args.is_release_build.lower() != 'true' and args.target_architecture == 'x64' and os.path.exists(os.path.join(args.native_build_path, 'onnxruntime_perf_test.exe')):
|
||||
files_list.append('<file src=' + '"' + os.path.join(args.native_build_path, 'onnxruntime_perf_test.exe') + '" target="runtimes\\win-' + args.target_architecture + '\\native" />')
|
||||
|
||||
if args.is_release_build.lower() != 'true' and args.target_architecture == 'x64' and os.path.exists(os.path.join(args.native_build_path, 'onnx_test_runner.exe')):
|
||||
files_list.append('<file src=' + '"' + os.path.join(args.native_build_path, 'onnx_test_runner.exe') + '" target="runtimes\\win-' + args.target_architecture + '\\native" />')
|
||||
|
||||
files_list.append('</files>')
|
||||
|
||||
list += files_list
|
||||
|
||||
def generate_nuspec(args):
|
||||
lines = ['<?xml version="1.0"?>']
|
||||
lines.append('<package>')
|
||||
generate_metadata(lines, args)
|
||||
generate_files(lines, args)
|
||||
lines.append('</package>')
|
||||
return lines
|
||||
|
||||
def is_windows():
|
||||
return sys.platform.startswith("win")
|
||||
|
||||
def main():
|
||||
if not is_windows():
|
||||
raise Exception('Native Nuget generation is currently supported only on Windows')
|
||||
|
||||
# Parse arguments
|
||||
args = parse_arguments()
|
||||
if (args.is_release_build.lower() != 'true' and args.is_release_build.lower() != 'false'):
|
||||
raise Exception('Only valid options for IsReleaseBuild are: true and false')
|
||||
|
||||
# Generate nuspec
|
||||
lines = generate_nuspec(args)
|
||||
|
||||
# Create the nuspec needed to generate the Nuget
|
||||
with open(os.path.join(args.native_build_path, 'NativeNuget.nuspec'), 'w') as f:
|
||||
for line in lines:
|
||||
f.write(line)
|
||||
f.write('\n')
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
|
|
@ -8,7 +8,7 @@ import zipfile # Available Python 3.2 or higher
|
|||
import glob
|
||||
|
||||
def parse_arguments():
|
||||
parser = argparse.ArgumentParser(description="ONNX Runtime create nuget spec script",
|
||||
parser = argparse.ArgumentParser(description="Validate ONNX Runtime native nuget containing native shared library artifacts spec script",
|
||||
usage='')
|
||||
# Main arguments
|
||||
parser.add_argument("--nuget_path", required=True, help="Path containing the Nuget to be validated. Must only contain only one Nuget within this.")
|
||||
|
|
@ -70,7 +70,7 @@ def main():
|
|||
args = parse_arguments()
|
||||
|
||||
files = os.listdir(args.nuget_path)
|
||||
nuget_packages_found_in_path = [i for i in files if i.endswith('.nupkg')]
|
||||
nuget_packages_found_in_path = [i for i in files if i.endswith('.nupkg') and "Managed" not in i]
|
||||
if (len(nuget_packages_found_in_path) != 1):
|
||||
print('Nuget packages found in path: ')
|
||||
print(nuget_packages_found_in_path)
|
||||
|
|
|
|||
Loading…
Reference in a new issue