diff --git a/.gitignore b/.gitignore
index 0bc683a885..93230a7478 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,6 +21,7 @@ windows/ASIOSDK2
windows/VC_redist.x64.exe
windows/vc_redist.x86.exe
windows/nsProcess.dll
+windows/NSIS
debug/
release/
build/
diff --git a/.travis.yml b/.travis.yml
index f14d05dc69..51262e83df 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -48,37 +48,25 @@ matrix:
# on:
# repo: corrados/jamulus
# tags: true
- # - os: windows
- # before_install:
- # - dir C:/Program\ Files\ \(x86\)/Windows\ Kits/10/bin/10.0.17134.0/x64
- # - cmd.exe /C 'cd && "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvarsall.bat"
- # x86 && cd && cd "C:/Users/travis/build/corrados/jamulus/windows" && dir'
- # - curl -vLO http://download.qt.io/official_releases/online_installers/qt-unified-windows-x86-online.exe
- # - curl -vLO http://www.steinberg.net/sdk_downloads/ASIOSDK2.3.2.zip
- # - unzip ASIOSDK2.3.2.zip
- # - mkdir ASIOSDK2
- # - cp -rvu ASIOSDK2.3.2/* ASIOSDK2
- # - pwd
- # - mv qt-unified-windows-x86-online.exe windows
- # - mv ASIOSDK2 windows
- # - cd windows
- # - "./qt-unified-windows-x86-online.exe --verbose --script qt-installer-windows.qs"
- # - ls -la C:/Qt/5.12.3/msvc2017/bin/qtenv2.bat
- # script:
- # - cmd.exe /C 'cd && "C:\Qt\5.12.3\msvc2017\bin\qtenv2.bat" && cd && "C:\Program
- # Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvarsall.bat"
- # x86 && cd "C:\Users\travis\build\corrados\jamulus" && cd && qmake Jamulus.pro
- # && nmake'
- # #deploy function is only available in travis-ci.com (not free) but not in travis-ci.org (free)
- # #deploy:
- # # provider: releases
- # # api_key:
- # # secure: aQ93/8XU3HEGTif0/rSiF+gcm4uRhyWFdr3Va50BprwQOrZkNg8zIMwIKKODwjLDqxaH4msgNYutcr/VLdLjo4YP43It0UIfv3LGa2VFAkFhuQurMXZlVyx8RhIGLjIaWVWN1GCbNdAQwWNNo2mAkEdRaBrj/26geZotGcYZiztGwTAdy0t/vyYjO1sLZdBKcf7dJ06Pm2ktZO/rDyE4UtCTQiRfqLCKsQ/SILbewOMG/auaSUdU0utsbvXxr+dCzqBPwdSSptWqhIORXORL5oPn6242URzIJkmw5XPwhSabhdbzUjCIN9E24z1vp+cffAohuGXyXXZy9/bGeKa0mXfAaXV+TnJkpMd+i3fN5dY+vhFrlLOpRojRK6NqvaMID6tcNNtZMmFSgaZGyCUJQn4/0X+LdPwvK3/dXY+qElJW62QiJmQAt9OBGcq8EFqQDmEtRivRlbpbERsd/IJoOxP7nI2T00g04uV543ZmhU4fmGw6MVPAlIGRsBECjB0AMTp+3xW3OaUp7jy3WZpZXRrXNI41nZogrxhevPME1BRNk3V+MWQo8R3C+bIaCa5Um/3DZxnMxZgXjI9yzzR7Z8f4RWaQCKjXx41/pk7jxm1TcEyBfRVsb313l/fRLg+fjCmaEnnxu43333XGIv4eIyAGDR8ydF2VpmyP2ejzh8I=
- # # file:
- # # - Jamulus.exe
- # # skip_cleanup: true
- # # on:
- # # repo: corrados/jamulus
- # # tags: true
-
+ - os: windows
+ env:
+ # QT_ACCOUNT_USERNAME and QT_ACCOUNT_PASSWORD variables for Qt registration at install time
+ - secure: WlWyUMU53vGPwZ340bZZy3PVJJfuFZ8gegyLHGYXo1Hp++BCtHJ5FH2kVYxW0pUNqKobkrlGdNMLrhfDD5qATj6TqbRTQr/XKqK5Qhe8sf7Ag/Z+AUjguED7QL0th2Ll6eBlSc9ayrQfvCjvzmyFXGB85iXvuJlbqUCya6xRyiflq37KimLGjxFOhUkCGsIgraUxUxGm/dLj07x2gH1XeozzSOhX/4uDwlP+y642zWyWf/pOrUTSuid97TJseD9tAmLqFpVo43BqDuCe1/7OmBnZkJQb4obU43KeRAHLUCSnbI+kVVNfW8j0/1ynObngIZoC+KQnvc+4NTU13yRez8HoFcEXa9l9oTRBu+nFu+TM+c8+EBNKDZxrdF2NYLRuNdYIzVqZsbSIT+8aoAwMS+bO9AgW2KCelz7zCSoPRokfM2vH7JPEq7Ofib8neK4MEzAKYL1K0/vDlZktsxX8xIhrzgJQCF8IloMLPR3sKIOckYjBzsQG9Q6QJqC6BKJJSpeN6I6LF6cksSMcUalhsqgCghrLFHalJj0mhkSQGTvXtDr3OOfPSicj1fC3efqjiZ9uT6b5yR2gC9e4NaC0qLcqLuHJL10CUjn2eizKBqr0Onu/ybkkClfBUFzu3uOf8YMq3I1hp4xzkfEPAb1A2Iem6rYA9ndyGUnXrYNoLRs=
+ - secure: ldDKzVJFDbA1+tJg4jicBTUAzm83mjybEY2hvPxMofE2gBNwAFRj2+XJD5H1tQ/BBE3LADOVRiwiCxZZLSotIChmmrtQJ68tshYTwcpjf+VQ3m59NsHl0xbjP3/B9DYu1zBOhUc43gGsDnRulvzDi8HwbxrM4ACNCepy+zq+a8M7BytddrhZSgIT0rsTBU0t/StH7B/Pu6E6KByelgdmbnZbuAqaT2HMi+IiGrAJiw70Hmq4BgegsEv4kLyNLe2ofZsdvmFw20Gumfg9B4PFM2S0QESj2pPwFgz+uYUgS/0ncpGdFTshnDKPFj7ePgrHT8eM9bMC8BM8RedpoR0vSUyioCxx0YJzSsw8JE8DEe3qNt3HmhPcH678wrYxs3cXLoTC8kBGDPD6drzqBIvILVfPJcaXRJlD7I+GOIkXFojLrxDZRy9I73KbWHGRONLguGBVyqJxGVrPH6hjEAxhgLLMUAnoh61wPFtvnayT+SbWl2NbAewnsjfCNnLgBZOxdmlKMjC5yUH3wnnyBn5jEAHcjrtbSfQ+lD+ZlYmeuimgsvjomHOHKw3N2+tfKW9lAH45ShiiMIMOk9HP9zKnDnyG6hI0q9wPFxWrkc3RZpRmQO1S9QjB2gD3cWiVMNTBYI+XNOqZEUicTc4XwOByf8bm5SyH4H1+8o1RytgbEZY=
+ before_install:
+ - curl -vL -o "${TEMP}/qt-installer.exe" http://download.qt.io/official_releases/online_installers/qt-unified-windows-x86-online.exe
+ - "${TEMP}/qt-installer.exe --verbose --script ./windows/qt-installer-windows.qs"
+ script:
+ - powershell -ExecutionPolicy ByPass -Command "./windows/deploy_windows.ps1"
+ #deploy function is only available in travis-ci.com (not free) but not in travis-ci.org (free)
+ #deploy:
+ # provider: releases
+ # api_key:
+ # secure: aQ93/8XU3HEGTif0/rSiF+gcm4uRhyWFdr3Va50BprwQOrZkNg8zIMwIKKODwjLDqxaH4msgNYutcr/VLdLjo4YP43It0UIfv3LGa2VFAkFhuQurMXZlVyx8RhIGLjIaWVWN1GCbNdAQwWNNo2mAkEdRaBrj/26geZotGcYZiztGwTAdy0t/vyYjO1sLZdBKcf7dJ06Pm2ktZO/rDyE4UtCTQiRfqLCKsQ/SILbewOMG/auaSUdU0utsbvXxr+dCzqBPwdSSptWqhIORXORL5oPn6242URzIJkmw5XPwhSabhdbzUjCIN9E24z1vp+cffAohuGXyXXZy9/bGeKa0mXfAaXV+TnJkpMd+i3fN5dY+vhFrlLOpRojRK6NqvaMID6tcNNtZMmFSgaZGyCUJQn4/0X+LdPwvK3/dXY+qElJW62QiJmQAt9OBGcq8EFqQDmEtRivRlbpbERsd/IJoOxP7nI2T00g04uV543ZmhU4fmGw6MVPAlIGRsBECjB0AMTp+3xW3OaUp7jy3WZpZXRrXNI41nZogrxhevPME1BRNk3V+MWQo8R3C+bIaCa5Um/3DZxnMxZgXjI9yzzR7Z8f4RWaQCKjXx41/pk7jxm1TcEyBfRVsb313l/fRLg+fjCmaEnnxu43333XGIv4eIyAGDR8ydF2VpmyP2ejzh8I=
+ # file:
+ # - Jamulus.exe
+ # skip_cleanup: true
+ # on:
+ # repo: corrados/jamulus
+ # tags: true
diff --git a/windows/deploy_windows.bat b/windows/deploy_windows.bat
deleted file mode 100755
index eeb4f8875b..0000000000
--- a/windows/deploy_windows.bat
+++ /dev/null
@@ -1,108 +0,0 @@
-@echo off
-rem /******************************************************************************\
-rem * Copyright (c) 2004-2020
-rem *
-rem * Author(s):
-rem * Volker Fischer
-rem *
-rem ******************************************************************************
-rem *
-rem * This program is free software; you can redistribute it and/or modify it under
-rem * the terms of the GNU General Public License as published by the Free Software
-rem * Foundation; either version 2 of the License, or (at your option) any later
-rem * version.
-rem *
-rem * This program is distributed in the hope that it will be useful, but WITHOUT
-rem * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-rem * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-rem * details.
-rem *
-rem * You should have received a copy of the GNU General Public License along with
-rem * this program; if not, write to the Free Software Foundation, Inc.,
-rem * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-rem *
-rem \******************************************************************************/
-
-rem To set up a new Qt and Visual Studio version
-rem - set environment path variable to the correct Qt bin directories:
-rem - QTDIR32: points to the Qt 32 bit binaries, e.g., C:\Qt\5.10.1\msvc2015
-rem - QTDIR64: points to the Qt 64 bin binaries, e.g., C:\Qt\5.10.1\msvc2015_64
-rem - if using Visual Studio Express version, download the redistributable (it is not automatically there)
-rem - change the Qt distribute dll names in the installer.nsi file (some contain version numbers)
-
-rem settings and check ---------------------------------------------------------
-set NSIS_PATH=%PROGRAMFILES(x86)%\NSIS
-set VS_REDIST32_EXE=vc_redist.x86.exe
-set VS_REDIST64_EXE=VC_redist.x64.exe
-
-rem check for environment
-if "%VSINSTALLDIR%" == "" goto vsenvproblem
-if "%QTDIR32%" == "" goto qtdirproblem
-if "%QTDIR64%" == "" goto qtdirproblem
-
-rem check for needed NSIS plugin
-if not exist nsProcess.dll (
- echo nsProcess.dll not found. Trying to download the 7z file containing the dll in NsProcess\Plugin.
- powershell -Command "Invoke-WebRequest https://nsis.sourceforge.io/mediawiki/images/1/18/NsProcess.zip -OutFile nsProcess.7z"
- goto nsispluginproblem
-)
-
-cd ..
-
-
-rem ########################## 32 bit build ####################################
-set QTDIR=%QTDIR32%
-set Path=%QTDIR32%\bin;%Path%
-rem create visual studio project file ------------------------------------------
-qmake -tp vc -spec win32-msvc
-
-rem TODO qmake seems to use the incorrect VS version to create the project file.
-rem As a quick hack I simply replace the toolset version which seems to work.
-powershell -Command "(gc jamulus.vcxproj) -replace 'v141', 'v140' | Out-File -encoding ASCII jamulus.vcxproj"
-powershell -Command "(gc jamulus.vcxproj) -replace 'x64', 'Win32' | Out-File -encoding ASCII jamulus.vcxproj"
-powershell -Command "(gc jamulus.vcxproj) -replace ';WIN64', '' | Out-File -encoding ASCII jamulus.vcxproj"
-powershell -Command "(gc jamulus.vcxproj) -replace '-DWIN64 ', '' | Out-File -encoding ASCII jamulus.vcxproj"
-
-rem clean and compile solution -------------------------------------------------
-devenv Jamulus.vcxproj /Clean "Release|x86"
-devenv Jamulus.vcxproj /Build "Release|x86"
-mkdir release\x86
-copy release\Jamulus.exe release\x86\
-
-
-rem ########################## 64 bit build ####################################
-set QTDIR=%QTDIR64%
-set Path=%QTDIR64%\bin;%Path%
-
-rem create visual studio project file ------------------------------------------
-qmake -tp vc
-
-rem TODO qmake seems to use the incorrect VS version to create the project file.
-rem As a quick hack I simply replace the toolset version which seems to work.
-powershell -Command "(gc jamulus.vcxproj) -replace 'v141', 'v140' | Out-File -encoding ASCII jamulus.vcxproj"
-
-rem clean and compile solution -------------------------------------------------
-devenv Jamulus.vcxproj /Clean "Release|x64"
-devenv Jamulus.vcxproj /Build "Release|x64"
-
-
-rem ########################## create installer ################################
-cd windows
-"%NSIS_PATH%\makensis.exe" installer.nsi
-move Jamulusinstaller.exe ../deploy/Jamulus-version-installer.exe
-goto endofskript
-
-
-:vsenvproblem
-echo Use the Visual Studio x86 x64 Cross Tools Command Prompt to call this skript
-goto endofskript
-
-:qtdirproblem
-echo The QTDIR32 and QTDIR64 is not set, please set these environment variables correctly before calling this script
-goto endofskript
-
-:nsispluginproblem
-echo Required NSIS plugin not found. Unzip the nsProcess.dll and copy it in the windows directory before calling this script
-goto endofskript
-
-:endofskript
diff --git a/windows/deploy_windows.ps1 b/windows/deploy_windows.ps1
new file mode 100644
index 0000000000..7fff77d0fb
--- /dev/null
+++ b/windows/deploy_windows.ps1
@@ -0,0 +1,281 @@
+param(
+ # Replace default path with system Qt installation folder if necessary
+ [string] $QtInstallPath = "C:\Qt\5.12.3",
+ [string] $QtCompile32 = "msvc2019",
+ [string] $QtCompile64 = "msvc2019_64",
+ [string] $AsioSDKName = "ASIOSDK2.3.2",
+ [string] $AsioSDKUrl = "https://www.steinberg.net/sdk_downloads/ASIOSDK2.3.2.zip",
+ [string] $NsisName = "nsis-3.06.1",
+ [string] $NsisUrl = "https://downloads.sourceforge.net/project/nsis/NSIS%203/3.06.1/nsis-3.06.1.zip",
+ [string] $NSProcessName = "Plugin/nsProcessW.dll",
+ [string] $NSProcessUrl = "http://forums.winamp.com/attachment.php?attachmentid=54705&d=1610882327"
+)
+
+# change directory to the directory above (if needed)
+Set-Location -Path "$PSScriptRoot\..\"
+
+# Global constants
+$RootPath = "$PWD"
+$BuildPath = "$RootPath\build"
+$DeployPath = "$RootPath\deploy"
+$WindowsPath ="$RootPath\windows"
+$AppName = "Jamulus"
+
+# Stop at all errors
+$ErrorActionPreference = "Stop"
+
+
+# Execute native command with errorlevel handling
+Function Execute-Native-Command {
+ Param(
+ [string] $Command,
+ [string[]] $Arguments
+ )
+
+ & "$Command" @Arguments
+
+ if ($LastExitCode -Ne 0)
+ {
+ Throw "Native command $Command returned with exit code $LastExitCode"
+ }
+}
+
+# Cleanup existing build folders
+Function Clean-Build-Environment
+{
+ if (Test-Path -Path $BuildPath) { Remove-Item -Path $BuildPath -Recurse -Force }
+ if (Test-Path -Path $DeployPath) { Remove-Item -Path $DeployPath -Recurse -Force }
+
+ New-Item -Path $BuildPath -ItemType Directory
+ New-Item -Path $DeployPath -ItemType Directory
+}
+
+# For sourceforge links we need to get the correct mirror (especially NISIS) Thanks: https://www.powershellmagazine.com/2013/01/29/pstip-retrieve-a-redirected-url/
+Function Get-RedirectedUrl {
+
+ Param (
+ [Parameter(Mandatory=$true)]
+ [String]$URL
+ )
+
+ $request = [System.Net.WebRequest]::Create($url)
+ $request.AllowAutoRedirect=$false
+ $response=$request.GetResponse()
+
+ if ($response.StatusCode -eq "Found")
+ {
+ $response.GetResponseHeader("Location")
+ }
+}
+
+function Load-Module ($m) { # see https://stackoverflow.com/a/51692402
+
+ # If module is imported say that and do nothing
+ if (Get-Module | Where-Object {$_.Name -eq $m}) {
+ write-host "Module $m is already imported."
+ }
+ else {
+
+ # If module is not imported, but available on disk then import
+ if (Get-Module -ListAvailable | Where-Object {$_.Name -eq $m}) {
+ Import-Module $m
+ }
+ else {
+
+ # If module is not imported, not available on disk, but is in online gallery then install and import
+ if (Find-Module -Name $m | Where-Object {$_.Name -eq $m}) {
+ Install-Module -Name $m -Force -Verbose -Scope CurrentUser
+ Import-Module $m
+ }
+ else {
+
+ # If module is not imported, not available and not in online gallery then abort
+ write-host "Module $m not imported, not available and not in online gallery, exiting."
+ EXIT 1
+ }
+ }
+ }
+}
+
+# Download and uncompress dependency in ZIP format
+Function Install-Dependency
+{
+ param(
+ [Parameter(Mandatory=$true)]
+ [string] $Uri,
+ [Parameter(Mandatory=$true)]
+ [string] $Name,
+ [Parameter(Mandatory=$true)]
+ [string] $Destination
+ )
+
+ if (Test-Path -Path "$WindowsPath\$Destination") { return }
+
+ $TempFileName = [System.IO.Path]::GetTempFileName() + ".zip"
+ $TempDir = [System.IO.Path]::GetTempPath()
+
+ if ($Uri -Match "downloads.sourceforge.net")
+ {
+ $Uri = Get-RedirectedUrl -URL $Uri
+ }
+
+ Invoke-WebRequest -Uri $Uri -OutFile $TempFileName
+ echo $TempFileName
+ Expand-Archive -Path $TempFileName -DestinationPath $TempDir -Force
+ echo $WindowsPath\$Destination
+ Move-Item -Path "$TempDir\$Name" -Destination "$WindowsPath\$Destination" -Force
+ Remove-Item -Path $TempFileName -Force
+}
+
+# Install VSSetup (Visual Studio detection), ASIO SDK and NSIS Installer
+Function Install-Dependencies
+{
+ if (-not (Get-PackageProvider -Name nuget).Name -eq "nuget") {
+ Install-PackageProvider -Name "Nuget" -Scope CurrentUser -Force
+ }
+ Load-Module -m "VSSetup"
+ Install-Dependency -Uri $AsioSDKUrl `
+ -Name $AsioSDKName -Destination "ASIOSDK2"
+ Install-Dependency -Uri $NsisUrl `
+ -Name $NsisName -Destination "NSIS"
+ Install-Dependency -Uri $NSProcessUrl `
+ -Name $NSProcessName -Destination "nsProcess.dll"
+}
+
+# Setup environment variables and build tool paths
+Function Setup-Build-Environment
+{
+ param(
+ [Parameter(Mandatory=$true)]
+ [string] $QtInstallPath,
+ [Parameter(Mandatory=$true)]
+ [string] $BuildArch
+ )
+
+ # Look for Visual Studio/Build Tools 2017 or later (version 15.0 or above)
+ $VsInstallPath = Get-VSSetupInstance | `
+ Select-VSSetupInstance -Product "*" -Version "15.0" -Latest | `
+ Select-Object -ExpandProperty "InstallationPath"
+
+ if ($VsInstallPath -Eq "") { $VsInstallPath = "" }
+
+ if ($BuildArch -Eq "x86_64")
+ {
+ $VcVarsBin = "$VsInstallPath\VC\Auxiliary\build\vcvars64.bat"
+ $QtMsvcSpecPath = "$QtInstallPath\$QtCompile64\bin"
+ }
+ else
+ {
+ $VcVarsBin = "$VsInstallPath\VC\Auxiliary\build\vcvars32.bat"
+ $QtMsvcSpecPath = "$QtInstallPath\$QtCompile32\bin"
+ }
+
+ # Setup Qt executables paths for later calls
+ Set-Item Env:QtQmakePath "$QtMsvcSpecPath\qmake.exe"
+ Set-Item Env:QtWinDeployPath "$QtMsvcSpecPath\windeployqt.exe"
+
+ ""
+ "**********************************************************************"
+ "Using Visual Studio/Build Tools environment settings located at"
+ $VcVarsBin
+ "**********************************************************************"
+ ""
+ "**********************************************************************"
+ "Using Qt binaries for Visual C++ located at"
+ $QtMsvcSpecPath
+ "**********************************************************************"
+ ""
+
+ if (-Not (Test-Path -Path $VcVarsBin))
+ {
+ Throw "Microsoft Visual Studio ($BuildArch variant) is not installed. " + `
+ "Please install Visual Studio 2017 or above it before running this script."
+ }
+
+ if (-Not (Test-Path -Path $Env:QtQmakePath))
+ {
+ Throw "The Qt binaries for Microsoft Visual C++ 2017 (msvc2017) could not be located. " + `
+ "Please install Qt with support for MSVC 2017 before running this script," + `
+ "then call this script with the Qt install location, for example C:\Qt\5.12.3"
+ }
+
+ # Import environment variables set by vcvarsXX.bat into current scope
+ $EnvDump = [System.IO.Path]::GetTempFileName()
+ Execute-Native-Command -Command "cmd" `
+ -Arguments ("/c", "`"$VcVarsBin`" && set > `"$EnvDump`"")
+
+ foreach ($_ in Get-Content -Path $EnvDump)
+ {
+ if ($_ -Match "^([^=]+)=(.*)$")
+ {
+ Set-Item "Env:$($Matches[1])" $Matches[2]
+ }
+ }
+
+ Remove-Item -Path $EnvDump -Force
+}
+
+# Build Jamulus x86_64 and x86
+Function Build-App
+{
+ param(
+ [Parameter(Mandatory=$true)]
+ [string] $BuildConfig,
+ [Parameter(Mandatory=$true)]
+ [string] $BuildArch
+ )
+
+ Execute-Native-Command -Command "$Env:QtQmakePath" `
+ -Arguments ("$RootPath\$AppName.pro", "CONFIG+=$BuildConfig $BuildArch", `
+ "-o", "$BuildPath\Makefile")
+
+ Set-Location -Path $BuildPath
+ Execute-Native-Command -Command "nmake" -Arguments ("$BuildConfig")
+ Execute-Native-Command -Command "$Env:QtWinDeployPath" `
+ -Arguments ("--$BuildConfig", "--compiler-runtime", "--dir=$DeployPath\$BuildArch",
+ "$BuildPath\$BuildConfig\$AppName.exe")
+
+ Move-Item -Path "$BuildPath\$BuildConfig\$AppName.exe" -Destination "$DeployPath\$BuildArch" -Force
+ Execute-Native-Command -Command "nmake" -Arguments ("clean")
+ Set-Location -Path $RootPath
+}
+
+# Build and deploy Jamulus 64bit and 32bit variants
+function Build-App-Variants
+{
+ param(
+ [Parameter(Mandatory=$true)]
+ [string] $QtInstallPath
+ )
+
+ foreach ($_ in ("x86_64", "x86"))
+ {
+ $OriginalEnv = Get-ChildItem Env:
+ Setup-Build-Environment -QtInstallPath $QtInstallPath -BuildArch $_
+ Build-App -BuildConfig "release" -BuildArch $_
+ $OriginalEnv | % { Set-Item "Env:$($_.Name)" $_.Value }
+ }
+}
+
+# Build Windows installer
+Function Build-Installer
+{
+ foreach ($_ in Get-Content -Path "$RootPath\$AppName.pro")
+ {
+ if ($_ -Match "^VERSION *= *(.*)$")
+ {
+ $AppVersion = $Matches[1]
+ break
+ }
+ }
+
+ Execute-Native-Command -Command "$WindowsPath\NSIS\makensis" `
+ -Arguments ("/v4", "/DAPP_NAME=$AppName", "/DAPP_VERSION=$AppVersion", `
+ "/DROOT_PATH=$RootPath", "/DWINDOWS_PATH=$WindowsPath", "/DDEPLOY_PATH=$DeployPath", `
+ "$WindowsPath\installer.nsi")
+}
+
+Clean-Build-Environment
+Install-Dependencies
+Build-App-Variants -QtInstallPath $QtInstallPath
+Build-Installer
diff --git a/windows/installer-banner.bmp b/windows/installer-banner.bmp
new file mode 100644
index 0000000000..1ba4130716
Binary files /dev/null and b/windows/installer-banner.bmp differ
diff --git a/windows/installer-banner.xcf b/windows/installer-banner.xcf
new file mode 100644
index 0000000000..9964e17d30
Binary files /dev/null and b/windows/installer-banner.xcf differ
diff --git a/windows/installer-welcome.bmp b/windows/installer-welcome.bmp
new file mode 100644
index 0000000000..a8a1b4c13b
Binary files /dev/null and b/windows/installer-welcome.bmp differ
diff --git a/windows/installer.nsi b/windows/installer.nsi
index 48d8877fb8..0925e75c72 100755
--- a/windows/installer.nsi
+++ b/windows/installer.nsi
@@ -1,213 +1,407 @@
-;/******************************************************************************\
-; * Copyright (c) 2004-2020
-; *
-; * Author(s):
-; * Volker Fischer
-; *
-; ******************************************************************************
-; *
-; * This program is free software; you can redistribute it and/or modify it under
-; * the terms of the GNU General Public License as published by the Free Software
-; * Foundation; either version 2 of the License, or (at your option) any later
-; * version.
-; *
-; * This program is distributed in the hope that it will be useful, but WITHOUT
-; * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-; * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-; * details.
-; *
-; * You should have received a copy of the GNU General Public License along with
-; * this program; if not, write to the Free Software Foundation, Inc.,
-; * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-; *
-;\******************************************************************************/
-
-; Jamulus NSIS installer script
-!include LogicLib.nsh
-!include x64.nsh
-
-!define APP_NAME "Jamulus"
-!define APP_EXE "Jamulus.exe"
-!define AUTORUN_NAME "Jamulus server"
-!define UNINSTALL_EXE "Uninstall.exe"
-!define INSTALLER_NAME "Jamulusinstaller.exe"
-!define BINARY_PATH "..\release\"
-!define VS_REDIST_EXE "vc_redist.x86.exe"
-!define UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}"
+; Jamulus NSIS Installer with Modern User Interface
+
+; Includes
+!include "x64.nsh" ; 64bit architecture support
+!include "MUI2.nsh" ; Modern UI
+!include "LogicLib.nsh" ; Logical operators
+!include "Sections.nsh" ; Support for section selection
+!include nsDialogs.nsh ; Support custom pages with dialogs
+
+; Compile-time definitions
+!define VC_REDIST32_EXE "vc_redist.x86.exe"
+!define VC_REDIST64_EXE "vc_redist.x64.exe"
+!define APP_INSTALL_KEY "Software\${APP_NAME}"
+!define APP_INSTALL_VALUE "InstallFolder"
+!define APP_INSTALL_ICON "InstallDtIcon"
+!define AUTORUN_NAME "${APP_NAME} Server"
!define AUTORUN_KEY "Software\Microsoft\Windows\CurrentVersion\Run"
+!define APP_EXE "${APP_NAME}.exe"
+!define UNINSTALL_EXE "Uninstall.exe"
+!define APP_UNINSTALL_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}"
+
+; General
+SetCompressor bzip2 ; Compression mode
+Unicode true ; Support all languages via Unicode
+RequestExecutionLevel admin ; Administrator privileges are required for installation
+
+; Installer name and file
+Name "${APP_NAME}"
+OutFile "${DEPLOY_PATH}\${APP_NAME}-${APP_VERSION}-installer-win.exe"
+Caption "${APP_NAME} ${APP_VERSION} Installer"
+BrandingText "${APP_NAME} powers your online jam session"
+
+ ; Additional plugin location (for nsProcess)
+!addplugindir "${WINDOWS_PATH}"
+
+; Installer graphical element configuration
+!define MUI_ICON "${WINDOWS_PATH}\mainicon.ico"
+!define MUI_UNICON "${WINDOWS_PATH}\mainicon.ico"
+!define SERVER_ICON "${WINDOWS_PATH}\jamulus-server-icon-2020.ico"
+!define MUI_HEADERIMAGE
+!define MUI_HEADERIMAGE_BITMAP "${WINDOWS_PATH}\installer-banner.bmp"
+!define MUI_WELCOMEFINISHPAGE_BITMAP "${WINDOWS_PATH}\installer-welcome.bmp"
+!define MUI_UNWELCOMEFINISHPAGE_BITMAP "${WINDOWS_PATH}\installer-welcome.bmp"
+
+; Store the installer language - must be placed before the installer page configuration
+!define MUI_LANGDLL_REGISTRY_ROOT HKLM
+!define MUI_LANGDLL_REGISTRY_KEY "${APP_INSTALL_KEY}"
+!define MUI_LANGDLL_REGISTRY_VALUENAME "InstallLanguage"
+
+; Installer page configuration
+!define MUI_PAGE_CUSTOMFUNCTION_PRE AbortOnRunningApp
+!insertmacro MUI_PAGE_WELCOME
+
+Page Custom ASIOCheckInstalled ExitASIOInstalled
+
+!insertmacro MUI_PAGE_LICENSE "${ROOT_PATH}\COPYING"
+!define MUI_PAGE_CUSTOMFUNCTION_LEAVE ValidateDestinationFolder
+!insertmacro MUI_PAGE_DIRECTORY
+!insertmacro MUI_PAGE_INSTFILES
+!define MUI_PAGE_CUSTOMFUNCTION_SHOW FinishPage.Show
+!define MUI_FINISHPAGE_RUN "$INSTDIR\${APP_EXE}"
+!define MUI_FINISHPAGE_SHOWREADME ""
+!define MUI_FINISHPAGE_SHOWREADME_CHECKED
+!define MUI_FINISHPAGE_SHOWREADME_TEXT "$(DESKTOP_SET_SHORTCUT)"
+!define MUI_FINISHPAGE_SHOWREADME_FUNCTION createdesktopshortcut
+!insertmacro MUI_PAGE_FINISH
+
+; Uninstaller page configuration
+!define MUI_PAGE_CUSTOMFUNCTION_PRE un.AbortOnRunningApp
+!insertmacro MUI_UNPAGE_WELCOME
+!insertmacro MUI_UNPAGE_CONFIRM
+!insertmacro MUI_UNPAGE_INSTFILES
+!insertmacro MUI_UNPAGE_FINISH
+
+; Supported languages configuration - languages other than English are disabled for now
+; Additional languages can be added below, see https://nsis.sourceforge.io/Examples/Modern%20UI/MultiLanguage.nsi
+!insertmacro MUI_LANGUAGE "English" ; The first language is the default
+; !insertmacro MUI_LANGUAGE "Italian"
+LangString DESKTOP_SET_SHORTCUT ${LANG_ENGLISH} \
+ "Create Desktop shortcut"
+LangString INVALID_FOLDER_MSG ${LANG_ENGLISH} \
+ "The destination folder already exists. Please enter a new destination folder."
+; LangString INVALID_FOLDER_MSG ${LANG_ITALIAN} \
+; "La cartella di destinazione esiste già. Selezionare una nuova cartella di destinazione."
+
+LangString RUNNING_APP_MSG ${LANG_ENGLISH} \
+ "${APP_NAME} is running. Please close it and run the setup again."
+; LangString RUNNING_APP_MSG ${LANG_ITALIAN} \
+; "${APP_NAME} è in esecuzione. Chiudere l'applicazione prima di eseguire l'installazione."
+
+LangString OLD_WRONG_VER_FOUND ${LANG_ENGLISH} \
+ "Due to a bug, a 64 Bit version of Jamulus might be installed to your 32 Bit Program Files folder. Do you want to remove it before installing this new version (we strongly recommend this)?"
+
+LangString OLD_WRONG_VER_FOUND_CONFIRM ${LANG_ENGLISH} \
+ "If you continue without removing it, your installation might be broken! Are you sure you don't want to remove the old version?"
+LangString OLD_VER_REMOVE_FAILED ${LANG_ENGLISH} \
+ "FATAL: THE UNINSTALLER FAILED. Once you click on OK the old version will remain on your PC and we will try to install the new version too. You can also press cancel and try to remove it on your own."
+LangString ASIO_DRIVER_HEADER ${LANG_ENGLISH} \
+ "ASIO driver"
+LangString ASIO_DRIVER_SUB ${LANG_ENGLISH} \
+ "To use Jamulus, you need an ASIO driver"
+LangString ASIO_DRIVER_EXPLAIN ${LANG_ENGLISH} \
+ "Jamulus needs an ASIO driver to provide low latency audio. You should install one now:"
+LangString ASIO_DRIVER_MORE_INFO ${LANG_ENGLISH} \
+ "More information on jamulus.io"
+LangString ASIO_DRIVER_MORE_INFO_URL ${LANG_ENGLISH} \
+ "https://jamulus.io/wiki/Installation-for-Windows#setting-up-asio4all"
+LangString ASIO_EXIT_NO_DRIVER ${LANG_ENGLISH} \
+ "We couldn't find an ASIO driver on your PC. Jamulus will not work without one. Do you still want to continue?"
+; Abort the installer/uninstaller if Jamulus is running
+
+!macro _AbortOnRunningApp
+
+ nsProcess::_FindProcess "${APP_EXE}"
+ Pop $R0
+
+ ${If} $R0 = 0
+ MessageBox MB_OK|MB_ICONEXCLAMATION "$(RUNNING_APP_MSG)" /sd IDOK
+ Quit
+ ${EndIf}
+
+!macroend
+
+; Define Dialog variables
+
+Var Dialog
+Var Label
+Var Button
+
+; Define user choices
+
+Var bInstallDtIcon
+; Installer
+!macro InstallApplication buildArch
+ !define prefix "${DEPLOY_PATH}\${buildArch}"
+ !tempfile files
+
+ ; Find target folders (Probably here's an issue with quoting. If ${prefix} contains spaces, the installer folders aren't created in the right way.)
+ !system 'cmd.exe /v /c "for /f "usebackq" %d in (`dir /b /s /ad "${prefix}"`) do \
+ @(set "_d=%d" && echo CreateDirectory "$INSTDIR\!_d:${prefix}\=!" >> "${files}")"'
+
+ ; Find target files
+ !system 'cmd.exe /v /c "for /r "${prefix}" %f in (*.*) do \
+ @(set "_f=%f" && echo File "/oname=$INSTDIR\!_f:${prefix}\=!" "!_f!" >> "${files}")"'
+ ; to allow jumping in macros, NSIS reccomends to define unique IDs for labels https://nsis.sourceforge.io/Tutorial:_Using_labels_in_macro%27s
+ !define UniqueID ${__LINE__}
+
+ InitPluginsDir ; see https://stackoverflow.com/questions/24595887/waiting-for-nsis-uninstaller-to-finish-in-nsis-installer-either-fails-or-the-uni
+ IfFileExists "$INSTDIR\${UNINSTALL_EXE}" 0 continue_${UniqueID}
+
+ CreateDirectory "$pluginsdir\unold" ; Make sure plugins do not conflict with a old uninstaller
+ CopyFiles /SILENT /FILESONLY "$INSTDIR\${UNINSTALL_EXE}" "$pluginsdir\unold"
+ ExecWait '"$pluginsdir\unold\${UNINSTALL_EXE}" /S _?=$INSTDIR' $0
+
+ ${IfNot} $0 == 0
+ MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(OLD_VER_REMOVE_FAILED)" /sd IDCANCEL IDOK continue_${UniqueID}
+ Abort
+ ${EndIf}
+
+ continue_${UniqueID}:
+ !undef UniqueID
+
+ ; Install folders and files
+ CreateDirectory "$INSTDIR"
+ !include "${files}"
+
+ ; Add the redistribution license
+ File "/oname=$INSTDIR\COPYING" "${ROOT_PATH}\COPYING"
+ File "/oname=$INSTDIR\servericon.ico" "${SERVER_ICON}"
+ ; Cleanup
+ !delfile "${files}"
+ !undef files
+ !undef prefix
+
+!macroend
+
+!macro SetupShortcuts
+
+ ; Add the registry key to store the installation folder
+ WriteRegStr HKLM "${APP_INSTALL_KEY}" "${APP_INSTALL_VALUE}" "$INSTDIR"
+
+ ; Add the registry keys so that software appears in Windows "Add/Remove Software"
+ WriteRegStr HKLM "${APP_UNINSTALL_KEY}" "DisplayName" "${APP_NAME}"
+ WriteRegStr HKLM "${APP_UNINSTALL_KEY}" "DisplayIcon" "$INSTDIR\${APP_EXE},0"
+ WriteRegStr HKLM "${APP_UNINSTALL_KEY}" "UninstallString" '"$INSTDIR\${UNINSTALL_EXE}"'
+ ; Add the uninstaller
+ WriteUninstaller "$INSTDIR\${UNINSTALL_EXE}"
-SetCompressor lzma
-Name "${APP_NAME}"
-Caption "${APP_NAME}"
-OutFile "${INSTALLER_NAME}"
-InstallDir "$PROGRAMFILES\${APP_NAME}"
-
-LicenseText "License"
-LicenseData "..\COPYING"
-
-Page license
-Page directory
-Page instfiles
-
-
-Section
-
- ; check if software is currently running
- !addplugindir ..\windows
- nsProcess::_FindProcess "${APP_EXE}"
- Pop $R0
- ${If} $R0 = 0
- MessageBox MB_OK|MB_ICONEXCLAMATION "${APP_NAME} is running. Please close it and run the setup again." /sd IDOK
- Quit
- ${EndIf}
-
- ; add reg keys so that software appears in Windows "Add/Remove Software"
- WriteRegStr HKLM "${UNINST_KEY}" "DisplayName" "${APP_NAME} (remove only)"
- WriteRegStr HKLM "${UNINST_KEY}" "UninstallString" '"$INSTDIR\${UNINSTALL_EXE}"'
-
- SetOutPath $INSTDIR
-
- ; main application
- ${If} ${RunningX64}
- File "${BINARY_PATH}${APP_EXE}"
- ${Else}
- File "${BINARY_PATH}x86\${APP_EXE}"
- ${EndIf}
-
- ; icons
- File "jamulus-server-icon-2020.ico"
-
- ; QT dlls
- ${If} ${RunningX64}
- File "$%QTDIR64%\bin\Qt5Core.dll"
- File "$%QTDIR64%\bin\Qt5Gui.dll"
- File "$%QTDIR64%\bin\Qt5Widgets.dll"
- File "$%QTDIR64%\bin\Qt5Network.dll"
- File "$%QTDIR64%\bin\Qt5Svg.dll"
- File "$%QTDIR64%\bin\Qt5Concurrent.dll"
- File "$%QTDIR64%\bin\Qt5Xml.dll"
- ${Else}
- File "$%QTDIR32%\bin\Qt5Core.dll"
- File "$%QTDIR32%\bin\Qt5Gui.dll"
- File "$%QTDIR32%\bin\Qt5Widgets.dll"
- File "$%QTDIR32%\bin\Qt5Network.dll"
- File "$%QTDIR32%\bin\Qt5Svg.dll"
- File "$%QTDIR32%\bin\Qt5Concurrent.dll"
- File "$%QTDIR32%\bin\Qt5Xml.dll"
- ${EndIf}
-
- ; other files
- File "..\COPYING"
-
- ; temporarily create Microsoft Visual Studio redistributable
- ${If} ${RunningX64}
- File "$%VS_REDIST64_EXE%"
- ExecWait '"$INSTDIR\$%VS_REDIST64_EXE%" /q /norestart'
- ${Else}
- File "$%VS_REDIST32_EXE%"
- ExecWait '"$INSTDIR\$%VS_REDIST32_EXE%" /q /norestart'
- ${EndIf}
-
- ; uninstaller
- WriteUninstaller $INSTDIR\${UNINSTALL_EXE}
-
- ; shortcuts
- CreateShortCut "$DESKTOP\${APP_NAME}.lnk" "$OUTDIR\${APP_EXE}"
-
- CreateDirectory "$SMPROGRAMS\${APP_NAME}"
- CreateShortCut "$SMPROGRAMS\${APP_NAME}\${APP_NAME}.lnk" "$INSTDIR\${APP_EXE}"
- CreateShortCut "$SMPROGRAMS\${APP_NAME}\${APP_NAME} Server.lnk" "$INSTDIR\${APP_EXE}" "-s" "$INSTDIR\jamulus-server-icon-2020.ico"
- CreateShortCut "$SMPROGRAMS\${APP_NAME}\${UNINSTALL_EXE}.lnk" "$INSTDIR\${UNINSTALL_EXE}"
-
- ; cleanup: remove temporary Microsoft Visual Studio redistributable executable
- ${If} ${RunningX64}
- Delete $INSTDIR\$%VS_REDIST64_EXE%
- ${Else}
- Delete $INSTDIR\$%VS_REDIST32_EXE%
- ${EndIf}
-
- ; additional platform dlls
- SetOutPath $INSTDIR\platforms
- ${If} ${RunningX64}
- File "$%QTDIR64%\plugins\platforms\qwindows.dll"
- ${Else}
- File "$%QTDIR32%\plugins\platforms\qwindows.dll"
- ${EndIf}
-
- ; additional styles dlls
- SetOutPath $INSTDIR\styles
- ${If} ${RunningX64}
- File "$%QTDIR64%\plugins\styles\qwindowsvistastyle.dll"
- ${Else}
- File "$%QTDIR32%\plugins\styles\qwindowsvistastyle.dll"
- ${EndIf}
-
- ; additional imageformats dlls
- SetOutPath $INSTDIR\imageformats
- ${If} ${RunningX64}
- File "$%QTDIR64%\plugins\imageformats\qgif.dll"
- File "$%QTDIR64%\plugins\imageformats\qicns.dll"
- File "$%QTDIR64%\plugins\imageformats\qico.dll"
- File "$%QTDIR64%\plugins\imageformats\qjpeg.dll"
- File "$%QTDIR64%\plugins\imageformats\qsvg.dll"
- File "$%QTDIR64%\plugins\imageformats\qtga.dll"
- File "$%QTDIR64%\plugins\imageformats\qtiff.dll"
- File "$%QTDIR64%\plugins\imageformats\qwbmp.dll"
- File "$%QTDIR64%\plugins\imageformats\qwebp.dll"
- ${Else}
- File "$%QTDIR32%\plugins\imageformats\qgif.dll"
- File "$%QTDIR32%\plugins\imageformats\qicns.dll"
- File "$%QTDIR32%\plugins\imageformats\qico.dll"
- File "$%QTDIR32%\plugins\imageformats\qjpeg.dll"
- File "$%QTDIR32%\plugins\imageformats\qsvg.dll"
- File "$%QTDIR32%\plugins\imageformats\qtga.dll"
- File "$%QTDIR32%\plugins\imageformats\qtiff.dll"
- File "$%QTDIR32%\plugins\imageformats\qwbmp.dll"
- File "$%QTDIR32%\plugins\imageformats\qwebp.dll"
- ${EndIf}
+ ; Add the Start Menu shortcuts
+ CreateDirectory "$SMPROGRAMS\${APP_NAME}"
+ CreateShortCut "$SMPROGRAMS\${APP_NAME}\${APP_NAME}.lnk" "$INSTDIR\${APP_EXE}"
+ CreateShortCut "$SMPROGRAMS\${APP_NAME}\${APP_NAME} Server.lnk" "$INSTDIR\${APP_EXE}" "-s" "$INSTDIR\servericon.ico"
+ CreateShortCut "$SMPROGRAMS\${APP_NAME}\${APP_NAME} Uninstall.lnk" "$INSTDIR\${UNINSTALL_EXE}"
+!macroend
+
+Function .onInit
+
+ ; Set up registry access, installation folder and installer section for current architecture
+ ${If} ${RunningX64}
+ SetRegView 64
+
+ ; Set default installation folder, retrieve from registry if available
+ ReadRegStr $INSTDIR HKLM "${APP_INSTALL_KEY}" "${APP_INSTALL_VALUE}"
+ IfErrors 0 +2
+ StrCpy $INSTDIR "$PROGRAMFILES64\${APP_NAME}"
+ ${Else}
+ SetRegView 32
+
+ ; Set default installation folder, retrieve from registry if available
+ ReadRegStr $INSTDIR HKLM "${APP_INSTALL_KEY}" "${APP_INSTALL_VALUE}"
+ IfErrors 0 +2
+ StrCpy $INSTDIR "$PROGRAMFILES32\${APP_NAME}"
+
+ ${EndIf}
+ ; Install for all users
+ SetShellVarContext all
+ ; get user choices (open program, dt icon,...)
+ ReadRegStr $bInstallDtIcon HKLM "${APP_INSTALL_KEY}" "${APP_INSTALL_ICON}"
+ IfErrors 0 +2
+ StrCpy $bInstallDtIcon "1"
+ ; Select installer language
+ !insertmacro MUI_LANGDLL_DISPLAY
+FunctionEnd
+
+; Ensure Jamulus is installed into a new folder only, unless Jamulus is already installed there
+Function ValidateDestinationFolder
+
+ ${If} ${FileExists} "$INSTDIR\*"
+ ${AndIfNot} ${FileExists} "$INSTDIR\${APP_EXE}"
+ StrCpy $INSTDIR "$INSTDIR\${APP_NAME}"
+ MessageBox MB_OK|MB_ICONEXCLAMATION "$(INVALID_FOLDER_MSG)" /sd IDOK
+ Abort
+ ${endIf}
+
+FunctionEnd
+
+Section Install
+ ${If} ${RunningX64}
+ ; check if old, wrongly installed Jamulus exists. See https://stackoverflow.com/questions/27839860/nsis-check-if-registry-key-value-exists#27841158
+ IfFileExists "$PROGRAMFILES32\Jamulus\Uninstall.exe" 0 continueinstall
+ MessageBox MB_YESNOCANCEL|MB_ICONEXCLAMATION "$(OLD_WRONG_VER_FOUND)" /sd IDYES IDNO idontcare IDCANCEL quit
+ goto removeold
+ idontcare:
+ MessageBox MB_YESNO|MB_ICONEXCLAMATION "$(OLD_WRONG_VER_FOUND_CONFIRM)" /sd IDNO IDYES continueinstall
+ goto removeold
+ removeold:
+ ExecWait '"$PROGRAMFILES32\Jamulus\Uninstall.exe" /S' $0
+ ${IfNot} $0 == 0
+ MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(OLD_VER_REMOVE_FAILED)" /sd IDCANCEL IDOK continueinstall
+ goto quit
+ ${EndIf}
+ goto continueinstall
+ quit:
+ Abort
+ continueinstall:
+ ; Install the main application
+ !insertmacro InstallApplication x86_64
+ !insertmacro SetupShortcuts
+
+ ; Install Microsoft Visual Studio redistributables and remove the installer afterwards
+ ExecWait "$\"$INSTDIR\${VC_REDIST64_EXE}$\" /q /norestart"
+ Delete "$INSTDIR\${VC_REDIST64_EXE}"
+ ${Else}
+ ; Install the main application
+ !insertmacro InstallApplication x86
+ !insertmacro SetupShortcuts
+
+ ; Install Microsoft Visual Studio redistributables and remove the installer afterwards
+ ExecWait "$\"$INSTDIR\${VC_REDIST32_EXE}$\" /q /norestart"
+ Delete "$INSTDIR\${VC_REDIST32_EXE}"
+ ${EndIf}
SectionEnd
+Function FinishPage.Show ; set the user choices if they were remembered
+ WriteRegStr HKLM "${APP_INSTALL_KEY}" "${APP_INSTALL_ICON}" "0" ; this will be overwritten if the box is checked
+ ${If} $bInstallDtIcon == 1 ; Check the install desktop icon checkbox
+ SendMessage $mui.FinishPage.Showreadme ${BM_SETCHECK} ${BST_CHECKED} 0
+ ${Else}
+ SendMessage $mui.FinishPage.Showreadme ${BM_SETCHECK} ${BST_UNCHECKED} 0
+ ${EndIf}
+ ShowWindow $mui.FinishPage.Showreadme 1
+FunctionEnd
+
+
+Function AbortOnRunningApp
+ !insertmacro _AbortOnRunningApp
+FunctionEnd
+
+Function createdesktopshortcut
+ WriteRegStr HKLM "${APP_INSTALL_KEY}" "${APP_INSTALL_ICON}" "1" ; remember that icon should be installed next time
+ CreateShortCut "$DESKTOP\${APP_NAME}.lnk" "$INSTDIR\${APP_EXE}"
+FunctionEnd
+
+Function ASIOCheckInstalled
+
+ ; insert ASIO install page if no ASIO driver was found
+ ClearErrors
+ EnumRegKey $0 HKLM "SOFTWARE\ASIO" 0
+ IfErrors 0 ASIOExists
+ !insertmacro MUI_HEADER_TEXT "$(ASIO_DRIVER_HEADER)" "$(ASIO_DRIVER_SUB)"
+ nsDialogs::Create 1018
+ Pop $Dialog
+
+ ${If} $Dialog == error
+ Abort
+ ${Endif}
+
+ ${NSD_CreateLabel} 0 0 100% 12u "$(ASIO_DRIVER_EXPLAIN)"
+ Pop $Label
+ ${NSD_CreateButton} 0 13u 100% 13u "$(ASIO_DRIVER_MORE_INFO)"
+ Pop $Button
+ ${NSD_OnClick} $Button OpenASIOHelpPage
+
+ nsDialogs::Show
+ ASIOExists:
+FunctionEnd
+
+Function OpenASIOHelpPage
+ ExecShell "open" "$(ASIO_DRIVER_MORE_INFO_URL)"
+FunctionEnd
-Section "Uninstall"
-
-DeleteRegKey HKLM "${UNINST_KEY}"
-
-; the software may have written an auto run entry in the registry, remove it
-DeleteRegValue HKCU "${AUTORUN_KEY}" "${AUTORUN_NAME}"
-
-Delete "$DESKTOP\${APP_NAME}.lnk"
-Delete "$SMPROGRAMS\${APP_NAME}\${APP_NAME}.lnk"
-Delete "$SMPROGRAMS\${APP_NAME}\${APP_NAME} server.lnk"
-Delete "$SMPROGRAMS\${APP_NAME}\${UNINSTALL_EXE}.lnk"
-RMDIR "$SMPROGRAMS\${APP_NAME}"
-
-Delete $INSTDIR\${UNINSTALL_EXE}
-Delete $INSTDIR\${APP_EXE}
-Delete $INSTDIR\jamulus-server-icon-2020.ico
-Delete $INSTDIR\Qt5Core.dll
-Delete $INSTDIR\Qt5Gui.dll
-Delete $INSTDIR\Qt5Widgets.dll
-Delete $INSTDIR\Qt5Network.dll
-Delete $INSTDIR\Qt5Svg.dll
-Delete $INSTDIR\Qt5Concurrent.dll
-Delete $INSTDIR\Qt5Xml.dll
-Delete $INSTDIR\COPYING
-Delete $INSTDIR\platforms\qwindows.dll
-RMDir $INSTDIR\platforms
-Delete $INSTDIR\styles\qwindowsvistastyle.dll
-RMDir $INSTDIR\styles
-Delete $INSTDIR\imageformats\qgif.dll
-Delete $INSTDIR\imageformats\qicns.dll
-Delete $INSTDIR\imageformats\qico.dll
-Delete $INSTDIR\imageformats\qjpeg.dll
-Delete $INSTDIR\imageformats\qsvg.dll
-Delete $INSTDIR\imageformats\qtga.dll
-Delete $INSTDIR\imageformats\qtiff.dll
-Delete $INSTDIR\imageformats\qwbmp.dll
-Delete $INSTDIR\imageformats\qwebp.dll
-RMDir $INSTDIR\imageformats
-RMDir $INSTDIR
+Function ExitASIOInstalled
+ ClearErrors
+ EnumRegKey $0 HKLM "SOFTWARE\ASIO" 0
+ IfErrors 0 SkipMessage
+ MessageBox MB_YESNO|MB_ICONEXCLAMATION "$(ASIO_EXIT_NO_DRIVER)" /sd IDNO IDYES SkipMessage
+ Abort
+ SkipMessage:
+FunctionEnd
+
+; Uninstaller
+!macro un.InstallFiles buildArch
+
+ !define prefix "${DEPLOY_PATH}\${buildArch}"
+ !tempfile files
+
+ ; Find target files
+ !system 'cmd.exe /v /c "for /r "${prefix}" %f in (*.*) do \
+ @(set "_f=%f" && echo Delete "$INSTDIR\!_f:${prefix}\=!" >> "${files}")"'
+
+ ; Find target folders in reverse order to ensure they can be deleted when empty
+ !system 'cmd.exe /v /c "for /f "usebackq" %d in \
+ (`dir /b /s /ad "${prefix}" ^| C:\Windows\System32\sort.exe /r`) do \
+ @(set "_d=%d" && echo RMDir "$INSTDIR\!_d:${prefix}\=!" >> "${files}")"'
+
+ ; Remove files and folders
+ !include "${files}"
+
+ Delete "$INSTDIR\COPYING"
+ Delete "$INSTDIR\servericon.ico"
+ Delete "$INSTDIR\${UNINSTALL_EXE}"
+ RMDir "$INSTDIR"
+
+ ; Cleanup
+ !delfile "${files}"
+ !undef files
+ !undef prefix
+
+!macroend
+
+Section "un.Install"
+ ; Delete the main application
+ ${If} ${RunningX64}
+ !insertmacro un.InstallFiles x86_64
+ ${Else}
+ !insertmacro un.InstallFiles x86
+ ${EndIf}
+
+ ; Remove the Start Menu and desktop shortcuts
+ IfFileExists "$DESKTOP\${APP_NAME}.lnk" deleteshortcut skipshortcut
+ deleteshortcut:
+ Delete "$DESKTOP\${APP_NAME}.lnk"
+ goto skipshortcut
+ skipshortcut:
+ RMDir /r "$SMPROGRAMS\${APP_NAME}"
+
+ ; There may be an auto run entry in the registry for the server, remove it
+ DeleteRegValue HKCU "${AUTORUN_KEY}" "${AUTORUN_NAME}"
+
+ ; Remove the remaining registry keys
+ DeleteRegKey HKLM "${APP_UNINSTALL_KEY}"
+ DeleteRegKey HKLM "${APP_INSTALL_KEY}"
SectionEnd
+
+Function un.onInit
+
+ ; Set up registry access for current architecture
+ ${If} ${RunningX64}
+ SetRegView 64
+ ${Else}
+ SetRegView 32
+ ${EndIf}
+
+ ; Uninstall for all users
+ SetShellVarContext all
+
+ ; Retrieve installer language
+ !insertmacro MUI_UNGETLANGUAGE
+
+FunctionEnd
+
+Function un.AbortOnRunningApp
+ !insertmacro _AbortOnRunningApp
+FunctionEnd
\ No newline at end of file
diff --git a/windows/qt-installer-windows.qs b/windows/qt-installer-windows.qs
index 8164790b74..6f5ffdfdee 100644
--- a/windows/qt-installer-windows.qs
+++ b/windows/qt-installer-windows.qs
@@ -1,92 +1,126 @@
/*
* Qt Installer script for a non-interactive installation of Qt5 on Windows.
- * Installs the 64-bit package if environment variable PLATFORM="x64".
+ *
+ * Run with:
+ * qt-unified-windows-x86-online.exe --verbose --script qt-installer-windows.qs
+ *
+ * globals QInstaller, QMessageBox, buttons, gui, installer, console
*/
-// jshint strict:false
-/* globals QInstaller, QMessageBox, buttons, gui, installer, console */
-
-// Run with:
-// .\qt-unified-windows-x86-3.0.4-online.exe --verbose --script tools\qt-installer-windows.qs
-
-// Look for Name elements in
-// https://download.qt.io/online/qtsdkrepository/windows_x86/desktop/qt5_5123/Updates.xml
-// Unfortunately it is not possible to disable deps like qt.tools.qtcreator
-var INSTALL_COMPONENTS = [
- installer.environmentVariable("PLATFORM") == "x64" ?
- "qt.qt5.5123.win64_msvc2017_64" :
- "qt.qt5.5123.win32_msvc2017",
-];
-
function Controller() {
- // Continue on installing to an existing (possibly empty) directory.
+ installer.setMessageBoxAutomaticAnswer("installationError", QMessageBox.Retry);
+ installer.setMessageBoxAutomaticAnswer("installationErrorWithRetry", QMessageBox.Retry);
+ installer.setMessageBoxAutomaticAnswer("DownloadError", QMessageBox.Retry);
+ installer.setMessageBoxAutomaticAnswer("archiveDownloadError", QMessageBox.Retry);
+
+ // Continue on installation to an existing (possibly empty) directory.
installer.setMessageBoxAutomaticAnswer("OverwriteTargetDirectory", QMessageBox.Yes);
- // Continue at "SHOW FINISHED PAGE"
+
+ // Continue at the end of the installation
installer.installationFinished.connect(function() {
- console.log("installationFinished");
+ console.log("Step: InstallationFinished");
gui.clickButton(buttons.NextButton);
});
}
-Controller.prototype.WelcomePageCallback = function() {
+
+Controller.prototype.WelcomePageCallback = function()
+{
console.log("Step: " + gui.currentPageWidget());
// At least for 3.0.4 immediately clicking Next fails, so wait a bit.
// https://github.com/benlau/qtci/commit/85cb986b66af4807a928c70e13d82d00dc26ebf0
gui.clickButton(buttons.NextButton, 1000);
};
-Controller.prototype.CredentialsPageCallback = function() {
+Controller.prototype.CredentialsPageCallback = function()
+{
console.log("Step: " + gui.currentPageWidget());
+
+ var page = gui.pageWidgetByObjectName("CredentialsPage");
+ var username = installer.environmentVariable("QT_ACCOUNT_USERNAME");
+ var password = installer.environmentVariable("QT_ACCOUNT_PASSWORD");
+ page.loginWidget.EmailLineEdit.setText(username);
+ page.loginWidget.PasswordLineEdit.setText(password);
+
gui.clickButton(buttons.NextButton);
};
-Controller.prototype.IntroductionPageCallback = function() {
+Controller.prototype.IntroductionPageCallback = function()
+{
console.log("Step: " + gui.currentPageWidget());
gui.clickButton(buttons.NextButton);
};
-Controller.prototype.TargetDirectoryPageCallback = function() {
+Controller.prototype.ObligationsPageCallback = function()
+{
+ console.log("Step: " + gui.currentPageWidget());
+
+ var page = gui.pageWidgetByObjectName("ObligationsPage");
+ page.obligationsAgreement.setChecked(true);
+ page.completeChanged();
+ gui.clickButton(buttons.NextButton);
+}
+
+Controller.prototype.DynamicTelemetryPluginFormCallback = function()
+{
+ console.log("Step: " + gui.currentPageWidget());
+
+ var page = gui.pageWidgetByObjectName("DynamicTelemetryPluginForm");
+ page.statisticGroupBox.disableStatisticRadioButton.setChecked(true);
+ gui.clickButton(buttons.NextButton);
+}
+
+Controller.prototype.TargetDirectoryPageCallback = function()
+{
console.log("Step: " + gui.currentPageWidget());
- // Keep default at "C:\Qt".
- //gui.currentPageWidget().TargetDirectoryLineEdit.setText("E:\\Qt");
gui.clickButton(buttons.NextButton);
};
Controller.prototype.ComponentSelectionPageCallback = function() {
console.log("Step: " + gui.currentPageWidget());
- var page = gui.currentPageWidget();
- page.deselectAll();
- for (var i = 0; i < INSTALL_COMPONENTS.length; i++) {
- page.selectComponent(INSTALL_COMPONENTS[i]);
- }
+
+ var selection = gui.pageWidgetByObjectName("ComponentSelectionPage");
+ gui.findChild(selection, "Latest releases").checked = false;
+ gui.findChild(selection, "LTS").checked = true;
+ gui.findChild(selection, "FetchCategoryButton").click();
+
+ // Look for Name elements in
+ // https://download.qt.io/online/qtsdkrepository/windows_x86/desktop/qt5_5123/Updates.xml
+ var widget = gui.currentPageWidget();
+ widget.deselectAll();
+ widget.selectComponent("qt.qt5.5123.win32_msvc2017");
+ widget.selectComponent("qt.qt5.5123.win64_msvc2017_64");
+
gui.clickButton(buttons.NextButton);
-};
+}
-Controller.prototype.LicenseAgreementPageCallback = function() {
+Controller.prototype.LicenseAgreementPageCallback = function()
+{
console.log("Step: " + gui.currentPageWidget());
+
gui.currentPageWidget().AcceptLicenseRadioButton.setChecked(true);
gui.clickButton(buttons.NextButton);
};
-Controller.prototype.StartMenuDirectoryPageCallback = function() {
+Controller.prototype.StartMenuDirectoryPageCallback = function()
+{
console.log("Step: " + gui.currentPageWidget());
gui.clickButton(buttons.NextButton);
};
-Controller.prototype.ReadyForInstallationPageCallback = function() {
+Controller.prototype.ReadyForInstallationPageCallback = function()
+{
console.log("Step: " + gui.currentPageWidget());
gui.clickButton(buttons.NextButton);
};
-Controller.prototype.FinishedPageCallback = function() {
+Controller.prototype.FinishedPageCallback = function()
+{
console.log("Step: " + gui.currentPageWidget());
- // TODO somehow the installer crashes after this step.
- // https://stackoverflow.com/questions/25105269/silent-install-qt-run-installer-on-ubuntu-server
+
var checkBoxForm = gui.currentPageWidget().LaunchQtCreatorCheckBoxForm;
if (checkBoxForm && checkBoxForm.launchQtCreatorCheckBox) {
checkBoxForm.launchQtCreatorCheckBox.checked = false;
}
gui.clickButton(buttons.FinishButton);
};
-
-// vim: set ft=javascript: