vcpkg/scripts/buildsystems/msbuild/vcpkg.targets
2016-10-31 17:02:39 -07:00

93 lines
5.3 KiB
XML

<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="VcpkgCompileInputs" BeforeTargets="GetClCommandLines;ClCompile">
<PropertyGroup>
<VcpkgRuntimeLibrary Condition="'%(ClCompile.RuntimeLibrary)' == ''"></VcpkgRuntimeLibrary>
<VcpkgRuntimeLibrary Condition="'%(ClCompile.RuntimeLibrary)' == 'MultiThreadedDebugDLL'"></VcpkgRuntimeLibrary>
<VcpkgRuntimeLibrary Condition="'%(ClCompile.RuntimeLibrary)' == 'MultiThreadedDebug'">-static</VcpkgRuntimeLibrary>
<VcpkgRuntimeLibrary Condition="'%(ClCompile.RuntimeLibrary)' == 'MultiThreadedDLL'"></VcpkgRuntimeLibrary>
<VcpkgRuntimeLibrary Condition="'%(ClCompile.RuntimeLibrary)' == 'MultiThreaded'">-static</VcpkgRuntimeLibrary>
</PropertyGroup>
<PropertyGroup Condition="'$(Platform)|$(ApplicationType)|$(ApplicationTypeRevision)' == 'Win32||'">
<VcpkgEnabled Condition="'$(VcpkgEnabled)' == ''">true</VcpkgEnabled>
<VcpkgTriplet Condition="'$(VcpkgTriplet)' == ''">x86-windows$(VcpkgRuntimeLibrary)</VcpkgTriplet>
</PropertyGroup>
<Message Text="BeforeCompile: RuntimeLibrary=[%(ClCompile.RuntimeLibrary)]" />
<PropertyGroup Condition="'$(Platform)|$(ApplicationType)|$(ApplicationTypeRevision)' == 'Win32|Windows Store|10.0'">
<VcpkgEnabled Condition="'$(VcpkgEnabled)' == ''">true</VcpkgEnabled>
<VcpkgTriplet Condition="'$(VcpkgTriplet)' == ''">x86-uwp$(VcpkgRuntimeLibrary)</VcpkgTriplet>
</PropertyGroup>
<PropertyGroup Condition="'$(Platform)|$(ApplicationType)|$(ApplicationTypeRevision)' == 'x64||'">
<VcpkgEnabled Condition="'$(VcpkgEnabled)' == ''">true</VcpkgEnabled>
<VcpkgTriplet Condition="'$(VcpkgTriplet)' == ''">x64-windows$(VcpkgRuntimeLibrary)</VcpkgTriplet>
</PropertyGroup>
<PropertyGroup Condition="'$(Platform)|$(ApplicationType)|$(ApplicationTypeRevision)' == 'x64|Windows Store|10.0'">
<VcpkgEnabled Condition="'$(VcpkgEnabled)' == ''">true</VcpkgEnabled>
<VcpkgTriplet Condition="'$(VcpkgTriplet)' == ''">x64-uwp$(VcpkgRuntimeLibrary)</VcpkgTriplet>
</PropertyGroup>
<PropertyGroup Condition="'$(Platform)|$(ApplicationType)|$(ApplicationTypeRevision)' == 'arm|Windows Store|10.0'">
<VcpkgEnabled Condition="'$(VcpkgEnabled)' == ''">true</VcpkgEnabled>
<VcpkgTriplet Condition="'$(VcpkgTriplet)' == ''">arm-uwp$(VcpkgRuntimeLibrary)</VcpkgTriplet>
</PropertyGroup>
<PropertyGroup Condition="'$(VcpkgEnabled)' == 'true'">
<VcpkgConfiguration Condition="'$(VcpkgConfiguration)' == ''">$(Configuration)</VcpkgConfiguration>
<VcpkgRoot Condition="'$(VcpkgRoot)' == ''">$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), .vcpkg-root))\installed\$(VcpkgTriplet)\</VcpkgRoot>
</PropertyGroup>
<Message Text="Selecting VcpkgTriplet: $(VcpkgTriplet)"/>
<Message Text="Selecting VcpkgRoot: $(VcpkgRoot)"/>
<ItemGroup Condition="'$(VcpkgEnabled)' == 'true'">
<ClCompile>
<AdditionalIncludeDirectories>$(VcpkgRoot)include;%(ClCompile.AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
</ItemGroup>
</Target>
<Target Name="VcpkgLinkInputs"
DependsOnTargets="ComputeRCGeneratedLinkInputs;
ComputeManifestGeneratedLinkerInputs;
ComputeCustomBuildOutput;
ComputeCLGeneratedLinkInputs;
ComputeLinkInputsFromProject;
ComputeReferenceLinkInputs;"
BeforeTargets="Link">
<Message Text="LinkInputs: @(Link)" />
<ItemGroup Condition="'$(VcpkgEnabled)' == 'true'">
<VcpkgLink Include="$(VcpkgRoot)debug\lib\*.lib" Condition="'$(VcpkgConfiguration)' == 'Debug'"/>
<VcpkgLink Include="$(VcpkgRoot)lib\*.lib" Condition="'$(VcpkgConfiguration)' == 'Release'"/>
<Link>
<AdditionalDependencies>@(VcpkgLink);%(Link.AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemGroup>
<Message Text="VcpkgLinkInputs: @(VcpkgLink)" />
</Target>
<PropertyGroup>
<ComputeLinkInputsTargets >$(ComputeLinkInputsTargets);VcpkgLinkInputs</ComputeLinkInputsTargets >
</PropertyGroup>
<Target Name="AppLocalFromInstalled" AfterTargets="CopyFilesToOutputDirectory" BeforeTargets="CopyLocalFilesOutputGroup" Condition="'$(VcpkgEnabled)' == 'true' and '$(OutputType)' == 'exe'">
<WriteLinesToFile
File="$(TLogLocation)$(ProjectName).write.1u.tlog"
Lines="^$(OutputPath)$(TargetName).$(OutputType);" Encoding="Unicode"/>
<Exec Condition="'$(VcpkgConfiguration)' == 'Debug'"
Command="powershell.exe -ExecutionPolicy Unrestricted -noprofile -File %22$(MSBuildThisFileDirectory)applocal.ps1%22 %22$(OutputPath)$(TargetName).$(OutputType)%22 %22$(VcpkgRoot)debug\bin%22 %22$(TLogLocation)$(ProjectName).write.1u.tlog%22"
ConsoleToMSBuild="true">
<Output TaskParameter="ConsoleOutput" ItemName="ReferenceCopyLocalPaths" />
</Exec>
<Exec Condition="'$(VcpkgConfiguration)' == 'Release'"
Command="powershell.exe -ExecutionPolicy Unrestricted -noprofile -File %22$(MSBuildThisFileDirectory)applocal.ps1%22 %22$(OutputPath)$(TargetName).$(OutputType)%22 %22$(VcpkgRoot)bin%22 %22$(TLogLocation)$(ProjectName).write.1u.tlog%22"
ConsoleToMSBuild="true">
<Output TaskParameter="ConsoleOutput" ItemName="ReferenceCopyLocalPaths" />
</Exec>
</Target>
</Project>