<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

    <Choose>
        <When Condition="'$(ApplicationType)|$(ApplicationTypeRevision)' == 'Windows Store|10.0'">
            <PropertyGroup>
                <OpenXRLoaderBinaryRoot>$(OpenXRLoaderPackageRoot)native\$(Platform)_uwp\release</OpenXRLoaderBinaryRoot>
            </PropertyGroup>
        </When>
        <Otherwise>
            <PropertyGroup>
                <OpenXRLoaderBinaryRoot>$(OpenXRLoaderPackageRoot)native\$(Platform)\release</OpenXRLoaderBinaryRoot>
            </PropertyGroup>
        </Otherwise>
    </Choose>

    <ItemDefinitionGroup>
        <Link>
            <AdditionalDependencies>%(AdditionalDependencies);$(OpenXRLoaderBinaryRoot)\lib\openxr_loader.lib</AdditionalDependencies>
        </Link>
    </ItemDefinitionGroup>

    <!-- Copy the OpenXR loader DLL to the output directory and include in packaging -->
    <ItemGroup Condition="'$(OpenXRSkipLoaderCopy)'!='true'">
        <None Include="$(OpenXRLoaderBinaryRoot)\bin\openxr_loader.dll">
            <Link>%(Filename)%(Extension)</Link>
            <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
            <DeploymentContent>true</DeploymentContent>
        </None>
    </ItemGroup>

    <Target Name="EnsurePropsImported" BeforeTargets="PrepareForBuild">
        <Error Condition="'$(OpenXRLoaderPackageRoot)'==''" Text="OpenXRLoaderPackageRoot property missing. Project is malformed. Try removing and re-adding the NuGet reference." />
    </Target>

</Project>
