-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathCalVR.nsi
237 lines (180 loc) · 6.62 KB
/
CalVR.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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
!include "EnvVarUpdate.nsh"
!include "winmessages.nsh"
!include LogicLib.nsh
; The name of the installer
Name "CalVR"
; The file to write
OutFile "CalVR-installer.exe"
; The default installation directory
InstallDir $PROGRAMFILES\CalVR
; Registry key to check for directory (so if you install again, it will
; overwrite the old one automatically)
InstallDirRegKey HKLM "Software\CalVR" "Install_Dir"
; Request application privileges for Windows Vista
RequestExecutionLevel admin
;--------------------------------
; Pages
Page components
Page directory
Page instfiles
UninstPage uninstConfirm
UninstPage instfiles
;--------------------------------
; The stuff to install
Section "CalVR (required)"
SectionIn RO
; Set output path to the installation directory.
SetOutPath $INSTDIR\bin
; Put file there
File "bin\CalVR.exe"
File "bin\CalVRAll.dll"
SetOutPath $INSTDIR\bin\calvr-plugins
File "bin\calvr-plugins\ClipPlane.dll"
File "bin\calvr-plugins\CollaborativePlugin.dll"
File "bin\calvr-plugins\MenuBasics.dll"
File "bin\calvr-plugins\ModelLoader.dll"
SetOutPath $INSTDIR\config
File "config\config.xml"
File "config\oculus.xml"
SetOutPath $INSTDIR
File /r "resources"
File /r "shaders"
File /r "icons"
; Write the installation path into the registry
WriteRegStr HKLM SOFTWARE\CalVR "Install_Dir" "$INSTDIR"
; Write the uninstall keys for Windows
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\CalVR" "DisplayName" "CalVR"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\CalVR" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\CalVR" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\CalVR" "NoRepair" 1
WriteUninstaller "uninstall.exe"
${EnvVarUpdate} $0 "PATH" "A" "HKLM" "$INSTDIR\bin"
${EnvVarUpdate} $0 "PATH" "A" "HKLM" "$INSTDIR\3rdParty\bin"
; HKLM (all users) vs HKCU (current user) defines
!define env_hklm 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
!define env_hkcu 'HKCU "Environment"'
; set variable
ReadEnvStr $R0 "OSG_NOTIFY_LEVEL"
${If} $R0 == ""
WriteRegExpandStr ${env_hklm} "OSG_NOTIFY_LEVEL" "always"
${EndIf}
ReadEnvStr $R0 "CALVR_CONFIG_DIR"
${If} $R0 == ""
WriteRegExpandStr ${env_hklm} "CALVR_CONFIG_DIR" "$INSTDIR\config"
${EndIf}
ReadEnvStr $R0 "CALVR_CONFIG_FILE"
${If} $R0 == ""
WriteRegExpandStr ${env_hklm} "CALVR_CONFIG_File" "config.xml"
${EndIf}
ReadEnvStr $R0 "CALVR_HOME"
${If} $R0 == ""
WriteRegExpandStr ${env_hklm} "CALVR_HOME" "$INSTDIR"
${EndIf}
ReadEnvStr $R0 "CALVR_HOST_NAME"
${If} $R0 == ""
WriteRegExpandStr ${env_hklm} "CALVR_HOST_NAME" "winInst"
${EndIf}
; make sure windows knows about the change
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
SectionEnd
Section "3rd Party Dependencies (required)"
SetOutPath $INSTDIR\3rdParty\bin
File "..\deps\boost\lib\*.dll"
File "..\deps\Coin\bin\*"
File "..\deps\collada-dom\bin\*"
File "..\deps\CURL\bin\*"
File "..\deps\glew\bin\*"
File "..\deps\hidapi\bin\*"
File "..\deps\libxml2\bin\*"
File "..\deps\mxml\bin\*"
File /r "..\deps\OpenSceneGraph\bin\*"
File "..\deps\openvr\bin\win64\*.dll"
File "..\deps\png\bin\*"
File "..\deps\SDL\bin\*"
File "..\deps\simage\bin\*"
File "..\deps\tiff\bin\*"
File "..\deps\vrpn\bin\*"
File "..\deps\zlib\bin\*"
SetOutPath $INSTDIR\3rdParty\include
File /r "..\deps\boost\include\*"
File /r "..\deps\Coin\include\*"
File /r "..\deps\collada-dom\include\*"
File /r "..\deps\CURL\include\*"
File /r "..\deps\freetype\include\*"
File /r "..\deps\gdal\include\*"
File /r "..\deps\gif\include\*"
File /r "..\deps\glew\include\*"
File /r "..\deps\hidapi\include\*"
File /r "..\deps\jpeg\include\*"
File /r "..\deps\libxml2\include\*"
File /r "..\deps\mxml\include\*"
File /r "..\deps\OpenSceneGraph\include\*"
File /r "..\deps\openvr\headers\*"
File /r "..\deps\png\include\*"
File /r "..\deps\SDL\include\*"
File /r "..\deps\simage\include\*"
File /r "..\deps\tiff\include\*"
File /r "..\deps\vrpn\include\*"
File /r "..\deps\zlib\include\*"
SetOutPath $INSTDIR\3rdParty\lib
File "..\deps\boost\lib\*.lib"
File "..\deps\Coin\lib\*"
File "..\deps\collada-dom\lib\*.lib"
File "..\deps\CURL\lib\*.lib"
File "..\deps\freetype\lib\*"
File /r "..\deps\gdal\lib\*"
File "..\deps\gif\lib\*"
File "..\deps\glew\lib\*"
File "..\deps\hidapi\lib\*"
File "..\deps\jpeg\lib\*"
File "..\deps\libxml2\lib\*"
File "..\deps\mxml\lib\*"
File "..\deps\OpenSceneGraph\lib\*.lib"
File "..\deps\openvr\lib\win64\*.lib"
File /r "..\deps\png\lib\*"
File "..\deps\SDL\lib\*"
File "..\deps\simage\lib\*"
File "..\deps\tiff\lib\*.lib"
File "..\deps\vrpn\lib\*"
File "..\deps\zlib\lib\*"
SectionEnd
Section "Plugin Development Headers"
SetOutPath $INSTDIR
File /r "include"
SetOutPath $INSTDIR\lib
File "lib\CalVRAll.lib"
SectionEnd
; Optional section (can be disabled by the user)
Section "Start Menu Shortcuts"
CreateDirectory "$SMPROGRAMS\CalVR"
CreateShortCut "$SMPROGRAMS\CalVR\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
CreateShortCut "$SMPROGRAMS\CalVR\CalVR.lnk" "$INSTDIR\bin\CalVR.exe" "" "$INSTDIR\bin\CalVR.exe" 0
SectionEnd
;--------------------------------
; Uninstaller
Section "Uninstall"
; Remove registry keys
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\CalVR"
DeleteRegKey HKLM SOFTWARE\CalVR
; Remove shortcuts, if any
Delete "$SMPROGRAMS\CalVR\*.*"
; Remove directories used
RMDir "$SMPROGRAMS\CalVR"
RMDir /r "$INSTDIR\bin"
RMDir /r "$INSTDIR\lib"
RMDir /r "$INSTDIR\include"
RMDir /r "$INSTDIR\resources"
RMDir /r "$INSTDIR\shaders"
RMDir /r "$INSTDIR\icons"
RMDir /r "$INSTDIR\3rdParty"
RMDir /r "$INSTDIR"
${un.EnvVarUpdate} $0 "PATH" "R" "HKLM" "$INSTDIR\3rdParty\bin"
${un.EnvVarUpdate} $0 "PATH" "R" "HKLM" "$INSTDIR\bin"
DeleteRegValue ${env_hklm} "OSG_NOTIFY_LEVEL"
DeleteRegValue ${env_hklm} "CALVR_CONFIG_DIR"
DeleteRegValue ${env_hklm} "CALVR_CONFIG_FILE"
DeleteRegValue ${env_hklm} "CALVR_HOME"
DeleteRegValue ${env_hklm} "CALVR_HOST_NAME"
; make sure windows knows about the change
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
SectionEnd