<?xml version="1.0" encoding="utf-8"?>

<?define ProductName = "Chez Scheme"?>
<?define Manufacturer = "Cisco Systems, Inc."?>

<?if $(sys.BUILDARCH)="x86"?>
    <?define UpgradeCode="e183c83e-1216-446f-bee1-f25db3297efa"?>
    <?define PlatformProgramFilesFolder="ProgramFilesFolder"?>
<?elseif $(sys.BUILDARCH)="x64"?>
    <?define UpgradeCode="07a89f71-9c12-4e7d-b618-f7c255337640"?>
    <?define PlatformProgramFilesFolder="ProgramFiles64Folder"?>
<?else?>
    <?error Unsupported value of sys.BUILDARCH=$(sys.BUILDARCH)?>
<?endif?>

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Product
      Name="$(var.ProductName) $(var.Version) $(sys.BUILDARCH)"
      Id="*"
      UpgradeCode="$(var.UpgradeCode)"
      Language="1033"
      Codepage="1252"
      Version="$(var.Version)"
      Manufacturer="$(var.Manufacturer)">
    <Package
        InstallerVersion="301"
        Keywords="Installer"
        Description="$(var.ProductName) Installer"
        Manufacturer="$(var.Manufacturer)"
        InstallScope="perMachine"
        Languages="1033"
        Compressed="yes"
        SummaryCodepage="1252"/>

    <MajorUpgrade
        AllowDowngrades="no"
        DowngradeErrorMessage="A newer version is already installed."
        AllowSameVersionUpgrades="yes" />

    <MediaTemplate EmbedCab="yes"/>

    <Directory Id="TARGETDIR" Name="SourceDir" DiskId="1">
      <Directory Id="$(var.PlatformProgramFilesFolder)">
        <Directory Id="APPLICATIONFOLDER" Name="$(var.ProductName) $(var.Version)">
          <Directory Id="D_bin" Name="bin"/>
          <Directory Id="D_boot" Name="boot"/>
          <Directory Id="D_examples" Name="examples"/>
        </Directory>
      </Directory>
      <Directory Id="ProgramMenuFolder">
        <Directory Id="D_shortcuts" Name="$(var.ProductName) $(var.Version)"/>
      </Directory>
    </Directory>

    <Feature Id="Examples" Level="1" Title="Chez Scheme examples">
      <ComponentGroupRef Id="examples"/>
    </Feature>

    <?if $(sys.BUILDARCH)="x86"?>
      <Feature Id="i3nt" Level="1" Title="Chez Scheme 32-bit nonthreaded">
        <ComponentGroupRef Id="i3nt"/>
      </Feature>
      <Feature Id="ti3nt" Level="1" Title="Chez Scheme 32-bit threaded">
        <ComponentGroupRef Id="ti3nt"/>
      </Feature>
      <FeatureRef Id="VCRedist32"/>
    <?endif?>

    <?if $(sys.BUILDARCH)="x64"?>
      <Feature Id="a6nt" Level="1" Title="Chez Scheme 64-bit nonthreaded">
        <ComponentGroupRef Id="a6nt"/>
      </Feature>
      <Feature Id="ta6nt" Level="1" Title="Chez Scheme 64-bit threaded">
        <ComponentGroupRef Id="ta6nt"/>
      </Feature>
      <FeatureRef Id="VCRedist64"/>
    <?endif?>

    <Icon Id="cs.ico" SourceFile="../c/cs.ico"/>
    <Property Id="ARPPRODUCTICON" Value="cs.ico"/>

    <UIRef Id="SimpleUI"/>
  </Product>
</Wix>
