MSVC: Update post-build installer for Inno Setup

This commit is contained in:
SupSuper 2018-12-19 20:15:11 +00:00 committed by Filippos Karapetis
parent b66711da04
commit 3091345af3
4 changed files with 27 additions and 40 deletions

View file

@ -710,7 +710,7 @@ void displayHelp(const char *exe) {
" The default is \"12\", thus \"Visual Studio 2013\"\n" " The default is \"12\", thus \"Visual Studio 2013\"\n"
" --build-events Run custom build events as part of the build\n" " --build-events Run custom build events as part of the build\n"
" (default: false)\n" " (default: false)\n"
" --installer Create NSIS installer after the build (implies --build-events)\n" " --installer Create installer after the build (implies --build-events)\n"
" (default: false)\n" " (default: false)\n"
" --tools Create project files for the devtools\n" " --tools Create project files for the devtools\n"
" (ignores --build-events and --installer, as well as engine settings)\n" " (ignores --build-events and --installer, as well as engine settings)\n"

View file

@ -245,7 +245,7 @@ struct BuildSetup {
bool devTools; ///< Generate project files for the tools bool devTools; ///< Generate project files for the tools
bool tests; ///< Generate project files for the tests bool tests; ///< Generate project files for the tests
bool runBuildEvents; ///< Run build events as part of the build (generate revision number and copy engine/theme data & needed files to the build folder bool runBuildEvents; ///< Run build events as part of the build (generate revision number and copy engine/theme data & needed files to the build folder
bool createInstaller; ///< Create NSIS installer after the build bool createInstaller; ///< Create installer after the build
bool useSDL2; ///< Whether to use SDL2 or not. bool useSDL2; ///< Whether to use SDL2 or not.
BuildSetup() { BuildSetup() {

View file

@ -105,7 +105,7 @@ protected:
* Get the command line for copying data files to the build directory. * Get the command line for copying data files to the build directory.
* *
* @param isWin32 Bitness of property file. * @param isWin32 Bitness of property file.
* @param createInstaller true to NSIS create installer * @param createInstaller true to create installer
* *
* @return The post build event. * @return The post build event.
*/ */

View file

@ -21,14 +21,14 @@
' '
'/ '/
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' This script calls the makensis tool to generate a NSIS Windows installer for ScummVM ' This script calls the iscc tool to generate a Inno Setup Windows installer for ScummVM
' '
' It tries to read the NSIS installation folder from the registry and then calls the ' It tries to read the Inno Setup installation folder from the registry and then calls the
' command line script compiler to create the installer. ' command line script compiler to create the installer.
' '
' This is called from the postbuild.cmd batch file ' This is called from the postbuild.cmd batch file
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'================================================================ '================================================================
' TODO: Reduce duplication with revision.vbs script ' TODO: Reduce duplication with revision.vbs script
@ -43,7 +43,6 @@ Dim WshShell : Set WshShell = CreateObject("WScript.Shell")
' Folders ' Folders
Dim rootFolder : rootFolder = "" Dim rootFolder : rootFolder = ""
Dim targetFolder : targetFolder = "" Dim targetFolder : targetFolder = ""
Dim arch : arch = ""
' Parse our command line arguments ' Parse our command line arguments
If ParseCommandLine() Then If ParseCommandLine() Then
@ -54,31 +53,20 @@ End If
'// Installer creation '// Installer creation
'//////////////////////////////////////////////////////////////// '////////////////////////////////////////////////////////////////
Sub CreateInstaller() Sub CreateInstaller()
' Get nsis installation folder ' Get inno installation folder
Dim nsisPath : nsisPath = GetNSISPath() Dim innoPath : innoPath = GetInnoPath()
If (nsisPath = "") Then If (innoPath = "") Then
Exit Sub Exit Sub
End If End If
' Preprocess architecture
Select Case arch
Case "x86"
arch = "win32"
Case "x64"
arch = "win64"
End Select
' Build command line ' Build command line
Dim commandLine : commandLine = """" & nsisPath & "\makensis.exe"" /V2" & _ Dim commandLine : commandLine = """" & innoPath & "\iscc.exe"" /Qp" & _
" /Dtop_srcdir=""" & rootFolder & """" & _ " /O""" & targetFolder & """" & _
" /Dstaging_dir=""" & targetFolder & """" & _ " """ & rootFolder & "\dists\win32\scummvm.iss"""
" /DARCH=""" & arch & """" & _
" """ & rootFolder & "\dists\win32\scummvm.nsi"""
Dim oExec: Set oExec = WshShell.Exec(commandline) Dim oExec: Set oExec = WshShell.Exec(commandline)
If Err.Number <> 0 Then If Err.Number <> 0 Then
Wscript.StdErr.WriteLine "Error running makensis.exe!" Wscript.StdErr.WriteLine "Error running iscc.exe!"
Exit Sub Exit Sub
End If End If
@ -98,25 +86,25 @@ Sub CreateInstaller()
End If End If
End Sub End Sub
Function GetNSISPath() Function GetInnoPath()
' Get the directory where NSIS (should) reside(s) ' Get the directory where Inno Setup (should) reside(s)
Dim sNSIS Dim sInno
' First, try with 32-bit architecture ' First, try with 32-bit architecture
sNSIS = ReadRegistryKey("HKLM", "SOFTWARE\NSIS", "", 32) sInno = ReadRegistryKey("HKLM", "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Inno Setup 5_is1", "InstallLocation", 32)
If sNSIS = "" Or IsNull(sNSIS) Then If sInno = "" Or IsNull(sInno) Then
' No 32-bit version of TortoiseSVN installed, try 64-bit version (doesn't hurt on 32-bit machines, it returns nothing or is ignored) ' No 32-bit version of Inno Setup installed, try 64-bit version (doesn't hurt on 32-bit machines, it returns nothing or is ignored)
sNSIS = ReadRegistryKey("HKLM", "SOFTWARE\NSIS", "", 64) sInno = ReadRegistryKey("HKLM", "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Inno Setup 5_is1", "InstallLocation", 64)
End If End If
' Check if Tortoise is present ' Check if Inno Setup is present
If sNSIS = "" Then If sInno = "" Then
Wscript.StdErr.WriteLine "NSIS not installed!" Wscript.StdErr.WriteLine "Inno Setup not installed!"
Exit Function Exit Function
End If End If
GetNSISPath = sNSIS GetInnoPath = sInno
End Function End Function
'//////////////////////////////////////////////////////////////// '////////////////////////////////////////////////////////////////
@ -125,8 +113,8 @@ End Function
Function ParseCommandLine() Function ParseCommandLine()
ParseCommandLine = True ParseCommandLine = True
If Wscript.Arguments.Count <> 3 Then If Wscript.Arguments.Count <> 2 Then
Wscript.StdErr.WriteLine "[Error] Invalid number of arguments (was: " & Wscript.Arguments.Count & ", expected: 3)" Wscript.StdErr.WriteLine "[Error] Invalid number of arguments (was: " & Wscript.Arguments.Count & ", expected: 2)"
ParseCommandLine = False ParseCommandLine = False
Exit Function Exit Function
@ -135,7 +123,6 @@ Function ParseCommandLine()
' Get our arguments ' Get our arguments
rootFolder = Wscript.Arguments.Item(0) rootFolder = Wscript.Arguments.Item(0)
targetFolder = Wscript.Arguments.Item(1) targetFolder = Wscript.Arguments.Item(1)
arch = Wscript.Arguments.Item(2)
' Check that the folders are valid ' Check that the folders are valid
If Not FSO.FolderExists(rootFolder) Then If Not FSO.FolderExists(rootFolder) Then