From 02add8bb097104dc02066fe390ec01465910fc76 Mon Sep 17 00:00:00 2001 From: Louie Shprung Date: Thu, 25 Jul 2024 16:06:34 -0400 Subject: Use installer.nsi instead of cpack -G NSIS --- nsis/installer.nsi.in | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 nsis/installer.nsi.in (limited to 'nsis') diff --git a/nsis/installer.nsi.in b/nsis/installer.nsi.in new file mode 100644 index 0000000..d731007 --- /dev/null +++ b/nsis/installer.nsi.in @@ -0,0 +1,102 @@ +;------------------------------------------------------------------------------- +; Includes +!include "MUI2.nsh" +!include "LogicLib.nsh" +!include "WinVer.nsh" +!include "x64.nsh" + +;------------------------------------------------------------------------------- +; Constants +!define PRODUCT_NAME "@PROJECT_TITLE@" +!define PRODUCT_DESCRIPTION "TODO" +!define COPYRIGHT "GNU GPLv3" +!define PRODUCT_VERSION "@NSIS_PRODUCT_VERSION@" +!define SETUP_VERSION 1.0.0.0 + +;------------------------------------------------------------------------------- +; Attributes +Name "@PROJECT_TITLE@" +OutFile "@PROJECT_TITLE@ @NSIS_PRODUCT_VERSION@ Setup.exe" +InstallDir "$PROGRAMFILES\@PROJECT_TITLE@" +InstallDirRegKey HKCU "Software\Louie S\@PROJECT_TITLE@" "" +RequestExecutionLevel user ; user|highest|admin + +;------------------------------------------------------------------------------- +; Version Info +VIProductVersion "${PRODUCT_VERSION}" +VIAddVersionKey "ProductName" "${PRODUCT_NAME}" +VIAddVersionKey "ProductVersion" "${PRODUCT_VERSION}" +VIAddVersionKey "FileDescription" "${PRODUCT_DESCRIPTION}" +VIAddVersionKey "LegalCopyright" "${COPYRIGHT}" +VIAddVersionKey "FileVersion" "${SETUP_VERSION}" + +;------------------------------------------------------------------------------- +; Modern UI Appearance +;!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico" +!define MUI_ICON "..\data\assignment-list.ico" +!define MUI_UNIICON "..\data\assignment-list.ico" +!define MUI_HEADERIMAGE +;!define MUI_HEADERIMAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Header\orange.bmp" +;!define MUI_WELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\orange.bmp" +!define MUI_FINISHPAGE_NOAUTOCLOSE +!define MUI_FINISHPAGE_RUN "@PROJECT_NAME@.exe" ; FIXME Currently does not work +!define MUI_FINISHPAGE_SHOWREADME "" +!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED +!define MUI_FINISHPAGE_SHOWREADME_TEXT "Create Desktop Shortcut" +!define MUI_FINISHPAGE_SHOWREADME_FUNCTION installDesktopShortcut + +;------------------------------------------------------------------------------- +; Installer Pages +!insertmacro MUI_PAGE_WELCOME +!insertmacro MUI_PAGE_LICENSE "..\LICENSE" +!insertmacro MUI_PAGE_COMPONENTS +!insertmacro MUI_PAGE_DIRECTORY +Var StartMenuFolder +!insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder +!insertmacro MUI_PAGE_INSTFILES +!insertmacro MUI_PAGE_FINISH + +;------------------------------------------------------------------------------- +; Uninstaller Pages +!insertmacro MUI_UNPAGE_WELCOME +!insertmacro MUI_UNPAGE_CONFIRM +!insertmacro MUI_UNPAGE_INSTFILES +!insertmacro MUI_UNPAGE_FINISH + +;------------------------------------------------------------------------------- +; Languages +!insertmacro MUI_LANGUAGE "English" + +;------------------------------------------------------------------------------- +; Installer Sections +Section "My Application" MyApp + SetOutPath $INSTDIR + File "@CMAKE_CURRENT_BINARY_DIR@\@PROJECT_NAME@.exe" + File /r "qtDeploy\*.*" ; FIXME need to include additional dlls to make fully portable + ;File "Readme.txt" ; TODO consider breaking into bin/ so that README can be included in the base, or in doc/ + !insertmacro MUI_STARTMENU_WRITE_BEGIN Application + CreateDirectory "$SMPROGRAMS\$StartMenuFolder\" + CreateShortCut "$SMPROGRAMS\$StartMenuFolder\@PROJECT_TITLE@.lnk" "$INSTDIR\@PROJECT_NAME@.exe" + CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk" "$INSTDIR\Uninstall.exe" + !insertmacro MUI_STARTMENU_WRITE_END + WriteUninstaller "$INSTDIR\Uninstall.exe" +SectionEnd + +Function installDesktopShortcut + CreateShortCut "$Desktop\@PROJECT_TITLE@.lnk" "$INSTDIR\@PROJECT_NAME@.exe" +FunctionEnd + +;------------------------------------------------------------------------------- +; Uninstaller Sections +Section "Uninstall" + #Delete "$INSTDIR\@PROJECT_NAME@.exe" + #Delete "$INSTDIR\*.dll" + #Delete "$INSTDIR\Uninstall.exe" + Delete "$Desktop\@PROJECT_TITLE@.lnk" + !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder + Delete "$SMPROGRAMS\$StartMenuFolder\@PROJECT_TITLE@.lnk" + Delete "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk" + RMDir "$SMPROGRAMS\$StartMenuFolder" + RMDir /r "$INSTDIR" + ;DeleteRegKey /ifempty HKCU "Software\Modern UI Test" +SectionEnd -- cgit