[host] Windows: multiple fixes to the installer

This commit is contained in:
Geoffrey McRae 2020-08-12 21:50:48 +10:00
parent 7dba6b9b08
commit 15d1a74291
5 changed files with 96 additions and 86 deletions

View file

@ -1 +1 @@
B2-rc3-21-g380b5df9f9+1
B2-rc3-30-g7dba6b9b08+1

View file

@ -44,11 +44,13 @@ cmake -DCMAKE_TOOLCHAIN_FILE=../toolchain-mingw64.cmake ..
make
```
## Building the installer
## Building the Windows installer
Install NSIS compiler
Build the host program, see above sections.
Build installer with `makensis c-host/installer/installer.nsi`
Build installer with `makensis platform/Windows/installer.nsi`
The resulting installer will be at
`platform/Windows/looking-glass-host-setup.exe`
## Where is the log?

View file

@ -34,3 +34,9 @@ target_include_directories(platform_Windows
PRIVATE
src
)
# these are for the nsis installer generator
configure_file("${PROJECT_SOURCE_DIR}/installer.nsi" "${PROJECT_BINARY_DIR}/installer.nsi" COPYONLY)
configure_file("${PROJECT_TOP}/resources/icon.ico" "${PROJECT_BINARY_DIR}/icon.ico" COPYONLY)
configure_file("${PROJECT_TOP}/VERSION" "${PROJECT_BINARY_DIR}/VERSION" COPYONLY)
configure_file("${PROJECT_TOP}/LICENSE" "${PROJECT_BINARY_DIR}/LICENSE.txt" COPYONLY)

View file

@ -25,21 +25,21 @@ Place, Suite 330, Boston, MA 02111-1307 USA
!include "Sections.nsh"
;Settings
Name "Looking Glass Host"
OutFile "..\build\looking-glass-host-setup.exe"
Name "Looking Glass (host)"
OutFile "looking-glass-host-setup.exe"
Unicode true
RequestExecutionLevel admin
ShowInstDetails "show"
ShowUninstDetails "show"
InstallDir "$PROGRAMFILES64\Looking Glass"
InstallDir "$PROGRAMFILES64\Looking Glass (host)"
!define MUI_ICON "..\..\resources\icon.ico"
!define MUI_UNICON "..\..\resources\icon.ico"
!define MUI_ICON "icon.ico"
!define MUI_UNICON "icon.ico"
!define MUI_LICENSEPAGE_BUTTON "Agree"
!define /file VERSION "..\..\VERSION"
!define /file VERSION "VERSION"
;Install and uninstall pages
!insertmacro MUI_PAGE_LICENSE "..\..\LICENSE"
!insertmacro MUI_PAGE_LICENSE "LICENSE.txt"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_INSTFILES
@ -106,37 +106,39 @@ FunctionEnd
;Install
Section "-Install" Section1
nsExec::Exec 'net.exe STOP "Looking Glass (host)"'
SetOutPath $INSTDIR
File ..\build\looking-glass-host.exe
File /oname=LICENSE.txt ..\..\LICENSE
File ..\..\looking-glass-host.exe
File LICENSE.txt
WriteUninstaller $INSTDIR\uninstaller.exe
${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2
IntFmt $0 "0x%08X" $0
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking-Glass" \
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking Glass (host)" \
"EstimatedSize" "$0"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking-Glass" \
"DisplayName" "Looking-Glass"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking-Glass" \
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking Glass (host)" \
"DisplayName" "Looking Glass"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking Glass (host)" \
"UninstallString" "$\"$INSTDIR\uninstaller.exe$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking-Glass" \
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking Glass (host)" \
"QuietUninstallString" "$\"$INSTDIR\uninstaller.exe$\" /S"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking-Glass" \
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking Glass (host)" \
"InstallLocation" "$INSTDIR"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking-Glass" \
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking Glass (host)" \
"Publisher" "Geoffrey McRae"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking-Glass" \
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking Glass (host)" \
"DisplayIcon" "$\"$INSTDIR\looking-glass-host.exe$\""
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking-Glass" \
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking Glass (host)" \
"NoRepair" "1"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking-Glass" \
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking Glass (host)" \
"NoModify" "1"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking-Glass" \
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking Glass (host)" \
"DisplayVersion" ${VERSION}
SectionEnd
Section "Looking-Glass Service" Section2
Section "Looking Glass (host) Service" Section2
${If} $option_noservice == 0
nsExec::Exec '"$INSTDIR\looking-glass-host.exe" UninstallService'
@ -157,11 +159,11 @@ Section "-Hidden Start Menu" Section5
SetShellVarContext all
${If} $option_startMenu == 1
CreateShortCut $SMPROGRAMS\Looking Glass (host).lnk $INSTDIR\looking-glass-host.exe
CreateShortCut "$SMPROGRAMS\Looking Glass (host).lnk" $INSTDIR\looking-glass-host.exe
${EndIf}
${If} $option_desktop == 1
CreateShortCut $DESKTOP\Looking Glass (host).lnk $INSTDIR\looking-glass-host.exe
CreateShortCut "$DESKTOP\Looking Glass (host).lnk" $INSTDIR\looking-glass-host.exe
${EndIf}
SectionEnd
@ -169,22 +171,22 @@ SectionEnd
Section "Uninstall" Section6
SetShellVarContext all
nsExec::Exec 'net.exe STOP "Looking Glass (host)"'
nsExec::Exec '"$INSTDIR\looking-glass-host.exe" UninstallService'
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking-Glass"
Delete $SMPROGRAMS\Looking-Glass-Host.lnk
Delete $DESKTOP\Looking-Glass-Host.lnk
Delete $INSTDIR\uninstaller.exe
Delete $INSTDIR\looking-glass-host.exe
Delete $INSTDIR\LICENSE.txt
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking Glass (host)"
Delete "$SMPROGRAMS\Looking Glass (host).lnk"
Delete "$DESKTOP\Looking Glass (host).lnk"
Delete "$INSTDIR\uninstaller.exe"
Delete "$INSTDIR\looking-glass-host.exe"
Delete "$INSTDIR\LICENSE.txt"
RMDir $INSTDIR
SectionEnd
;Description text for selection of install items
LangString DESC_Section1 ${LANG_ENGLISH} "Install Files into $INSTDIR"
LangString DESC_Section2 ${LANG_ENGLISH} "Create service to automatically start Looking-Glass."
LangString DESC_Section2 ${LANG_ENGLISH} "Install service to automatically start Looking Glass (host)."
LangString DESC_Section3 ${LANG_ENGLISH} "Create desktop shortcut icon."
LangString DESC_Section4 ${LANG_ENGLISH} "Create start menu shortcut."

View file

@ -34,7 +34,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
#include <userenv.h>
#include <wtsapi32.h>
#define SVCNAME "Looking Glass Host"
#define SVCNAME "Looking Glass (host)"
#define SVC_ERROR ((DWORD)0xC0020001L)
struct Service