This commit is contained in:
Chuck Walbourn 2022-04-22 19:56:05 -07:00
Родитель b3c9fb6b61
Коммит 0344ec8955
2 изменённых файлов: 204 добавлений и 0 удалений

Просмотреть файл

@ -4,8 +4,16 @@
<PropertyGroup>
<ExtractedFolder Condition="'$(ExtractedFolder)'==''">C:\xtracted\</ExtractedFolder>
<ExtractedFolder Condition="!HasTrailingSlash('$(ExtractedFolder)')">$(ExtractedFolder)\</ExtractedFolder>
<_AlternativeVCTargetsPath170>$(ExtractedFolder)VCTargets170\</_AlternativeVCTargetsPath170>
<_AlternativeVCTargetsPath160>$(ExtractedFolder)VCTargets160\</_AlternativeVCTargetsPath160>
<_AlternativeVCTargetsPath150>$(ExtractedFolder)VCTargets150\</_AlternativeVCTargetsPath150>
<!-- Workaround for VS bug -->
<MinimumVisualStudioVersion>15.0</MinimumVisualStudioVersion>
</PropertyGroup>
<!-- Windows 10 SDK NuGet -->
<Import Condition="'$(WSDKEnableBWOI)' == 'true'"
Project="$(ExtractedFolder)SDK\Microsoft.Windows.SDK.cpp\build\Microsoft.Windows.SDK.cpp.props" />
@ -21,4 +29,62 @@
<Import Condition="'$(WSDKEnableBWOI)' == 'true' and '$(Platform)' == 'ARM64'"
Project="$(ExtractedFolder)SDK\Microsoft.Windows.SDK.cpp.arm64\build\native\Microsoft.Windows.SDK.cpp.arm64.props" />
<!-- Microsoft GDK NuGet -->
<Import Condition="'$(GDKEnableBWOI)' == 'true' and $(Platform.Contains('x64')) and Exists('$(ExtractedFolder)GDK\Microsoft.GDK.PC.$(GDKEditionNumber)\build\Microsoft.GDK.PC.$(GDKEditionNumber).props')"
Project="$(ExtractedFolder)GDK\Microsoft.GDK.PC.$(GDKEditionNumber)\build\Microsoft.GDK.PC.$(GDKEditionNumber).props" />
<Import Condition="'$(GDKEnableBWOI)' == 'true' and $(Platform.Contains('x64'))"
Project="$(ExtractedFolder)GDK\Microsoft.GDK.Xbox.$(GDKEditionNumber)\build\Microsoft.GDK.Xbox.$(GDKEditionNumber).props" />
<!--
****************************************************************************************************
VCTargetsPath redirection (VS 2019)
****************************************************************************************************
-->
<PropertyGroup Condition="'$(Platform)' == 'Gaming.Xbox.XboxOne.x64' and '$(VisualStudioVersion)' == '16.0'">
<AdditionalVCTargetsPath>$(_AlternativeVCTargetsPath160)</AdditionalVCTargetsPath>
<DisableInstalledVCTargetsUse>true</DisableInstalledVCTargetsUse>
<VCTargetsPath15 Condition="'$(_AlternativeVCTargetsPath150)'!=''">$(_AlternativeVCTargetsPath150)</VCTargetsPath15>
<VCTargetsPath16>$(_AlternativeVCTargetsPath160)</VCTargetsPath16>
</PropertyGroup>
<PropertyGroup Condition="'$(Platform)' == 'Gaming.Xbox.Scarlett.x64' and '$(VisualStudioVersion)' == '16.0'">
<AdditionalVCTargetsPath>$(_AlternativeVCTargetsPath160)</AdditionalVCTargetsPath>
<DisableInstalledVCTargetsUse>true</DisableInstalledVCTargetsUse>
<VCTargetsPath15 Condition="'$(_AlternativeVCTargetsPath150)'!=''">$(_AlternativeVCTargetsPath150)</VCTargetsPath15>
<VCTargetsPath16>$(_AlternativeVCTargetsPath160)</VCTargetsPath16>
</PropertyGroup>
<PropertyGroup Condition="'$(Platform)' == 'Gaming.Desktop.x64' and '$(VisualStudioVersion)' == '16.0'">
<AdditionalVCTargetsPath>$(_AlternativeVCTargetsPath160)</AdditionalVCTargetsPath>
<DisableInstalledVCTargetsUse>true</DisableInstalledVCTargetsUse>
<VCTargetsPath15 Condition="'$(_AlternativeVCTargetsPath150)'!=''">$(_AlternativeVCTargetsPath150)</VCTargetsPath15>
<VCTargetsPath16>$(_AlternativeVCTargetsPath160)</VCTargetsPath16>
</PropertyGroup>
<!--
****************************************************************************************************
VCTargetsPath redirection (VS 2022)
****************************************************************************************************
-->
<PropertyGroup Condition="'$(Platform)' == 'Gaming.Xbox.XboxOne.x64' and '$(VisualStudioVersion)' == '17.0'">
<DisableInstalledVCTargetsUse>true</DisableInstalledVCTargetsUse>
<VCTargetsPath15 Condition="'$(_AlternativeVCTargetsPath150)'!=''">$(_AlternativeVCTargetsPath150)</VCTargetsPath15>
<VCTargetsPath16 Condition="'$(_AlternativeVCTargetsPath160)'!=''">$(_AlternativeVCTargetsPath160)</VCTargetsPath16>
<VCTargetsPath17>$(_AlternativeVCTargetsPath170)</VCTargetsPath17>
</PropertyGroup>
<PropertyGroup Condition="'$(Platform)' == 'Gaming.Xbox.Scarlett.x64' and '$(VisualStudioVersion)' == '17.0'">
<DisableInstalledVCTargetsUse>true</DisableInstalledVCTargetsUse>
<VCTargetsPath15 Condition="'$(_AlternativeVCTargetsPath150)'!=''">$(_AlternativeVCTargetsPath150)</VCTargetsPath15>
<VCTargetsPath16 Condition="'$(_AlternativeVCTargetsPath160)'!=''">$(_AlternativeVCTargetsPath160)</VCTargetsPath16>
<VCTargetsPath17>$(_AlternativeVCTargetsPath170)</VCTargetsPath17>
</PropertyGroup>
<PropertyGroup Condition="'$(Platform)' == 'Gaming.Desktop.x64' and '$(VisualStudioVersion)' == '17.0'">
<DisableInstalledVCTargetsUse>true</DisableInstalledVCTargetsUse>
<VCTargetsPath15 Condition="'$(_AlternativeVCTargetsPath150)'!=''">$(_AlternativeVCTargetsPath150)</VCTargetsPath15>
<VCTargetsPath16 Condition="'$(_AlternativeVCTargetsPath160)'!=''">$(_AlternativeVCTargetsPath160)</VCTargetsPath16>
<VCTargetsPath17>$(_AlternativeVCTargetsPath170)</VCTargetsPath17>
</PropertyGroup>
</Project>

