wintun/wintun.proj
Jason A. Donenfeld 3f843c9aab proj: use less scary caps for zip license file
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2020-11-06 10:44:32 +01:00

129 lines
6.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">
<PropertyGroup>
<Configuration Condition="'$(Configuration)'==''">Release</Configuration>
</PropertyGroup>
<!--
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-arm;Driver-arm64" />
<Target Name="Clean">
<RemoveDir Directories="$(Configuration)\amd64\" />
<RemoveDir Directories="$(Configuration)\arm\" />
<RemoveDir Directories="$(Configuration)\arm64\" />
<RemoveDir Directories="$(Configuration)\x86\" />
<RemoveDir Directories="driver\sdv\;dist\" />
<Delete Files="driver\smvbuild.log;driver\smvstats.txt;driver\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>driver\undocumented.h;driver\wintun.c;driver\wintun.inf;wintun.props;driver\wintun.rc;driver\driver.vcxproj;$(DriverInputs)</DriverInputs>
</PropertyGroup>
<Target Name="Driver-x86"
Outputs="$(Configuration)\x86\wintun\wintun.sys;$(Configuration)\x86\wintun\wintun.inf;$(Configuration)\x86\wintun\wintun.cat"
Inputs="$(DriverInputs)">
<MSBuild Projects="driver\driver.vcxproj" Targets="Build" Properties="Configuration=$(Configuration);Platform=Win32" />
</Target>
<Target Name="Driver-amd64"
Outputs="$(Configuration)\amd64\wintun\wintun.sys;$(Configuration)\amd64\wintun\wintun.inf;$(Configuration)\amd64\wintun\wintun.cat"
Inputs="$(DriverInputs)">
<MSBuild Projects="driver\driver.vcxproj" Targets="Build" Properties="Configuration=$(Configuration);Platform=x64" />
</Target>
<Target Name="Driver-arm"
Outputs="$(Configuration)\arm\wintun\wintun.sys;$(Configuration)\arm\wintun\wintun.inf;$(Configuration)\arm\wintun\wintun.cat"
Inputs="$(DriverInputs)">
<MSBuild Projects="driver\driver.vcxproj" Targets="Build" Properties="Configuration=$(Configuration);Platform=ARM" />
</Target>
<Target Name="Driver-arm64"
Outputs="$(Configuration)\arm64\wintun\wintun.sys;$(Configuration)\arm64\wintun\wintun.inf;$(Configuration)\arm64\wintun\wintun.cat"
Inputs="$(DriverInputs)">
<MSBuild Projects="driver\driver.vcxproj" Targets="Build" Properties="Configuration=$(Configuration);Platform=ARM64" />
</Target>
<!--
Static Driver Verifier
-->
<Target Name="SDV" Outputs="driver\sdv\SDV.DVL.xml;$(Configuration)\amd64\wintun-intermediate\vc.nativecodeanalysis.all.xml">
<Exec WorkingDirectory="driver" Command="msbuild.exe driver.vcxproj /t:sdv /p:Inputs=/check:*;Configuration=$(Configuration);Platform=x64 /nologo" />
</Target>
<Target Name="SDVView">
<Exec WorkingDirectory="driver" Command="msbuild.exe driver.vcxproj /t:sdv /p:Inputs=/view;Configuration=$(Configuration);Platform=x64 /nologo" />
</Target>
<!--
Driver Verification Log
-->
<Target Name="DVL" DependsOnTargets="SDV"
Outputs="driver\wintun.DVL.XML"
Inputs="driver\sdv\SDV.DVL.xml;$(Configuration)\amd64\wintun-intermediate\vc.nativecodeanalysis.all.xml">
<Exec WorkingDirectory="driver" Command="msbuild.exe driver.vcxproj /t:dvl /p:Configuration=$(Configuration);Platform=x64 /nologo" />
</Target>
<!--
wintun.dll Building
-->
<Target Name="Dll-x86"
Outputs="$(Configuration)\x86\wintun.dll"
DependsOnTargets="Dll-amd64;Dll-arm64">
<MSBuild Projects="api\api.vcxproj" Targets="Build" Properties="Configuration=$(Configuration);Platform=Win32" />
</Target>
<Target Name="Dll-amd64"
Outputs="$(Configuration)\amd64\wintun.dll"
DependsOnTargets="Dll-arm64">
<MSBuild Projects="api\api.vcxproj" Targets="Build" Properties="Configuration=$(Configuration);Platform=x64" />
</Target>
<Target Name="Dll-arm"
Outputs="$(Configuration)\arm\wintun.dll"
DependsOnTargets="Dll-arm64">
<MSBuild Projects="api\api.vcxproj" Targets="Build" Properties="Configuration=$(Configuration);Platform=ARM" />
</Target>
<Target Name="Dll-arm64"
Outputs="$(Configuration)\arm64\wintun.dll">
<MSBuild Projects="api\api.vcxproj" Targets="Build" Properties="Configuration=$(Configuration);Platform=ARM64" />
</Target>
<!--
Zip Building
-->
<PropertyGroup>
<ZipTargetPath>dist\wintun-$(WintunVersionStr).zip</ZipTargetPath>
<ZipIntDir>dist\.tmp\</ZipIntDir>
</PropertyGroup>
<ItemGroup>
<ZipFilesSrc Include="COPYING" /><ZipFilesDst Include="$(ZipIntDir)wintun\license.gpl-2.txt" />
<ZipFilesSrc Include="README.md" /><ZipFilesDst Include="$(ZipIntDir)wintun\README.md" />
<ZipFilesSrc Include="api\wintun.h" /><ZipFilesDst Include="$(ZipIntDir)wintun\include\wintun.h" />
<ZipFilesSrc Include="$(Configuration)\amd64\wintun.dll" /><ZipFilesDst Include="$(ZipIntDir)wintun\bin\amd64\wintun.dll" />
<ZipFilesSrc Include="$(Configuration)\arm\wintun.dll" /><ZipFilesDst Include="$(ZipIntDir)wintun\bin\arm\wintun.dll" />
<ZipFilesSrc Include="$(Configuration)\arm64\wintun.dll" /><ZipFilesDst Include="$(ZipIntDir)wintun\bin\arm64\wintun.dll" />
<ZipFilesSrc Include="$(Configuration)\x86\wintun.dll" /><ZipFilesDst Include="$(ZipIntDir)wintun\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>