view deploy/win64/generate-wxs.ps1 @ 698:ee97c742d184 tip

Default branch is now named default on git as well as hg, in case we ever want to switch to mirroring in the other direction
author Chris Cannam
date Thu, 27 Aug 2020 15:58:43 +0100
parents 4bf2fd246c09
children
line wrap: on
line source

Set-StrictMode -Version 2.0
$ErrorActionPreference = "Stop"

$redist_parent_dir = "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Redist\MSVC\"

$redists = (Get-ChildItem -Path $redist_parent_dir -Name -Include 14.* -Attributes Directory)

if (!$redists) {
    echo "ERROR: No 14.x redistributable directories found under $redist_parent_dir"
    exit 1
}

$redist_ver = $redists[-1]

$version = (Get-Content version.h) -replace '#define TONY_VERSION ','' -replace '"',''
$wxs = "deploy\win64\tony.wxs"

$in = "$wxs.in"

$redist_dir="$redist_parent_dir\$redist_ver\x64\Microsoft.VC142.CRT"

echo "Generating $wxs..."
echo " ...for Tony version $version"
echo " ...for redist version $redist_ver"
echo " ...from $in"
echo ""

if (!(Test-Path -Path $redist_dir -PathType Container)) {
    echo "ERROR: Redistributable directory $redist_dir not found"
    exit 1
}

if (!(Test-Path -Path $in -PathType Leaf)) {
    echo "ERROR: Input file $in not found"
    exit 1
}

(Get-Content $in) -replace '@VERSION@', $version -replace '@REDIST_VER@', $redist_ver -replace '@W@', '<!-- DO NOT EDIT THIS FILE: it is auto-generated -->' | Out-File -encoding ASCII $wxs

echo "Done"