Use WiX directly rather than via WiX's MSBuild
Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
parent
03f356c492
commit
fa715c4863
@ -111,8 +111,20 @@
|
||||
<CodeAnalysisRuleSet>NativeRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<RunCodeAnalysis>true</RunCodeAnalysis>
|
||||
<LocalDebuggerCommand>rundll32.exe</LocalDebuggerCommand>
|
||||
<LocalDebuggerCommandArguments>..\$(WintunPlatform)\$(Configuration)\installer.dll,InstallWintun</LocalDebuggerCommandArguments>
|
||||
<LocalDebuggerCommandArguments>$(OutDir)$(TargetName)$(TargetExt),InstallWintun</LocalDebuggerCommandArguments>
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
<WixArch Condition="'$(Platform)'=='Win32'">x86</WixArch>
|
||||
<WixArch Condition="'$(Platform)'=='x64'">x64</WixArch>
|
||||
<WixArch Condition="'$(Platform)'=='ARM64'">arm64</WixArch>
|
||||
<WixCandleFlags>$(WixCandleFlags) -nologo -arch $(WixArch) -dWINTUN_PLATFORM=$(WintunPlatform) -dWINTUN_VERSION=$(WintunVersion) -sw1086</WixCandleFlags>
|
||||
<WixLightFlags>$(WixLightFlags) -nologo -b output_dir="$(OutDir.TrimEnd('\'))" -spdb -sw1076 -sw1079</WixLightFlags>
|
||||
<WixOutputPath>$(OutDir)</WixOutputPath>
|
||||
<WixOutputName>wintun</WixOutputName>
|
||||
<WixOutputExt>.msm</WixOutputExt>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Release'">
|
||||
<WixOutputPath>..\$(DistributionDir)</WixOutputPath>
|
||||
<WixOutputName>wintun-$(WintunPlatform)-$(WintunVersionStr)</WixOutputName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
@ -171,7 +183,6 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="exports.def" />
|
||||
<None Include="installer.wixproj" />
|
||||
<None Include="installer.wxs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
@ -182,7 +193,9 @@
|
||||
<SigningCertificate Condition="$(SignMode)=='TestSign' And '$(TestCertificate)'!=''">$(TestCertificate)</SigningCertificate>
|
||||
<SigningCertificate Condition="$(SignMode)=='ProductionSign' And '$(ProductionCertificate)'!=''">$(ProductionCertificate)</SigningCertificate>
|
||||
<BuildDependsOn Condition="'$(SigningCertificate)'!='' And '$(TimeStampServer)'!=''">$(BuildDependsOn);SignTarget</BuildDependsOn>
|
||||
<CleanDependsOn>CleanSignTarget;$(CleanDependsOn)</CleanDependsOn>
|
||||
<MSMDependsOn>$(MSMDependsOn);WixCompile;WixLink</MSMDependsOn>
|
||||
<MSMDependsOn Condition="'$(SigningCertificate)'!='' And '$(TimeStampServer)'!=''">$(MSMDependsOn);WixSign</MSMDependsOn>
|
||||
<CleanDependsOn>CleanSignTarget;WixClean;$(CleanDependsOn)</CleanDependsOn>
|
||||
</PropertyGroup>
|
||||
<Target Name="SignTarget" Inputs="$(TargetPath)" Outputs="$(IntermediateOutputPath)$(TargetName).sign">
|
||||
<Exec Command=""$(SignToolPath)" sign /sha1 "$(SigningCertificate)" /fd sha256 /tr "$(TimeStampServer)" /td sha256 "$(TargetPath)"" />
|
||||
@ -191,4 +204,26 @@
|
||||
<Target Name="CleanSignTarget">
|
||||
<Delete Files="$(IntermediateOutputPath)$(TargetName).sign" />
|
||||
</Target>
|
||||
<Target Name="HashInstallerLibrary" DependsOnTargets="Build">
|
||||
<GetFileHash Files="$(OutDir)$(TargetName)$(TargetExt)" Algorithm="SHA256" HashEncoding="hex">
|
||||
<Output TaskParameter="Items" ItemName="InstallerLibraryHash" />
|
||||
</GetFileHash>
|
||||
<PropertyGroup>
|
||||
<WixCandleFlags>$(WixCandleFlags) -dINSTALLER_LIBRARY_HASH=@(InstallerLibraryHash->Metadata('FileHash')) -dINSTALLER_LIBRARY_TIME=$([System.IO.File]::GetLastWriteTime('$(OutDir)$(TargetName)$(TargetExt)').Ticks)</WixCandleFlags>
|
||||
</PropertyGroup>
|
||||
</Target>
|
||||
<Target Name="WixCompile" DependsOnTargets="HashInstallerLibrary" Inputs="installer.wxs" Outputs="$(IntDir)installer.wixobj">
|
||||
<Exec Command=""$(WIX)bin\candle.exe" $(WixCandleFlags) -out "$(IntDir)installer.wixobj" installer.wxs" />
|
||||
</Target>
|
||||
<Target Name="WixLink" DependsOnTargets="Build;WixCompile" Inputs="$(IntDir)installer.wixobj;$(OutDir)$(TargetName)$(TargetExt)" Outputs="$(WixOutputPath)$(WixOutputName)$(WixOutputExt)">
|
||||
<Exec Command=""$(WIX)bin\light.exe" $(WixLightFlags) -out "$(WixOutputPath)$(WixOutputName)$(WixOutputExt)" "$(IntDir)installer.wixobj"" />
|
||||
</Target>
|
||||
<Target Name="WixSign" DependsOnTargets="WixLink" Inputs="$(WixOutputPath)$(WixOutputName)$(WixOutputExt)" Outputs="$(IntDir)$(WixOutputName).sign">
|
||||
<Exec Command=""$(SignToolPath)" sign /sha1 "$(SigningCertificate)" /fd sha256 /tr "$(TimeStampServer)" /td sha256 "$(WixOutputPath)$(WixOutputName)$(WixOutputExt)"" />
|
||||
<Touch Files="$(IntDir)$(WixOutputName).sign" AlwaysCreate="true" />
|
||||
</Target>
|
||||
<Target Name="WixClean">
|
||||
<Delete Files="$(IntDir)installer.wixobj;$(WixOutputPath)$(WixOutputName)$(WixOutputExt);$(IntDir)$(WixOutputName).sign" />
|
||||
</Target>
|
||||
<Target Name="MSM" DependsOnTargets="$(MSMDependsOn)" />
|
||||
</Project>
|
@ -42,9 +42,6 @@
|
||||
<None Include="exports.def">
|
||||
<Filter>Source Files</Filter>
|
||||
</None>
|
||||
<None Include="installer.wixproj">
|
||||
<Filter>MSM</Filter>
|
||||
</None>
|
||||
<None Include="installer.wxs">
|
||||
<Filter>MSM</Filter>
|
||||
</None>
|
||||
|
@ -1,76 +0,0 @@
|
||||
<?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;HashInstallerLibrary"
|
||||
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>
|
||||
<SuppressSpecificWarnings>1006;1086;$(SuppressSpecificWarnings)</SuppressSpecificWarnings>
|
||||
<LinkerSuppressSpecificWarnings>1079;1103;$(LinkerSuppressSpecificWarnings)</LinkerSuppressSpecificWarnings>
|
||||
<SuppressIces>ICE30;ICE49;$(SuppressIces)</SuppressIces>
|
||||
<LinkerAdditionalOptions>-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="installer.wxs" />
|
||||
</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>
|
||||
|
||||
<Target Name="HashInstallerLibrary">
|
||||
<GetFileHash Files="$(IntermediateOutputPath)installer.dll" Algorithm="SHA256" HashEncoding="hex">
|
||||
<Output TaskParameter="Items" ItemName="InstallerLibraryHash" />
|
||||
</GetFileHash>
|
||||
<PropertyGroup>
|
||||
<DefineConstants>$(DefineConstants);INSTALLER_LIBRARY_HASH=@(InstallerLibraryHash->Metadata('FileHash'));INSTALLER_LIBRARY_TIME=$([System.IO.File]::GetLastWriteTime('$(IntermediateOutputPath)installer.dll').Ticks)</DefineConstants>
|
||||
</PropertyGroup>
|
||||
</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>
|
||||
<BuildDependsOn Condition="'$(SigningCertificate)'!='' And '$(TimeStampServer)'!=''">$(BuildDependsOn);SignTarget</BuildDependsOn>
|
||||
<CleanDependsOn>CleanSignTarget;$(CleanDependsOn)</CleanDependsOn>
|
||||
</PropertyGroup>
|
||||
<Target
|
||||
Name="SignTarget"
|
||||
Inputs="$(TargetPath)"
|
||||
Outputs="$(IntermediateOutputPath)$(TargetName).sign">
|
||||
<Exec Command=""$(SignToolPath)" sign /sha1 "$(SigningCertificate)" /fd sha256 /tr "$(TimeStampServer)" /td sha256 "$(TargetPath)"" />
|
||||
<Touch Files="$(IntermediateOutputPath)$(TargetName).sign" AlwaysCreate="true" />
|
||||
</Target>
|
||||
<Target Name="CleanSignTarget">
|
||||
<Delete Files="$(IntermediateOutputPath)$(TargetName).sign" />
|
||||
</Target>
|
||||
</Project>
|
@ -38,7 +38,7 @@
|
||||
<Custom Action="ProcessWintun" After="InstallFiles" />
|
||||
</InstallExecuteSequence>
|
||||
|
||||
<?if $(var.Platform) = "x86"?>
|
||||
<?if $(var.WINTUN_PLATFORM) = "x86"?>
|
||||
<CustomAction Id="WoW64Unsupported" Error="You are attempting to install the 32-bit variant of [ProductName] on a 64-bit operating system, which is not supported. Please install the 64-bit variant instead." />
|
||||
<InstallExecuteSequence>
|
||||
<Custom Action="WoW64Unsupported" After="LaunchConditions"><![CDATA[VersionNT64]]></Custom>
|
||||
|
28
wintun.proj
28
wintun.proj
@ -47,22 +47,6 @@
|
||||
<MSBuild Projects="wintun.vcxproj" Targets="Build" Properties="Configuration=Release;Platform=ARM64" />
|
||||
</Target>
|
||||
|
||||
<!--
|
||||
installer.dll Building
|
||||
-->
|
||||
<Target Name="Installer-x86"
|
||||
Outputs="x86\Release\installer.dll">
|
||||
<MSBuild Projects="installer\installer.vcxproj" Targets="Build" Properties="Configuration=Release;Platform=Win32" />
|
||||
</Target>
|
||||
<Target Name="Installer-amd64"
|
||||
Outputs="amd64\Release\installer.dll">
|
||||
<MSBuild Projects="installer\installer.vcxproj" Targets="Build" Properties="Configuration=Release;Platform=x64" />
|
||||
</Target>
|
||||
<Target Name="Installer-arm64"
|
||||
Outputs="arm64\Release\installer.dll">
|
||||
<MSBuild Projects="installer\installer.vcxproj" Targets="Build" Properties="Configuration=Release;Platform=ARM64" />
|
||||
</Target>
|
||||
|
||||
<!--
|
||||
Static Driver Verifier
|
||||
-->
|
||||
@ -85,12 +69,16 @@
|
||||
<!--
|
||||
MSM Building
|
||||
-->
|
||||
<Target Name="MSM-x86" DependsOnTargets="Installer-x86"
|
||||
<Target Name="MSM-x86"
|
||||
Outputs="$(DistributionDir)wintun-x86-$(WintunVersionStr).msm">
|
||||
<MSBuild Projects="installer/installer.wixproj" Targets="Build" Properties="Configuration=Release;Platform=x86" />
|
||||
<MSBuild Projects="installer\installer.vcxproj" Targets="MSM" Properties="Configuration=Release;Platform=Win32" />
|
||||
</Target>
|
||||
<Target Name="MSM-amd64" DependsOnTargets="Installer-amd64"
|
||||
<Target Name="MSM-amd64"
|
||||
Outputs="$(DistributionDir)wintun-amd64-$(WintunVersionStr).msm">
|
||||
<MSBuild Projects="installer/installer.wixproj" Targets="Build" Properties="Configuration=Release;Platform=x64" />
|
||||
<MSBuild Projects="installer\installer.vcxproj" Targets="MSM" Properties="Configuration=Release;Platform=x64" />
|
||||
</Target>
|
||||
<Target Name="MSM-ARM64"
|
||||
Outputs="$(DistributionDir)wintun-arm64-$(WintunVersionStr).msm">
|
||||
<MSBuild Projects="installer\installer.vcxproj" Targets="MSM" Properties="Configuration=Release;Platform=ARM64" />
|
||||
</Target>
|
||||
</Project>
|
||||
|
@ -11,8 +11,7 @@
|
||||
<WintunVersionStr>0.6</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>
|
||||
<!-- .vcxproj are using different platform names. -->
|
||||
<WintunPlatform Condition="'$(Platform)'=='Win32'">x86</WintunPlatform>
|
||||
<WintunPlatform Condition="'$(Platform)'=='x64'">amd64</WintunPlatform>
|
||||
<WintunPlatform Condition="'$(Platform)'=='ARM64'">arm64</WintunPlatform>
|
||||
|
Loading…
Reference in New Issue
Block a user