138
.bwoi/SetupBWOI.targets Normal file
Просмотреть файл

@ -0,0 +1,138 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="SetupVCTargets" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ExtractedFolder Condition="'$(ExtractedFolder)'==''">C:\xtracted\</ExtractedFolder>
<ExtractedFolder Condition="!HasTrailingSlash('$(ExtractedFolder)')">$(ExtractedFolder)\</ExtractedFolder>
</PropertyGroup>
<!--
A list of VCTargets folders that we expect to exist after copying the BWOI VS files
If any of these folders is not present then we assume that the VCTargets has not been setup
-->
<ItemGroup>
<BWOIVCFolders Include="$(ExtractedFolder)VCTargets150\" />
<BWOIVCFolders Include="$(ExtractedFolder)VCTargets150\Platforms\" />
<BWOIVCFolders Include="$(ExtractedFolder)VCTargets150\Platforms\gaming.desktop.x64" />
<BWOIVCFolders Include="$(ExtractedFolder)VCTargets150\Platforms\gaming.xbox.xboxone.x64" />
<BWOIVCFolders Include="$(ExtractedFolder)VCTargets160\" />
<BWOIVCFolders Include="$(ExtractedFolder)VCTargets160\Platforms\" />
<BWOIVCFolders Include="$(ExtractedFolder)VCTargets160\Platforms\gaming.desktop.x64" />
<BWOIVCFolders Include="$(ExtractedFolder)VCTargets160\Platforms\gaming.xbox.xboxone.x64" />
</ItemGroup>
<ItemGroup Condition="'$(VisualStudioVersion)' == '17.0'">
<BWOIVCFolders Include="$(ExtractedFolder)VCTargets170\" />
<BWOIVCFolders Include="$(ExtractedFolder)VCTargets170\Platforms\" />
<BWOIVCFolders Include="$(ExtractedFolder)VCTargets170\Platforms\gaming.desktop.x64" />
<BWOIVCFolders Include="$(ExtractedFolder)VCTargets170\Platforms\gaming.xbox.xboxone.x64" />
</ItemGroup>
<!--
Microsoft GDK NuGets for 2203 or later only support 64-bit MSBuild
-->
<UsingTask TaskName="Is64BitMSBuild" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<SixtyFourBit ParameterType="System.Boolean" Output="true" />
</ParameterGroup>
<Task>
<Code Type="Fragment" Language="cs">
<![CDATA[
SixtyFourBit = (IntPtr.Size == 8) ? true : false;
]]>
</Code>
</Task>
</UsingTask>
<Target Name="_CheckMSBuild64">
<Is64BitMSBuild>
<Output TaskParameter="SixtyFourBit" PropertyName="_SixtyFourBit" />
</Is64BitMSBuild>
<Error Condition="'$(_SixtyFourBit)'=='false'"
Text="The 64-bit version of MSBuild is required to support NuGet GDK packages." />
</Target>
<!--
Determine whether the VC Targets has already been setup
-->
<Target Name="_ProbeForExtractedVCTargets"
Outputs="%(BWOIVCFolders.Identity)">
<Error Condition="'$(ExtractedFolder)'==''"
Text="ExtractedFolder property is required" />
<PropertyGroup>
<_BWOIFolder>%(BWOIVCFolders.Identity)</_BWOIFolder>
</PropertyGroup>
<ItemGroup>
<_MissingBWOIVCFolders Condition="'$(ForceVCTargetsBWOIRefresh)'=='true' or !Exists($(_BWOIFolder))" Include="$(_BWOIFolder)" />
</ItemGroup>
<PropertyGroup>
<_ExtractedOutOfDate Condition="'@(_MissingBWOIVCFolders)' != ''">true</_ExtractedOutOfDate>
<_BWOIFolder />
</PropertyGroup>
</Target>
<Target Name="_CreateVCTargetsFolder"
Condition="'@(_MissingBWOIVCFolders)' != ''">
<Error Condition="'$(GDKEditionNumber)'==''"
Text="GDKEditionNumber property is required" />
<Error Condition="!Exists('$(ExtractedFolder)GDK\Microsoft.GDK.PC.$(GDKEditionNumber)')"
Text="NuGet package Microsoft.GDK.PC.$(GDKEditionNumber) not found in $(ExtractedFolder)GDK" />
<Error Condition="!Exists('$(ExtractedFolder)GDK\Microsoft.GDK.Xbox.$(GDKEditionNumber)')"
Text="NuGet package Microsoft.GDK.Xbox.$(GDKEditionNumber) not found in $(ExtractedFolder)GDK" />
<PropertyGroup>
<_VSFolder Condition="'$(VisualStudioVersion)' == '17.0'">VS2022</_VSFolder>
<_VSFolder Condition="'$(VisualStudioVersion)' == '16.0'">VS2019</_VSFolder>
</PropertyGroup>
<Error Condition="'$(_VSFolder)'==''"
Text="Only supports VS 2019 or VS 2022" />
<!-- Set up files for v141 platform toolset projects -->
<ItemGroup>
<SourceVCTargetsFilesV150 Include="$(MSBuildExtensionsPath32)\Microsoft\VC\v150\**" />
</ItemGroup>
<ItemGroup>
<GDKVCTargetsFilesV150 Include="$(ExtractedFolder)GDK\Microsoft.GDK.PC.$(GDKEditionNumber)\native\$(GDKEditionNumber)\GRDK\$(_VSFolder)\flatDeployment\MSBuild\Microsoft\VC\v150\**" />
<GDKVCTargetsFilesV150 Include="$(ExtractedFolder)GDK\Microsoft.GDK.Xbox.$(GDKEditionNumber)\native\$(GDKEditionNumber)\GXDK\$(_VSFolder)\flatDeployment\MSBuild\Microsoft\VC\v150\**" />
</ItemGroup>
<Copy SkipUnchangedFiles="true" SourceFiles="@(SourceVCTargetsFilesV150)" DestinationFolder="$(ExtractedFolder)VCTargets150\%(RecursiveDir)/" />
<Copy SourceFiles="@(GDKVCTargetsFilesV150)" DestinationFolder="$(ExtractedFolder)VCTargets150\%(RecursiveDir)/" />
<!-- Set up files for v142 platform toolset projects -->
<ItemGroup>
<SourceVCTargetsFilesV160 Include="$(MSBuildExtensionsPath32)\Microsoft\VC\v160\**" />
</ItemGroup>
<ItemGroup>
<GDKVCTargetsFilesV160 Include="$(ExtractedFolder)GDK\Microsoft.GDK.PC.$(GDKEditionNumber)\native\$(GDKEditionNumber)\GRDK\$(_VSFolder)\flatDeployment\MSBuild\Microsoft\VC\v160\**" />
<GDKVCTargetsFilesV160 Include="$(ExtractedFolder)GDK\Microsoft.GDK.Xbox.$(GDKEditionNumber)\native\$(GDKEditionNumber)\GXDK\$(_VSFolder)\flatDeployment\MSBuild\Microsoft\VC\v160\**" />
</ItemGroup>
<Copy SkipUnchangedFiles="true" SourceFiles="@(SourceVCTargetsFilesV160)" DestinationFolder="$(ExtractedFolder)VCTargets160\%(RecursiveDir)/" />
<Copy SourceFiles="@(GDKVCTargetsFilesV160)" DestinationFolder="$(ExtractedFolder)VCTargets160\%(RecursiveDir)/" />
<!-- Set up files for v143 platform toolset projects -->
<ItemGroup Condition="'$(VisualStudioVersion)' == '17.0'">
<SourceVCTargetsFilesV170 Include="$(MSBuildExtensionsPath32)\Microsoft\VC\v170\**" />
</ItemGroup>
<ItemGroup Condition="'$(VisualStudioVersion)' == '17.0'">
<GDKVCTargetsFilesV170 Include="$(ExtractedFolder)GDK\Microsoft.GDK.PC.$(GDKEditionNumber)\native\$(GDKEditionNumber)\GRDK\$(_VSFolder)\flatDeployment\MSBuild\Microsoft\VC\v170\**" />
<GDKVCTargetsFilesV170 Include="$(ExtractedFolder)GDK\Microsoft.GDK.Xbox.$(GDKEditionNumber)\native\$(GDKEditionNumber)\GXDK\$(_VSFolder)\flatDeployment\MSBuild\Microsoft\VC\v170\**" />
</ItemGroup>
<Copy SkipUnchangedFiles="true" SourceFiles="@(SourceVCTargetsFilesV170)" DestinationFolder="$(ExtractedFolder)VCTargets170\%(RecursiveDir)/" />
<Copy SourceFiles="@(GDKVCTargetsFilesV170)" DestinationFolder="$(ExtractedFolder)VCTargets170\%(RecursiveDir)/" />
</Target>
<Target Name="SetupVCTargets" DependsOnTargets="_CheckMSBuild64;_ProbeForExtractedVCTargets;_CreateVCTargetsFolder" />
</Project>