[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 make
``` ```
## Building the installer ## Building the Windows installer
Install NSIS compiler Install NSIS compiler
Build the host program, see above sections. 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? ## Where is the log?

View File

@ -34,3 +34,9 @@ target_include_directories(platform_Windows
PRIVATE PRIVATE
src 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" !include "Sections.nsh"
;Settings ;Settings
Name "Looking Glass Host" Name "Looking Glass (host)"
OutFile "..\build\looking-glass-host-setup.exe" OutFile "looking-glass-host-setup.exe"
Unicode true Unicode true
RequestExecutionLevel admin RequestExecutionLevel admin
ShowInstDetails "show" ShowInstDetails "show"
ShowUninstDetails "show" ShowUninstDetails "show"
InstallDir "$PROGRAMFILES64\Looking Glass" InstallDir "$PROGRAMFILES64\Looking Glass (host)"
!define MUI_ICON "..\..\resources\icon.ico" !define MUI_ICON "icon.ico"
!define MUI_UNICON "..\..\resources\icon.ico" !define MUI_UNICON "icon.ico"
!define MUI_LICENSEPAGE_BUTTON "Agree" !define MUI_LICENSEPAGE_BUTTON "Agree"
!define /file VERSION "..\..\VERSION" !define /file VERSION "VERSION"
;Install and uninstall pages ;Install and uninstall pages
!insertmacro MUI_PAGE_LICENSE "..\..\LICENSE" !insertmacro MUI_PAGE_LICENSE "LICENSE.txt"
!insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_COMPONENTS !insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_PAGE_INSTFILES
@ -106,37 +106,39 @@ FunctionEnd
;Install ;Install
Section "-Install" Section1 Section "-Install" Section1
nsExec::Exec 'net.exe STOP "Looking Glass (host)"'
SetOutPath $INSTDIR SetOutPath $INSTDIR
File ..\build\looking-glass-host.exe File ..\..\looking-glass-host.exe
File /oname=LICENSE.txt ..\..\LICENSE File LICENSE.txt
WriteUninstaller $INSTDIR\uninstaller.exe WriteUninstaller $INSTDIR\uninstaller.exe
${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2 ${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2
IntFmt $0 "0x%08X" $0 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" "EstimatedSize" "$0"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking-Glass" \ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking Glass (host)" \
"DisplayName" "Looking-Glass" "DisplayName" "Looking Glass"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking-Glass" \ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking Glass (host)" \
"UninstallString" "$\"$INSTDIR\uninstaller.exe$\"" "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" "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" "InstallLocation" "$INSTDIR"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking-Glass" \ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking Glass (host)" \
"Publisher" "Geoffrey McRae" "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$\"" "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" "NoRepair" "1"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking-Glass" \ WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking Glass (host)" \
"NoModify" "1" "NoModify" "1"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking-Glass" \ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking Glass (host)" \
"DisplayVersion" ${VERSION} "DisplayVersion" ${VERSION}
SectionEnd SectionEnd
Section "Looking-Glass Service" Section2 Section "Looking Glass (host) Service" Section2
${If} $option_noservice == 0 ${If} $option_noservice == 0
nsExec::Exec '"$INSTDIR\looking-glass-host.exe" UninstallService' nsExec::Exec '"$INSTDIR\looking-glass-host.exe" UninstallService'
@ -157,11 +159,11 @@ Section "-Hidden Start Menu" Section5
SetShellVarContext all SetShellVarContext all
${If} $option_startMenu == 1 ${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} ${EndIf}
${If} $option_desktop == 1 ${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} ${EndIf}
SectionEnd SectionEnd
@ -169,22 +171,22 @@ SectionEnd
Section "Uninstall" Section6 Section "Uninstall" Section6
SetShellVarContext all SetShellVarContext all
nsExec::Exec 'net.exe STOP "Looking Glass (host)"'
nsExec::Exec '"$INSTDIR\looking-glass-host.exe" UninstallService' nsExec::Exec '"$INSTDIR\looking-glass-host.exe" UninstallService'
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking-Glass" DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Looking Glass (host)"
Delete $SMPROGRAMS\Looking-Glass-Host.lnk Delete "$SMPROGRAMS\Looking Glass (host).lnk"
Delete $DESKTOP\Looking-Glass-Host.lnk Delete "$DESKTOP\Looking Glass (host).lnk"
Delete $INSTDIR\uninstaller.exe Delete "$INSTDIR\uninstaller.exe"
Delete $INSTDIR\looking-glass-host.exe Delete "$INSTDIR\looking-glass-host.exe"
Delete $INSTDIR\LICENSE.txt Delete "$INSTDIR\LICENSE.txt"
RMDir $INSTDIR RMDir $INSTDIR
SectionEnd SectionEnd
;Description text for selection of install items ;Description text for selection of install items
LangString DESC_Section1 ${LANG_ENGLISH} "Install Files into $INSTDIR" 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_Section3 ${LANG_ENGLISH} "Create desktop shortcut icon."
LangString DESC_Section4 ${LANG_ENGLISH} "Create start menu shortcut." 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 <userenv.h>
#include <wtsapi32.h> #include <wtsapi32.h>
#define SVCNAME "Looking Glass Host" #define SVCNAME "Looking Glass (host)"
#define SVC_ERROR ((DWORD)0xC0020001L) #define SVC_ERROR ((DWORD)0xC0020001L)
struct Service struct Service