Microsoft.AI.MachineLearning.Interop.csproj 2.21 KB
Newer Older
gaoqiong's avatar
gaoqiong committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <ProjectName>Microsoft.AI.MachineLearning.Interop</ProjectName>
    <TargetFramework>net5.0-windows10.0.17763.0</TargetFramework>
    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
    
    <Platform>Any CPU</Platform>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
 
    <OnnxRuntimeBuildDirectory Condition="'$(OnnxRuntimeBuildDirectory)'==''">..\..\..\build\Windows</OnnxRuntimeBuildDirectory>
    <BuildOutputDir>$(OnnxRuntimeBuildDirectory)\$(Configuration)\$(Configuration)</BuildOutputDir>
    <WindowsAIInteropOutputDir>$(BuildOutputDir)\Microsoft.AI.MachineLearning.Interop</WindowsAIInteropOutputDir>
    <OutputPath>$(WindowsAIInteropOutputDir)</OutputPath>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.Windows.CsWinRT" Version="1.1.0" targetFramework="net5.0-windows10.0.17763.0" />
    <PackageReference Include="Microsoft.Windows.SDK.Contracts" Version="10.0.17763.1000" targetFramework="net5.0-windows10.0.17763.0" />
  </ItemGroup>

  <ItemGroup>
    <Folder Include="Generated Files\" />
  </ItemGroup>

  <Target Name="GenerateProjection" BeforeTargets="DispatchToInnerBuilds;Build;CoreCompile">
    <ConvertToAbsolutePath Paths="$(OnnxRuntimeBuildDirectory)">
      <Output TaskParameter="AbsolutePaths" PropertyName="OnnxRuntimeBuildDirectoryAbs" />
    </ConvertToAbsolutePath>

    <ItemGroup>
      <WindowsAIsWinMDs Include="$(OnnxRuntimeBuildDirectoryAbs)\$(Configuration)\Microsoft.AI.MachineLearning.winmd" />
      <WindowsAIsWinMDs Include="$(OnnxRuntimeBuildDirectoryAbs)\$(Configuration)\Microsoft.AI.MachineLearning.Experimental.winmd" />
    </ItemGroup>

    <PropertyGroup>
      <CsWinRTCommand>$(CsWinRTPath)cswinrt.exe -verbose -in local -in @(WindowsAIsWinMDs->'"%(FullPath)"', ' ') -out "$(ProjectDir)Generated Files" -include Microsoft.AI.MachineLearning</CsWinRTCommand>
    </PropertyGroup>

    <Message Text="Generating $(ProjectName) CS projection sources with command:" />
    <Message Text="$(CsWinRTCommand)" />
    <Exec Command="$(CsWinRTCommand)" />
    
    <ItemGroup>
      <Compile Include="$(ProjectDir)Generated Files/*.cs" Exclude="@(Compile)" />
    </ItemGroup>
  </Target>

</Project>