wintun/wintun.proj
Simon Rozman 10caab8813 api: upgrade Zip building to output SHA256
This allows following the Zip file integrity from immediately after it
is built.

Signed-off-by: Simon Rozman <simon@rozman.si>
2020-10-30 16:51:01 +01:00

121 lines
5.3 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-License-Identifier: GPL-2.0
Copyright (C) 2019 WireGuard LLC. All Rights Reserved.
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<!--
General Properties
-->
<Import Project="wintun.props" />
<Import Project="wintun.vcxproj.user" Condition="exists('wintun.vcxproj.user')" />
<Target Name="Build" DependsOnTargets="Driver-x86;Driver-amd64;Driver-arm64" />
<Target Name="Clean">
<RemoveDir Directories="Release\amd64\" />
<RemoveDir Directories="Release\arm\" />
<RemoveDir Directories="Release\arm64\" />
<RemoveDir Directories="Release\x86\" />
<RemoveDir Directories="$(SDVDir)" />
<RemoveDir Directories="$(DistributionDir)" />
<Delete Files="smvbuild.log;smvstats.txt;wintun.DVL.XML" />
</Target>
<Target Name="Rebuild" DependsOnTargets="Clean;Build" />
<!--
Driver Building
Note: Use explicit Inputs/Outputs as WindowsDriver.Common.targets triggers driver re-packaging and signing on every invocation.
-->
<PropertyGroup>
<DriverInputs>atomic.h;undocumented.h;wintun.c;wintun.inf;wintun.props;wintun.rc;wintun.vcxproj;$(DriverInputs)</DriverInputs>
</PropertyGroup>
<Target Name="Driver-x86"
Outputs="Release\x86\wintun\wintun.sys;Release\x86\wintun\wintun.inf;Release\x86\wintun\wintun.cat"
Inputs="$(DriverInputs)">
<MSBuild Projects="wintun.vcxproj" Targets="Build" Properties="Configuration=Release;Platform=Win32" />
</Target>
<Target Name="Driver-amd64"
Outputs="Release\amd64\wintun\wintun.sys;Release\amd64\wintun\wintun.inf;Release\amd64\wintun\wintun.cat"
Inputs="$(DriverInputs)">
<MSBuild Projects="wintun.vcxproj" Targets="Build" Properties="Configuration=Release;Platform=x64" />
</Target>
<Target Name="Driver-arm64"
Outputs="Release\arm64\wintun\wintun.sys;Release\arm64\wintun\wintun.inf;Release\arm64\wintun\wintun.cat"
Inputs="$(DriverInputs)">
<MSBuild Projects="wintun.vcxproj" Targets="Build" Properties="Configuration=Release;Platform=ARM64" />
</Target>
<!--
Static Driver Verifier
-->
<Target Name="SDV" Outputs="$(SDVDir)SDV.DVL.xml;Release\amd64\vc.nativecodeanalysis.all.xml">
<MSBuild Projects="wintun.vcxproj" Targets="sdv" Properties="Inputs=/check:*;Configuration=Release;Platform=x64" />
</Target>
<Target Name="SDVView">
<MSBuild Projects="wintun.vcxproj" Targets="sdv" Properties="Inputs=/view;Configuration=Release;Platform=x64" />
</Target>
<!--
Driver Verification Log
-->
<Target Name="DVL" DependsOnTargets="SDV"
Outputs="wintun.DVL.XML"
Inputs="$(SDVDir)SDV.DVL.xml;Release\amd64\vc.nativecodeanalysis.all.xml">
<MSBuild Projects="wintun.vcxproj" Targets="dvl" Properties="Configuration=Release;Platform=x64" />
</Target>
<!--
wintun.dll Building
-->
<Target Name="Dll-x86"
Outputs="Release\x86\wintun.dll"
DependsOnTargets="Dll-amd64;Dll-arm64">
<MSBuild Projects="api\api.vcxproj" Targets="Build" Properties="Configuration=Release;Platform=Win32" />
</Target>
<Target Name="Dll-amd64"
Outputs="Release\amd64\wintun.dll">
<MSBuild Projects="api\api.vcxproj" Targets="Build" Properties="Configuration=Release;Platform=x64" />
</Target>
<Target Name="Dll-arm"
Outputs="Release\arm\wintun.dll"
DependsOnTargets="Dll-arm64">
<MSBuild Projects="api\api.vcxproj" Targets="Build" Properties="Configuration=Release;Platform=ARM" />
</Target>
<Target Name="Dll-arm64"
Outputs="Release\arm64\wintun.dll">
<MSBuild Projects="api\api.vcxproj" Targets="Build" Properties="Configuration=Release;Platform=ARM64" />
</Target>
<!--
Zip Building
-->
<PropertyGroup>
<ZipTargetPath>$(DistributionDir)wintun-$(WintunVersionStr).zip</ZipTargetPath>
<ZipIntDir>$(DistributionDir).tmp\</ZipIntDir>
</PropertyGroup>
<ItemGroup>
<ZipFilesSrc Include="COPYING" /><ZipFilesDst Include="$(ZipIntDir)COPYING" />
<ZipFilesSrc Include="README.md" /><ZipFilesDst Include="$(ZipIntDir)README.md" />
<ZipFilesSrc Include="api\wintun.h" /><ZipFilesDst Include="$(ZipIntDir)include\wintun.h" />
<ZipFilesSrc Include="Release\amd64\wintun.dll" /><ZipFilesDst Include="$(ZipIntDir)bin\amd64\wintun.dll" />
<ZipFilesSrc Include="Release\arm\wintun.dll" /><ZipFilesDst Include="$(ZipIntDir)bin\arm\wintun.dll" />
<ZipFilesSrc Include="Release\arm64\wintun.dll" /><ZipFilesDst Include="$(ZipIntDir)bin\arm64\wintun.dll" />
<ZipFilesSrc Include="Release\x86\wintun.dll" /><ZipFilesDst Include="$(ZipIntDir)bin\x86\wintun.dll" />
</ItemGroup>
<Target Name="Zip"
Inputs="@(ZipFilesSrc)"
Outputs="$(ZipTargetPath)"
DependsOnTargets="Dll-x86;Dll-amd64;Dll-arm;Dll-arm64">
<RemoveDir Directories="$(ZipIntDir)" />
<Copy SourceFiles="@(ZipFilesSrc)" DestinationFiles="@(ZipFilesDst)" />
<ZipDirectory DestinationFile="$(ZipTargetPath)" Overwrite="true" SourceDirectory="$(ZipIntDir)" />
<RemoveDir Directories="$(ZipIntDir)" />
<GetFileHash Files="$(ZipTargetPath)" Algorithm="SHA256" HashEncoding="hex">
<Output TaskParameter="Items" ItemName="InstallerLibraryHash" />
</GetFileHash>
<Message Text="SHA256(&quot;$(ZipTargetPath)&quot;) = @(InstallerLibraryHash->Metadata('FileHash')->ToLower())"/>
</Target>
</Project>