Files
ViGEmBus/setup/Product.wxs
2020-12-14 14:12:53 +01:00

156 lines
6.9 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<!-- https://stackoverflow.com/a/18630847 -->
<?if $(var.Platform) = x64 ?>
<?define Win64 = "yes" ?>
<?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?>
<?define ArchDir = "x64" ?>
<?define WixQuietExec="WixQuietExec64"?>
<?else ?>
<?define Win64 = "no" ?>
<?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?>
<?define ArchDir = "x86" ?>
<?define WixQuietExec="WixQuietExec"?>
<?endif ?>
<!-- change build flow if running under CI -->
<?ifdef env.APPVEYOR?>
<?define IsCI = "yes" ?>
<?else ?>
<?define IsCI = "no" ?>
<?endif ?>
<!-- use driver file version for installer -->
<?define VERSION = "!(bind.FileVersion.ViGEmBus.sys)" ?>
<!-- basic product properties -->
<Product Id="*" Name="Nefarius Virtual Gamepad Emulation Bus Driver" Language="1033" Version="$(var.VERSION)"
Manufacturer="Nefarius Software Solutions e.U."
UpgradeCode="0A4A02DE-0BE3-4BF4-91F0-1EA47AD26881">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<!-- use single MSI file only -->
<MediaTemplate EmbedCab="yes" />
<!-- set setup icon and uninstall options -->
<Icon Id="ViGEm.ico" SourceFile="ViGEm.ico" />
<Property Id="ARPPRODUCTICON" Value="ViGEm.ico" />
<Property Id="ARPURLINFOABOUT" Value="https://github.com/ViGEm/ViGEmBus" />
<Property Id="ARPNOREPAIR" Value="yes" Secure="yes" />
<!-- always perform major upgrade and remove previous versions -->
<Property Id="PREVIOUSVERSIONSINSTALLED" Secure="yes" />
<Upgrade Id="0A4A02DE-0BE3-4BF4-91F0-1EA47AD26881">
<UpgradeVersion
Minimum="1.0.0.0" Maximum="$(var.VERSION)"
Property="PREVIOUSVERSIONSINSTALLED"
IncludeMinimum="yes" IncludeMaximum="no" />
</Upgrade>
<!-- don't allow downgrades -->
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<!-- https://stackoverflow.com/a/31991006 -->
<Property Id="WIN10FOUND">
<DirectorySearch Id="searchSystem" Path="[SystemFolder]" Depth="0">
<FileSearch Id="searchFile" Name="advapi32.dll" MinVersion="6.3.10000.0"/>
</DirectorySearch>
</Property>
<!-- https://stackoverflow.com/a/23061358 -->
<Condition Message="This application can only be installed on Windows 10.">
<![CDATA[WIN10FOUND]]>
</Condition>
<!-- write version value to registry -->
<DirectoryRef Id="TARGETDIR">
<Component Id="RegistryEntries" Guid="85C87E47-E2C7-4684-A3FB-6F7853A86B41">
<RegistryKey Root="HKLM"
Key="SOFTWARE\Nefarius Software Solutions e.U.\ViGEm Bus Driver">
<RegistryValue Type="string" Name="Version" Value="$(var.VERSION)" KeyPath="yes"/>
</RegistryKey>
</Component>
</DirectoryRef>
<!-- main feature are the driver files and some version registry values -->
<Feature Id="ProductFeature" Title="Nefarius Virtual Gamepad Emulation Bus Driver" Level="1">
<ComponentGroupRef Id="ProductComponents" />
<ComponentRef Id="RegistryEntries" />
</Feature>
<!-- build installation command -->
<CustomAction Id="DevconInstallPropertyAssign"
Property="DevconInstallQuiet"
Value="&quot;[INSTALLFOLDER]devcon.exe&quot; install &quot;[INSTALLFOLDER]ViGEmBus.inf&quot; Nefarius\ViGEmBus\Gen1"
Execute="immediate" />
<!-- execute installation with suppressed UI -->
<CustomAction Id="DevconInstallQuiet" BinaryKey="WixCA" DllEntry="$(var.WixQuietExec)"
Execute="deferred" Return="check" Impersonate="no" />
<!-- build removal command -->
<CustomAction Id="DevconRemovePropertyAssign"
Property="DevconRemoveQuiet"
Value="&quot;[INSTALLFOLDER]devcon.exe&quot; /r remove &quot;Nefarius\ViGEmBus\Gen1&quot;"
Execute="immediate" />
<!-- execute removal with suppressed UI -->
<CustomAction Id="DevconRemoveQuiet" BinaryKey="WixCA" DllEntry="$(var.WixQuietExec)"
Execute="deferred" Return="ignore" Impersonate="no" />
<!-- custom installation and removal actions -->
<InstallExecuteSequence>
<Custom Action="DevconInstallPropertyAssign" Before="DevconInstallQuiet">NOT Installed AND NOT REMOVE</Custom>
<Custom Action="DevconRemovePropertyAssign" Before="DevconRemoveQuiet">REMOVE="ALL"</Custom>
<Custom Action="DevconInstallQuiet" Before="InstallFinalize">NOT Installed AND NOT REMOVE</Custom>
<Custom Action='DevconRemoveQuiet' After='InstallInitialize'>REMOVE="ALL"</Custom>
</InstallExecuteSequence>
<!-- use LICENSE as EULA, not technically an EULA but for now it has to do -->
<WixVariable Id="WixUILicenseRtf" Value="$(var.ProjectDir)LICENSE.rtf" />
<!-- use minimalistic UI with EULA approval -->
<UIRef Id="WixUI_Minimal" />
</Product>
<!-- build program files directory -->
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="$(var.PlatformProgramFilesFolder)">
<!-- the "e.U." is butchered so omitted -->
<Directory Id="NSS" Name="Nefarius Software Solutions">
<Directory Id="INSTALLFOLDER" Name="Virtual Gamepad Emulation Bus Driver" />
</Directory>
</Directory>
</Directory>
</Fragment>
<!-- include necessary files -->
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="ProductComponent" Guid="9DB08B36-09FC-48F5-8BDA-2EE24687B5DF" Win64="$(var.Win64)">
<?if $(var.IsCI) = "no" ?>
<!-- local build -->
<File Name="ViGEmBus.sys" Source="$(var.SolutionDir)\drivers\$(var.ArchDir)\ViGEmBus.sys" />
<File Name="ViGEmBus.inf" Source="$(var.SolutionDir)\drivers\$(var.ArchDir)\ViGEmBus.inf" />
<File Name="ViGEmBus.cat" Source="$(var.SolutionDir)\drivers\$(var.ArchDir)\ViGEmBus.cat" />
<File Name="devcon.exe" Source="$(var.SolutionDir)\drivers\$(var.ArchDir)\devcon.exe" />
<File Name="devcon-LICENSE" Source="$(var.SolutionDir)\drivers\devcon-LICENSE" />
<File Name="LICENSE" Source="$(var.SolutionDir)\LICENSE" />
<?else ?>
<!-- CI build -->
<File Name="ViGEmBus.sys" Source="$(var.SolutionDir)bin\$(var.ArchDir)\ViGEmBus\ViGEmBus.sys" />
<File Name="ViGEmBus.inf" Source="$(var.SolutionDir)bin\$(var.ArchDir)\ViGEmBus\ViGEmBus.inf" />
<File Name="ViGEmBus.cat" Source="$(var.SolutionDir)bin\$(var.ArchDir)\ViGEmBus\ViGEmBus.cat" />
<File Name="devcon.exe" Source="$(var.SolutionDir)drivers\$(var.ArchDir)\devcon.exe" />
<File Name="devcon-LICENSE" Source="$(var.SolutionDir)drivers\devcon-LICENSE" />
<File Name="LICENSE" Source="$(var.SolutionDir)LICENSE" />
<?endif ?>
</Component>
</ComponentGroup>
</Fragment>
</Wix>