forked from zzattack/ccmaps-net
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnsisinstaller-dbg.nsi
120 lines (93 loc) · 3.36 KB
/
nsisinstaller-dbg.nsi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
!ifndef CONFIG
!define CONFIG "debug"
!endif
!include LogicLib.nsh
!include Sections.nsh
; Define your application name
!define APPNAME "CNCMaps"
!define VERSION $%VER% ; environment variable, call from .bat file
!define APPNAMEANDVERSION "CNCMaps ${VERSION}"
; Main Install settings
Name "${APPNAMEANDVERSION}"
InstallDir "$PROGRAMFILES\CNCMaps"
InstallDirRegKey HKLM "Software\${APPNAME}" ""
OutFile "CNCMaps_${CONFIG}_v${VERSION}.exe"
; Use compression
SetCompressor LZMA
; Modern interface settings
!include "MUI.nsh"
!define MUI_ABORTWARNING
!define MUI_FINISHPAGE_RUN "$INSTDIR\CNCMaps.Renderer.GUI.exe"
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
; Set languages (first is default language)
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_RESERVEFILE_LANGDLL
Section "Maps Renderer" sec_program
; Set Section properties
SetOverwrite on
; Set Section Files and Shortcuts
SetOutPath "$INSTDIR\"
File "CNCMaps.Renderer\bin\${CONFIG}\CNCMaps.Renderer.exe"
File "CNCMaps.Renderer.GUI\bin\${CONFIG}\CNCMaps.Renderer.GUI.exe"
File "CNCMaps.Shared\bin\${CONFIG}\CNCMaps.Shared.dll"
File "CNCMaps.FileFormats\bin\${CONFIG}\CNCMaps.FileFormats.dll"
File "CNCMaps.Engine\bin\${CONFIG}\CNCMaps.Engine.dll"
; these are no longer used
Delete "$INSTDIR\NLog.config"
Delete "$INSTDIR\NLog.Debug.config"
SetOverwrite ifnewer
File "Lib\NLog.dll"
File "Lib\OSMesa.dll"
File "Lib\OpenTK.dll"
SectionEnd
Section /o "Start menu shortcuts" sec_shortcut_startmenu
CreateShortCut "$SMPROGRAMS\CNC Maps renderer.lnk" "$INSTDIR\CNCMaps.Renderer.GUI.exe"
SectionEnd
Section /o "Desktop shortcut" sec_shortcut_desktop
CreateShortCut "$DESKTOP\CNCMaps Renderer.lnk" "$INSTDIR\CNCMaps.Renderer.GUI.exe"
SectionEnd
Section -FinishSection
WriteRegStr HKLM "Software\${APPNAME}" "" "$INSTDIR"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayName" "${APPNAME}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "UninstallString" "$INSTDIR\uninstall.exe"
WriteUninstaller "$INSTDIR\uninstall.exe"
SectionEnd
; Modern install component descriptions
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${sec_program} ""
!insertmacro MUI_FUNCTION_DESCRIPTION_END
;Uninstall section
Section Uninstall
;Remove from registry...
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}"
DeleteRegKey HKLM "SOFTWARE\${APPNAME}"
; Delete self
Delete "$INSTDIR\uninstall.exe"
; Delete Shortcuts
Delete "$DESKTOP\CNCMaps Renderer.lnk"
Delete "$SMPROGRAMS\CNC Maps renderer.lnk"
Delete "$SMPROGRAMS\CNCMaps\CNC Maps renderer.lnk" # old locations
Delete "$SMPROGRAMS\CNCMaps\Uninstall.lnk"
; Clean up Maps Renderer
Delete "$INSTDIR\CNCMaps.Renderer.exe"
Delete "$INSTDIR\CNCMaps.Renderer.GUI.exe"
Delete "$INSTDIR\CNCMaps.Shared.dll"
Delete "$INSTDIR\CNCMaps.FileFormats.dll"
Delete "$INSTDIR\CNCMaps.Engine.dll"
Delete "$INSTDIR\NLog.dll"
Delete "$INSTDIR\NLog.config"
Delete "$INSTDIR\NLog.Debug.config"
Delete "$INSTDIR\opengl32.dll"
Delete "$INSTDIR\osmesa.dll"
; Remove remaining directories
RMDir "$SMPROGRAMS\CNCMaps" # old
RMDir "$INSTDIR\"
SectionEnd
BrandingText "by Frank Razenberg"
; eof