hypercube.nsi 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. !include "MUI2.nsh"
  2. !include "x64.nsh"
  3. ; The name of the installer
  4. Name "Hypercube"
  5. ; Program version
  6. !define VERSION "1.7.0"
  7. ; The file to write
  8. OutFile "Hypercube-${VERSION}.exe"
  9. RequestExecutionLevel admin
  10. ; The default installation directory
  11. InstallDir "$PROGRAMFILES\Hypercube"
  12. ; Registry key to check for directory (so if you install again, it will
  13. ; overwrite the old one automatically)
  14. InstallDirRegKey HKLM "Software\Hypercube" "Install_Dir"
  15. ; Registry key for uninstaller
  16. !define REGENTRY "Software\Microsoft\Windows\CurrentVersion\Uninstall\Hypercube"
  17. ; Start menu page configuration
  18. !define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
  19. !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\Hypercube"
  20. !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Hypercube"
  21. Var StartMenuFolder
  22. ;--------------------------------
  23. ; Pages
  24. !insertmacro MUI_PAGE_WELCOME
  25. !insertmacro MUI_PAGE_LICENSE "licence.txt"
  26. !insertmacro MUI_PAGE_COMPONENTS
  27. !insertmacro MUI_PAGE_DIRECTORY
  28. !insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder
  29. !insertmacro MUI_PAGE_INSTFILES
  30. !insertmacro MUI_UNPAGE_CONFIRM
  31. !insertmacro MUI_UNPAGE_INSTFILES
  32. ;--------------------------------
  33. ; Languages
  34. !insertmacro MUI_LANGUAGE "English"
  35. ; The stuff to install
  36. Section "Hypercube (required)" SEC_GUI_APP
  37. SectionIn RO
  38. ; Set output path to the installation directory.
  39. SetOutPath $INSTDIR
  40. ; Put file there
  41. File "hypercube.exe"
  42. ; Write the installation path into the registry
  43. WriteRegStr HKLM SOFTWARE\Hypercube "Install_Dir" "$INSTDIR"
  44. ; Write the uninstall keys for Windows
  45. WriteRegStr HKLM "${REGENTRY}" "DisplayName" "Hypercube"
  46. WriteRegStr HKLM "${REGENTRY}" "Publisher" "Martin Tuma"
  47. WriteRegStr HKLM "${REGENTRY}" "DisplayVersion" "${VERSION}"
  48. WriteRegStr HKLM "${REGENTRY}" "UninstallString" '"$INSTDIR\uninstall.exe"'
  49. WriteRegDWORD HKLM "${REGENTRY}" "NoModify" 1
  50. WriteRegDWORD HKLM "${REGENTRY}" "NoRepair" 1
  51. WriteUninstaller "$INSTDIR\uninstall.exe"
  52. ; Create start menu entry and add links
  53. SetShellVarContext all
  54. !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
  55. CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
  56. CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
  57. CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Hypercube.lnk" "$INSTDIR\hypercube.exe"
  58. !insertmacro MUI_STARTMENU_WRITE_END
  59. SectionEnd
  60. Section "Hypercube-cli" SEC_CLI_APP
  61. File "hypercube-cli.exe"
  62. ; Add Start menu link
  63. !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
  64. CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Hypercube-cli.lnk" "$INSTDIR\hypercube-cli.exe"
  65. !insertmacro MUI_STARTMENU_WRITE_END
  66. SectionEnd
  67. Section "QT libs" SEC_QT
  68. File "Qt5Core.dll"
  69. File "Qt5Gui.dll"
  70. File "Qt5Widgets.dll"
  71. File "libGLESv2.dll"
  72. File /r "platforms"
  73. SectionEnd
  74. Section "MSVC runtime" SEC_MSVC
  75. DetailPrint "Checking whether Visual C++ 2015 Redistributable is already installed..."
  76. ${If} ${RunningX64}
  77. ReadRegDword $R0 HKLM "SOFTWARE\Wow6432Node\Microsoft\VisualStudio\14.0\VC\Runtimes\x86" "Installed"
  78. ${Else}
  79. ReadRegDword $R0 HKLM "SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x86" "Installed"
  80. ${EndIf}
  81. StrCmp $R0 "1" 0 +3
  82. DetailPrint "Visual C++ 2015 Redistributable is already installed, skipping install."
  83. Goto done
  84. DetailPrint "Installing Visual C++ 2015 Redistributable..."
  85. SetOutPath $TEMP
  86. File "VC_redist.x86.exe"
  87. ExecWait '"$TEMP/VC_redist.x86.exe" /install /quiet /norestart'
  88. done:
  89. SectionEnd
  90. ;--------------------------------
  91. ; Uninstaller
  92. Section "Uninstall"
  93. ; Remove registry keys
  94. DeleteRegKey HKLM "${REGENTRY}"
  95. DeleteRegKey HKLM SOFTWARE\Hypercube
  96. ; Remove directories used
  97. RMDir /r "$INSTDIR"
  98. ; Remove Start menu entries
  99. SetShellVarContext all
  100. !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
  101. Delete "$SMPROGRAMS\$StartMenuFolder\*.*"
  102. RMDir "$SMPROGRAMS\$StartMenuFolder"
  103. SectionEnd
  104. ;-------------------------------
  105. ;Descriptions
  106. ;Language strings
  107. LangString DESC_QT ${LANG_ENGLISH} \
  108. "QT Library. Unselct only if you have QT already installed!"
  109. LangString DESC_MSVC ${LANG_ENGLISH} \
  110. "Visual C++ 2015 runtime components. Unselct only if you have the runtime already installed!"
  111. LangString DESC_GUI_APP ${LANG_ENGLISH} \
  112. "Hypercube application"
  113. LangString DESC_CLI_APP ${LANG_ENGLISH} \
  114. "Hypercube command line tool"
  115. ;Assign language strings to sections
  116. !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
  117. !insertmacro MUI_DESCRIPTION_TEXT ${SEC_QT} $(DESC_QT)
  118. !insertmacro MUI_DESCRIPTION_TEXT ${SEC_MSVC} $(DESC_MSVC)
  119. !insertmacro MUI_DESCRIPTION_TEXT ${SEC_GUI_APP} $(DESC_GUI_APP)
  120. !insertmacro MUI_DESCRIPTION_TEXT ${SEC_CLI_APP} $(DESC_CLI_APP)
  121. !insertmacro MUI_FUNCTION_DESCRIPTION_END