installer.nsi 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. !define APP_NAME "wincap11"
  2. Name ${APP_NAME}
  3. OutFile "${APP_NAME}-setup.exe"
  4. InstallDir $PROGRAMFILES\${APP_NAME}
  5. ; Store the install dir in the registry to use when updating
  6. InstallDirRegKey HKLM "Software\${APP_NAME}" "InstallDir"
  7. RequestExecutionLevel user
  8. ;##################################
  9. ; Pages
  10. Page components
  11. Page directory
  12. Page instfiles
  13. UninstPage uninstConfirm
  14. UninstPage instfiles
  15. ;##################################
  16. ; Install
  17. Section "${APP_NAME} (required)"
  18. SectionIn RO
  19. SetOutPath $INSTDIR
  20. ; App Files
  21. File /r "cmake-build-release\bin\*"
  22. ; Write the installation path into the registry
  23. WriteRegStr HKLM SOFTWARE\${APP_NAME} "InstallDir" "$INSTDIR"
  24. ; Write the uninstall keys for Windows
  25. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\YOURPROGRAM" "DisplayName" "${APP_NAME}"
  26. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\YOURPROGRAM" "UninstallString" '"$INSTDIR\uninstall.exe"'
  27. WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\YOURPROGRAM" "NoModify" 1
  28. WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\YOURPROGRAM" "NoRepair" 1
  29. WriteUninstaller "$INSTDIR\uninstall.exe"
  30. SectionEnd
  31. ; Optional section (can be disabled by the user)
  32. Section "Start Menu Shortcuts"
  33. SectionIn RO
  34. CreateDirectory "$SMPROGRAMS\${APP_NAME}"
  35. CreateShortcut "$SMPROGRAMS\${APP_NAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
  36. CreateShortcut "$SMPROGRAMS\${APP_NAME}\${APP_NAME}.lnk" "$INSTDIR\${APP_NAME}.exe" "" "$INSTDIR\${APP_NAME}.exe" 0
  37. SectionEnd
  38. ;##################################
  39. ; Uninstall
  40. Section "Uninstall"
  41. ; Remove registry keys
  42. DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}"
  43. DeleteRegKey HKLM SOFTWARE\${APP_NAME}
  44. ; Remove shortcuts
  45. Delete "$SMPROGRAMS\${APP_NAME}\*.*"
  46. ; Remove install dir
  47. RMDir "$SMPROGRAMS\${APP_NAME}"
  48. RMDir /r "$INSTDIR"
  49. SectionEnd