<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
  <?define VersionNumber="!(bind.FileVersion.filB6514C65B44EDD23821C8C31D0EB462E)" ?>
  <!-- Product name as you want it to appear in Add/Remove Programs-->
  <Product Id="*" Name="Open Capture and Analytics Tool (OCAT) $(var.VersionNumber)" Language="1033" Version="$(var.VersionNumber)" Manufacturer="Advanced Micro Devices, Inc." UpgradeCode="5f8ad9ed-1fbe-4a7c-88f1-7d34675dd43b">
    <Package InstallerVersion="500" Compressed="yes" InstallScope="perMachine" InstallPrivileges="elevated" Platform="x64"/>

    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
    <Media Id="1" Cabinet="OCAT.cab" EmbedCab="yes" CompressionLevel="high" />

    <Feature Id="ProductFeature" Title="OCAT" Level="1">
      <ComponentGroupRef Id="OCATBinaries" />
      <ComponentRef Id="ApplicationShortcut"/>
      <ComponentRef Id="ImplicitLayer64" />
      <ComponentRef Id="ImplicitLayer32" />
    </Feature>
  </Product>

  <Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFiles64Folder">
        <Directory Id="INSTALLFOLDER" Name="OCAT">
          <Directory Id="BINFOLDER" Name="Bin">
            <Component Id="ImplicitLayer64" Guid="B1ABC3FA-0EAD-4E15-AC78-0ADE14998EDB" Win64="yes">
              <File Id="VK_LAYER_OCAT_overlay64" Name='VK_LAYER_OCAT_overlay64.json' DiskId='1' Source="../GameOverlay/vulkan/VK_LAYER_OCAT_overlay64.json" />
              <RegistryValue Root="HKCU" Action="write" Key="Software\Khronos\Vulkan\ImplicitLayers" Name="[#VK_LAYER_OCAT_overlay64]" Type="integer" Value="1" KeyPath="yes" />
            </Component>
            <Component Id="ImplicitLayer32" Guid="725BF46C-B928-4859-8DE1-9F6B263ACD8F" Win64="yes">
              <File Id="VK_LAYER_OCAT_overlay32" Name='VK_LAYER_OCAT_overlay32.json' DiskId='1' Source="../GameOverlay/vulkan/VK_LAYER_OCAT_overlay32.json" />
              <RegistryValue Root="HKCU" Action="write" Key="Software\WOW6432Node\Khronos\Vulkan\ImplicitLayers" Name="[#VK_LAYER_OCAT_overlay32]" Type="integer" Value="1" KeyPath="yes" />
            </Component>
          </Directory>

          <Directory Id="DOCFOLDER" Name="docs"/>
        </Directory>
      </Directory>
      <Directory Id="ProgramMenuFolder">
        <Directory Id="ApplicationProgramsFolder" Name="OCAT"/>
      </Directory>
    </Directory>
    <DirectoryRef Id="ApplicationProgramsFolder">
      <Component Id="ApplicationShortcut" Guid="*" Win64="yes">
        <Shortcut Id="ApplicationStartMenuShortcut"
                  Name="OCAT"
                  Description="Open Capture and Analytics Tool"
                  Target="[INSTALLFOLDER]\OCAT.exe"
                  WorkingDirectory="INSTALLFOLDER"/>
        <util:InternetShortcut Id="OnlineDocumentationShortcut"
                        Name="OCAT Documentation"
                               Target="http://ocat.readthedocs.io/en/v!(bind.property.ProductVersion.Major).!(bind.property.ProductVersion.Minor).!(bind.property.ProductVersion.Build)/"/>
        <RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
        <RegistryValue Root="HKMU" Key="Software\OCAT" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
        <RegistryValue Root="HKMU" Key="Software\OCAT" Name="InstallDir" Type="string" Value="[INSTALLFOLDER]"/>
      </Component>
    </DirectoryRef>

  </Fragment>
</Wix>
