Minor changes to support inclusion of x86 bits in the Nuget packaging pipeline (#916)

* initial commit

* More changes

* More changes

* Adding stuff back to the targets xml

* More changes v3

* More changes v4

* More changes v5

* More changes v6

* More changes v7

* More changes v9

* Disable CSharp tests for now

* More changes

* Revert file to same status

* Update props file for x86

* Change to usage of TargetArchitecture instead of PlatformTarget

* Update targets.xml

* Minor formatting nit fix

* Update based on PR comments
This commit is contained in:
Hariharan Seshadri 2019-04-27 00:41:26 -07:00 committed by GitHub
parent 7a42ffd15f
commit 06e0f7e3e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 48 additions and 15 deletions

View file

@ -12,7 +12,8 @@
<OnnxRuntimeCsharpRoot>..\..</OnnxRuntimeCsharpRoot>
<OnnxRuntimeBuildDirectory Condition="'$(OnnxRuntimeBuildDirectory)'==''">$(OnnxRuntimeCsharpRoot)\..\build\Windows</OnnxRuntimeBuildDirectory>
<NativeBuildOutputDir>$(OnnxRuntimeBuildDirectory)\$(Configuration)\$(Configuration)</NativeBuildOutputDir>
<TargetArchitecture Condition=" '$(TargetArchitecture)' == '' ">x64</TargetArchitecture>
<!--- packaging properties -->
<PackageId>Microsoft.ML.OnnxRuntime</PackageId>
<Authors>Microsoft</Authors>
@ -40,41 +41,41 @@
Visible="false"
/>
<None Include="$(NativeBuildOutputDir)\onnxruntime.lib"
PackagePath="\runtimes\win-x64\native"
PackagePath="\runtimes\win-$(TargetArchitecture)\native"
Pack="true"
CopyToOutputDirectory="Never"
Visible="false"
/>
<None Include="$(NativeBuildOutputDir)\onnxruntime.dll"
PackagePath="\runtimes\win-x64\native"
PackagePath="\runtimes\win-$(TargetArchitecture)\native"
Pack="true"
CopyToOutputDirectory="Always"
Visible="false"
/>
<None Include="$(NativeBuildOutputDir)\onnxruntime.pdb"
Condition="Exists('$(NativeBuildOutputDir)\onnxruntime.pdb')"
PackagePath="\runtimes\win-x64\native"
PackagePath="\runtimes\win-$(TargetArchitecture)\native"
Pack="true"
CopyToOutputDirectory="Always"
Visible="false"
/>
<None Include="$(NativeBuildOutputDir)\mkldnn.dll"
Condition="Exists('$(NativeBuildOutputDir)\mkldnn.dll')"
PackagePath="\runtimes\win-x64\native"
PackagePath="\runtimes\win-$(TargetArchitecture)\native"
Pack="true"
CopyToOutputDirectory="Always"
Visible="false"
/>
<None Include="$(NativeBuildOutputDir)\mklml.dll"
Condition="Exists('$(NativeBuildOutputDir)\mklml.dll')"
PackagePath="\runtimes\win-x64\native"
PackagePath="\runtimes\win-$(TargetArchitecture)\native"
Pack="true"
CopyToOutputDirectory="Always"
Visible="false"
/>
<None Include="$(NativeBuildOutputDir)\libiomp5md.dll"
Condition="Exists('$(NativeBuildOutputDir)\libiomp5md.dll')"
PackagePath="\runtimes\win-x64\native"
PackagePath="\runtimes\win-$(TargetArchitecture)\native"
Pack="true"
CopyToOutputDirectory="Always"
Visible="false"

View file

@ -10,18 +10,24 @@
</ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(PlatformTarget)' == 'x64'">
<Link>
<AdditionalDependencies>$(MSBuildThisFileDirectory)../../runtimes/win-x64/native/onnxruntime.lib</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(PlatformTarget)' == 'x86'">
<Link>
<AdditionalDependencies>$(MSBuildThisFileDirectory)../../runtimes/win-x86/native/onnxruntime.lib</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup Condition="Exists('packages.config') OR
Exists('$(MSBuildProjectName).packages.config') OR
Exists('packages.$(MSBuildProjectName).config')">
<None Include="$(MSBuildThisFileDirectory)..\..\runtimes\win-x64\native\onnxruntime.dll"
Condition="'$(PlatformTarget)' == 'x64'">
<Link>onnxruntime.dll</Link>
<Link>onnxruntime.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Visible>false</Visible>
</None>
@ -46,5 +52,32 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Visible>false</Visible>
</None>
<None Include="$(MSBuildThisFileDirectory)..\..\runtimes\win-x86\native\onnxruntime.dll"
Condition="'$(PlatformTarget)' == 'x86'">
<Link>onnxruntime.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Visible>false</Visible>
</None>
<None Include="$(MSBuildThisFileDirectory)..\..\runtimes\win-x86\native\mkldnn.dll"
Condition="'$(PlatformTarget)' == 'x86' AND
Exists('$(MSBuildThisFileDirectory)..\..\runtimes\win-x86\native\mkldnn.dll')">
<Link>mkldnn.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Visible>false</Visible>
</None>
<None Include="$(MSBuildThisFileDirectory)..\..\runtimes\win-x86\native\mklml.dll"
Condition="'$(PlatformTarget)' == 'x86' AND
Exists('$(MSBuildThisFileDirectory)..\..\runtimes\win-x86\native\mklml.dll')">
<Link>mklml.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Visible>false</Visible>
</None>
<None Include="$(MSBuildThisFileDirectory)..\..\runtimes\win-x86\native\libiomp5md.dll"
Condition="'$(PlatformTarget)' == 'x86' AND
Exists('$(MSBuildThisFileDirectory)..\..\runtimes\win-x86\native\libiomp5md.dll')">
<Link>libiomp5md.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Visible>false</Visible>
</None>
</ItemGroup>
</Project>

View file

@ -1,16 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="Microsoft_ML_OnnxRuntime_CheckPrerequisites" BeforeTargets="BeforeBuild">
<!--
<!--
Special case .NET Core portable applications. When building a portable .NET Core app,
the PlatformTarget is empty, and you don't know until runtime (i.e. which dotnet.exe)
what processor architecture will be used.
-->
<Error Condition="'$(PlatformTarget)' != 'x64' AND
<Error Condition="('$(PlatformTarget)' != 'x64' AND '$(PlatformTarget)' != 'x86' AND '$(PlatformTarget)' != 'AnyCPU') AND
('$(OutputType)' == 'Exe' OR '$(OutputType)'=='WinExe') AND
!('$(TargetFrameworkIdentifier)' == '.NETCoreApp' AND '$(PlatformTarget)' == '') AND
'$(SuppressOnnxRuntimePlatformCompatibilityError)' != 'true'"
Text="Microsoft.ML.OnnxRuntime only supports the x64 platform at this time."/>
Text="Microsoft.ML.OnnxRuntime only supports the AnyCPU, x64, and x86 platforms at this time."/>
</Target>
</Project>

View file

@ -33,7 +33,6 @@
<ItemGroup>
<ProjectReference Include="$(OnnxRuntimeCSharpRoot)\src\Microsoft.ML.OnnxRuntime\Microsoft.ML.OnnxRuntime.csproj" />
<PackageReference Include="CommandLineParser" Version="2.4.3" />
<PackageReference Include="Microsoft.ML.Scoring" Version="1.1.0" />
</ItemGroup>

View file

@ -43,10 +43,10 @@ namespace Microsoft.ML.OnnxRuntime.PerfTool
var cmdOptions = Parser.Default.ParseArguments<CommandOptions>(args);
cmdOptions.WithParsed(
options => {
Main(options);
Run(options);
});
}
public static void Main(CommandOptions options)
public static void Run(CommandOptions options)
{
string modelPath = options.ModelFile;
string inputPath = options.InputFile;