aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rozman <simon@rozman.si>2019-04-19 15:24:39 +0200
committerSimon Rozman <simon@rozman.si>2019-04-19 15:25:44 +0200
commit9f31f278400570d949b85350290753cdeea30a9c (patch)
tree043e6aa1cdb99d7ad9558669238b44a296e111d0
parentMakefile: use more standard output filenames for msm (diff)
downloadwintun-9f31f278400570d949b85350290753cdeea30a9c.tar.xz
wintun-9f31f278400570d949b85350290753cdeea30a9c.zip
Switch from NMake to MSBuild
This allows common version and other configuration in wintun.props. - MSM packaging migrated to WiX MSBuild project and extended to support digital signing - Building supports single Platform|Configuration per run - again :( - wintun.vcxproj cleanup Signed-off-by: Simon Rozman <simon@rozman.si>
Diffstat (limited to '')
-rw-r--r--.editorconfig6
-rw-r--r--Makefile57
-rw-r--r--Makefile.PlatCfg.mak43
-rw-r--r--README.md22
-rw-r--r--wintun.proj100
-rw-r--r--wintun.props23
-rw-r--r--wintun.vcxproj50
-rw-r--r--wintun.wixproj70
8 files changed, 228 insertions, 143 deletions
diff --git a/.editorconfig b/.editorconfig
index ddceb3c..3ca70e6 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -1,2 +1,6 @@
-[*.{c,h,inf}]
+[*.{c,h,inf,rc,wxs}]
indent_style = tab
+
+[*.{proj,props,vcxproj,wixproj}]
+indent_style = space
+indent_size = 2
diff --git a/Makefile b/Makefile
deleted file mode 100644
index e0c8318..0000000
--- a/Makefile
+++ /dev/null
@@ -1,57 +0,0 @@
-#
-# SPDX-License-Identifier: GPL-2.0
-#
-# Copyright (C) 2018-2019 WireGuard LLC. All Rights Reserved.
-#
-
-# TODO: Unify version definition with wintun.vcxproj. Migrate from NMAKE to MSBuild?
-WINTUN_VERSION=0.1
-
-DIST_DIR=dist
-MSBUILD_FLAGS=/m /v:minimal /nologo
-WIX_CANDLE_FLAGS=-nologo -ext WixDifxAppExtension -ext WixIIsExtension -dWINTUN_VERSION="$(WINTUN_VERSION)"
-WIX_LIGHT_FLAGS=-nologo -ext WixDifxAppExtension -ext WixIIsExtension -sw1103
-
-build :: \
- build_x86_Release \
- build_amd64_Release \
- build_arm64_Release
-
-dvl :: "wintun.DVL.XML"
-
-msm :: \
- "$(DIST_DIR)" \
- "$(DIST_DIR)\wintun-x86-$(WINTUN_VERSION).msm" \
- "$(DIST_DIR)\wintun-amd64-$(WINTUN_VERSION).msm"
-
-"sdv\SDV.DVL.xml" "amd64\Release\vc.nativecodeanalysis.all.xml" :
- msbuild.exe "wintun.vcxproj" /t:sdv /p:Inputs="/check:*" /p:Configuration="Release" /p:Platform="x64" $(MSBUILD_FLAGS)
-
-"wintun.DVL.XML" : "sdv\SDV.DVL.xml" "amd64\Release\vc.nativecodeanalysis.all.xml"
- msbuild.exe "wintun.vcxproj" /t:dvl /p:Configuration="Release" /p:Platform="x64" $(MSBUILD_FLAGS)
-
-"$(DIST_DIR)" :
- md $@ > NUL 2>&1
-
-clean ::
- -rd /s /q "sdv" > NUL 2>&1
- -del /f /q "wintun.DVL.XML" > NUL 2>&1
- -del /f /q "smvbuild.log" > NUL 2>&1
- -del /f /q "smvstats.txt" > NUL 2>&1
- -rd /s /q "$(DIST_DIR)" > NUL 2>&1
-
-CFG=Release
-PLAT=x86
-!INCLUDE "Makefile.PlatCfg.mak"
-PLAT=amd64
-!INCLUDE "Makefile.PlatCfg.mak"
-PLAT=arm64
-!INCLUDE "Makefile.PlatCfg.mak"
-
-CFG=Debug
-PLAT=x86
-!INCLUDE "Makefile.PlatCfg.mak"
-PLAT=amd64
-!INCLUDE "Makefile.PlatCfg.mak"
-PLAT=arm64
-!INCLUDE "Makefile.PlatCfg.mak"
diff --git a/Makefile.PlatCfg.mak b/Makefile.PlatCfg.mak
deleted file mode 100644
index 60a472a..0000000
--- a/Makefile.PlatCfg.mak
+++ /dev/null
@@ -1,43 +0,0 @@
-#
-# SPDX-License-Identifier: GPL-2.0
-#
-# Copyright (C) 2018-2019 WireGuard LLC. All Rights Reserved.
-#
-
-!IF "$(PLAT)" == "x86"
-PLAT_MSBUILD=Win32
-PLAT_WIX=x86
-!ELSEIF "$(PLAT)" == "amd64"
-PLAT_MSBUILD=x64
-PLAT_WIX=x64
-!ELSEIF "$(PLAT)" == "arm64"
-PLAT_MSBUILD=ARM64
-PLAT_WIX=arm64 # TODO: Follow WiX ARM64 support.
-!ELSE
-!ERROR Invalid platform "$(PLAT)". PLAT must be "x86", "amd64", or "arm64".
-!ENDIF
-
-OUTPUT_DIR=$(PLAT)\$(CFG)
-
-build_$(PLAT)_$(CFG) ::
- msbuild.exe "wintun.vcxproj" /t:Build /p:Configuration="$(CFG)" /p:Platform="$(PLAT_MSBUILD)" $(MSBUILD_FLAGS)
-
-clean ::
- -rd /s /q "$(OUTPUT_DIR)" > NUL 2>&1
-
-!IF "$(CFG)" == "Release"
-
-"$(OUTPUT_DIR)\wintun.wixobj" : "wintun.wxs"
- "$(WIX)bin\candle.exe" $(WIX_CANDLE_FLAGS) -arch "$(PLAT_WIX)" -out $@ $**
-
-"$(DIST_DIR)\wintun-$(PLAT)-$(WINTUN_VERSION).msm" : \
- "$(DIST_DIR)" \
- "$(OUTPUT_DIR)\wintun.cer" \
- "$(OUTPUT_DIR)\wintun\wintun.cat" \
- "$(OUTPUT_DIR)\wintun\wintun.inf" \
- "$(OUTPUT_DIR)\wintun\wintun.sys" \
- "$(OUTPUT_DIR)\wintun.wixobj" \
- "$(WIX)bin\difxapp_$(PLAT_WIX).wixlib"
- "$(WIX)bin\light.exe" $(WIX_LIGHT_FLAGS) -b output_dir="$(OUTPUT_DIR)" -out $@ -spdb "$(OUTPUT_DIR)\wintun.wixobj" "$(WIX)bin\difxapp_$(PLAT_WIX).wixlib"
-
-!ENDIF
diff --git a/README.md b/README.md
index 2db1beb..34ef9ab 100644
--- a/README.md
+++ b/README.md
@@ -37,18 +37,22 @@ If you already have `wintun.vcxproj.user` file, just add the `<PropertyGroup>` s
Open _Developer Command Prompt for VS 2017_ and use the `nmake` command:
```
-nmake [<target>]
+msbuild wintun.proj [/t:<target>] [/p:Configuration=<configuration>] [/p:Platform=<platform>]
```
### Targets
- - `build`: Builds the driver. This is the default target.
+ - `Build`: Builds the driver. This is the default target.
- - `clean`: Deletes all intermediate and output files.
+ - `Clean`: Deletes all intermediate and output files.
- - `dvl`: Runs Static Driver Verifier, which includes a clean driver build, and creates a Driver Verification Log in `wintun.DVL.XML` file. When you are ready to test your driver using the Windows Hardware Certification Kit (HCK), you need to copy the `wintun.DVL.XML` file to the `%SystemDrive%\DVL` directory on the test computer.
+ - `Rebuild`: Alias for `Clean` followed by `Build`.
- - `msm`: Builds Microsoft Installer Merge Module in `<output folder>\wintun.msm`. This target requires the driver to be built first (e.g. `nmake build msm` or `nmake dvl msm`).
+ - `SDV`: Runs Static Driver Verifier, which includes a clean driver build. Release configurations only.
+
+ - `DVL`: Runs the `SDV`, and creates a Driver Verification Log in `wintun.DVL.XML` file. Release configurations only. When you are ready to test your driver using the Windows Hardware Certification Kit (HCK), you need to copy the `wintun.DVL.XML` file to the `%SystemDrive%\DVL` directory on the test computer.
+
+ - `MSM`: Builds Microsoft Installer Merge Module in `<output folder>\wintun-<platform>-<version>.msm`.
The driver output folder is:
@@ -61,6 +65,14 @@ AMD64 Release | `amd64\Release\wintun`
ARM64 Debug | `arm64\Debug\wintun`
ARM64 Release | `arm64\Release\wintun`
+### Properties
+
+Properties may be defined as environment variables, or specified on the `msbuild` command line.
+
+ - `Configuration`: Specifies configuration to build or clean. May be `Debug` or `Release` (default).
+
+ - `Platform`: Specifies driver platform to build. May be `x86` or `amd64` (default), or `arm64`.
+
## Usage
diff --git a/wintun.proj b/wintun.proj
new file mode 100644
index 0000000..344fa73
--- /dev/null
+++ b/wintun.proj
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ SPDX-License-Identifier: MIT
+
+ Copyright (C) 2019 WireGuard LLC. All Rights Reserved.
+-->
+<Project
+ xmlns="http://schemas.microsoft.com/developer/msbuild/2003"
+ DefaultTargets="Build">
+
+ <!--
+ General Properties
+ -->
+ <PropertyGroup>
+ <Configuration Condition="'$(Configuration)' == ''">Release</Configuration>
+ <Platform Condition="'$(Platform)' == ''">amd64</Platform>
+ <OutputDir>$(Platform)\$(Configuration)\</OutputDir>
+ </PropertyGroup>
+
+ <Import Project="wintun.props"/>
+ <Import Project="wintun.vcxproj.user" Condition="exists('wintun.vcxproj.user')"/>
+
+ <PropertyGroup Condition="'$(Platform)' == 'x86'">
+ <MSBuildPlatform>Win32</MSBuildPlatform>
+ <WiXPlatform>x86</WiXPlatform>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Platform)' == 'amd64'">
+ <MSBuildPlatform>x64</MSBuildPlatform>
+ <WiXPlatform>x64</WiXPlatform>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Platform)' == 'arm64'">
+ <MSBuildPlatform>ARM64</MSBuildPlatform>
+ <WiXPlatform>arm64</WiXPlatform> <!-- TODO: Follow WiX ARM64 support. -->
+ </PropertyGroup>
+
+ <Target Name="Build" DependsOnTargets="Driver"/>
+ <Target Name="Clean">
+ <RemoveDir Directories="$(OutputDir)"/>
+ <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.
+ -->
+ <Target Name="Driver"
+ Outputs="$(OutputDir)wintun\wintun.sys;$(OutputDir)wintun\wintun.inf;$(OutputDir)wintun\wintun.cat"
+ Inputs="wintun.c;wintun.vcxproj">
+ <MSBuild
+ Projects="wintun.vcxproj"
+ Targets="Build"
+ Properties="Configuration=$(Configuration);Platform=$(MSBuildPlatform)"/>
+ </Target>
+
+ <!--
+ Static Driver Verifier
+ -->
+ <Target Name="SDV"
+ Outputs="$(SDVDir)SDV.DVL.xml;$(OutputDir)vc.nativecodeanalysis.all.xml">
+ <MSBuild
+ Projects="wintun.vcxproj"
+ Targets="sdv"
+ Properties="Inputs=/check:*;Configuration=$(Configuration);Platform=$(MSBuildPlatform)"/>
+ </Target>
+
+ <!--
+ Driver Verification Log
+ -->
+ <Target Name="DVL"
+ DependsOnTargets="SDV"
+ Outputs="wintun.DVL.XML"
+ Inputs="$(SDVDir)SDV.DVL.xml;$(OutputDir)vc.nativecodeanalysis.all.xml">
+ <MSBuild
+ Projects="wintun.vcxproj"
+ Targets="dvl"
+ Properties="Configuration=$(Configuration);Platform=$(MSBuildPlatform)"/>
+ </Target>
+
+ <!--
+ MSM Building
+ -->
+ <PropertyGroup>
+ <MSMDir>$(DistributionDir)</MSMDir>
+ <MSMName>wintun-$(WintunPlatform)-$(WintunVersionStr)</MSMName>
+ <MSMExt>.msm</MSMExt>
+ <MSMFileName>$(MSMName)$(MSMExt)</MSMFileName>
+ <MSMPath>$(MSMDir)$(MSMFileName)</MSMPath>
+ </PropertyGroup>
+ <Target Name="MSM"
+ DependsOnTargets="Build"
+ Outputs="$(MSMPath)">
+ <MSBuild
+ Projects="wintun.wixproj"
+ Targets="Build"
+ Properties="Configuration=$(Configuration);Platform=$(WiXPlatform)"/>
+ </Target>
+</Project>
diff --git a/wintun.props b/wintun.props
new file mode 100644
index 0000000..4ad435c
--- /dev/null
+++ b/wintun.props
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ SPDX-License-Identifier: MIT
+
+ Copyright (C) 2019 WireGuard LLC. All Rights Reserved.
+-->
+<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <WintunVersionMaj>0</WintunVersionMaj>
+ <WintunVersionMin>1</WintunVersionMin>
+ <WintunVersionStr>0.1</WintunVersionStr><!-- Used in filenames and ProductVersion resource string, may contain strings. -->
+ <WintunVersion>$(WintunVersionMaj).$(WintunVersionMin)</WintunVersion><!-- Used for versioning, must be n.n[.n[.n]]. -->
+
+ <!-- .vcxproj and .wixproj are using different platform names. -->
+ <WintunPlatform Condition="'$(Platform)'=='x86'">x86</WintunPlatform>
+ <WintunPlatform Condition="'$(Platform)'=='Win32'">x86</WintunPlatform>
+ <WintunPlatform Condition="'$(Platform)'=='x64'">amd64</WintunPlatform>
+ <WintunPlatform Condition="'$(Platform)'=='ARM64'">arm64</WintunPlatform>
+
+ <DistributionDir>dist\</DistributionDir>
+ <SDVDir>sdv\</SDVDir>
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/wintun.vcxproj b/wintun.vcxproj
index 592a05d..f4f31ed 100644
--- a/wintun.vcxproj
+++ b/wintun.vcxproj
@@ -102,50 +102,26 @@
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
- <PropertyGroup Label="UserMacros">
- <WintunVersionMaj>0</WintunVersionMaj>
- <WintunVersionMin>1</WintunVersionMin>
- <WintunVersionStr>0.1</WintunVersionStr>
- </PropertyGroup>
+ <Import Project="wintun.props" />
+ <PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>15.0.28127.55</_ProjectFileVersion>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <RunCodeAnalysis>true</RunCodeAnalysis>
- <CodeAnalysisRuleSet>$(WDKContentRoot)CodeAnalysis\DriverMustFixRules.ruleset</CodeAnalysisRuleSet>
- <IntDir>x86\$(ConfigurationName)\</IntDir>
- <OutDir>x86\$(ConfigurationName)\</OutDir>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <RunCodeAnalysis>true</RunCodeAnalysis>
- <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
- <IntDir>x86\$(ConfigurationName)\</IntDir>
- <OutDir>x86\$(ConfigurationName)\</OutDir>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <IntDir>$(WintunPlatform)\$(ConfigurationName)\</IntDir>
+ <OutDir>$(WintunPlatform)\$(ConfigurationName)\</OutDir>
<RunCodeAnalysis>true</RunCodeAnalysis>
- <CodeAnalysisRuleSet>$(WDKContentRoot)CodeAnalysis\DriverMustFixRules.ruleset</CodeAnalysisRuleSet>
- <IntDir>amd64\$(ConfigurationName)\</IntDir>
- <OutDir>amd64\$(ConfigurationName)\</OutDir>
</PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
- <RunCodeAnalysis>true</RunCodeAnalysis>
+ <PropertyGroup Condition="'$(Configuration)'=='Release'">
<CodeAnalysisRuleSet>$(WDKContentRoot)CodeAnalysis\DriverMustFixRules.ruleset</CodeAnalysisRuleSet>
- <IntDir>arm64\$(ConfigurationName)\</IntDir>
- <OutDir>arm64\$(ConfigurationName)\</OutDir>
</PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <RunCodeAnalysis>true</RunCodeAnalysis>
- <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
- <IntDir>amd64\$(ConfigurationName)\</IntDir>
- <OutDir>amd64\$(ConfigurationName)\</OutDir>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
- <RunCodeAnalysis>true</RunCodeAnalysis>
+ <PropertyGroup Condition="'$(Configuration)'=='Debug'">
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
- <IntDir>arm64\$(ConfigurationName)\</IntDir>
- <OutDir>arm64\$(ConfigurationName)\</OutDir>
</PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" />
<ItemDefinitionGroup>
<ClCompile>
<PreprocessorDefinitions>WINTUN_VERSION_MAJ=$(WintunVersionMaj);WINTUN_VERSION_MIN=$(WintunVersionMin);WINTUN_VERSION_STR="$(WintunVersionStr)";NDIS_MINIPORT_DRIVER=1;NDIS620_MINIPORT=1;NDIS630_MINIPORT=1;NDIS_WDM=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -164,7 +140,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
<Inf>
- <TimeStamp>$(WintunVersionMaj).$(WintunVersionMin)</TimeStamp>
+ <TimeStamp>$(WintunVersion)</TimeStamp>
</Inf>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
diff --git a/wintun.wixproj b/wintun.wixproj
new file mode 100644
index 0000000..7ee76d9
--- /dev/null
+++ b/wintun.wixproj
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ SPDX-License-Identifier: GPL-2.0
+
+ Copyright (C) 2018-2019 WireGuard LLC. All Rights Reserved.
+-->
+<Project
+ xmlns="http://schemas.microsoft.com/developer/msbuild/2003"
+ ToolsVersion="4.0"
+ InitialTargets="EnsureWixToolsetInstalled"
+ DefaultTargets="Build">
+ <PropertyGroup>
+ <Configuration Condition="'$(Configuration)'==''">Release</Configuration>
+ <Platform Condition="'$(Platform)'==''">x64</Platform>
+ <ProjectGuid>{F95A1EBF-1E19-47D4-9D8C-4F0C41B9E3B8}</ProjectGuid>
+ <ProjectName>wintun</ProjectName>
+ <OutputType>Module</OutputType>
+ <DefineSolutionProperties>false</DefineSolutionProperties>
+ </PropertyGroup>
+
+ <Import Project="wintun.props"/>
+
+ <PropertyGroup>
+ <IntermediateOutputPath>$(WintunPlatform)\$(Configuration)\</IntermediateOutputPath>
+ <OutputPath>$(WintunPlatform)\$(Configuration)\</OutputPath>
+ <OutputName>$(ProjectName)</OutputName>
+ <DefineConstants>WINTUN_VERSION=$(WintunVersion);$(DefineConstants)</DefineConstants>
+ <CompilerAdditionalOptions>-ext WixDifxAppExtension -ext WixIIsExtension $(CompilerAdditionalOptions)</CompilerAdditionalOptions>
+ <LinkerSuppressSpecificWarnings>1103;$(LinkerSuppressSpecificWarnings)</LinkerSuppressSpecificWarnings>
+ <LinkerAdditionalOptions>-ext WixDifxAppExtension -ext WixIIsExtension -b output_dir="$(IntermediateOutputPath.TrimEnd('\'))" $(LinkerAdditionalOptions)</LinkerAdditionalOptions>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)'=='Release'">
+ <SuppressPdbOutput>true</SuppressPdbOutput>
+ <OutputPath>$(DistributionDir)</OutputPath>
+ <OutputName>$(ProjectName)-$(WintunPlatform)-$(WintunVersionStr)</OutputName>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <Compile Include="wintun.wxs"/>
+ </ItemGroup>
+ <ItemGroup>
+ <WixLibrary Include="difxapp_$(Platform).wixlib"/>
+ </ItemGroup>
+
+ <Import Project="$(MSBuildProjectName).user" Condition="exists('$(MSBuildProjectName).user')"/>
+ <Import Project="$(WixTargetsPath)" Condition="'$(WixTargetsPath)'!=''"/>
+ <Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets" Condition="'$(WixTargetsPath)'=='' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets')"/>
+ <Target Name="EnsureWixToolsetInstalled" Condition="'$(WixTargetsImported)'!='true'">
+ <Error Text="The WiX Toolset v3.11 (or newer) build tools must be installed to build this project. To download the WiX Toolset, see http://wixtoolset.org/releases/"/>
+ </Target>
+
+ <Import Project="wintun.vcxproj.user" Condition="exists('wintun.vcxproj.user')"/>
+ <PropertyGroup>
+ <SigningCertificate Condition="$(SignMode)=='TestSign' And '$(TestCertificate)'!=''">$(TestCertificate)</SigningCertificate>
+ <SigningCertificate Condition="$(SignMode)=='ProductionSign' And '$(ProductionCertificate)'!=''">$(ProductionCertificate)</SigningCertificate>
+ <AfterBuildDependsOnTargets Condition="'$(SigningCertificate)'!='' And '$(TimeStampServer)'!=''">SignTarget</AfterBuildDependsOnTargets>
+ <BuildDependsOn>$(BuildDependsOn);SignTarget</BuildDependsOn>
+ <CleanDependsOn>CleanSignTarget;$(CleanDependsOn)</CleanDependsOn>
+ </PropertyGroup>
+ <Target
+ Name="SignTarget"
+ Inputs="$(TargetPath)"
+ Outputs="$(IntermediateOutputPath)$(TargetName).sign">
+ <Exec Command="signtool.exe sign /sha1 &quot;$(SigningCertificate)&quot; /fd sha256 /tr &quot;$(TimeStampServer)&quot; /td sha256 /q &quot;$(TargetPath)&quot;" />
+ <Touch Files="$(IntermediateOutputPath)$(TargetName).sign" AlwaysCreate="true"/>
+ </Target>
+ <Target Name="CleanSignTarget">
+ <Delete Files="$(IntermediateOutputPath)$(TargetName).sign"/>
+ </Target>
+</Project>