1; Script generated by the HM NIS Edit Script Wizard.
2
3; HM NIS Edit Wizard helper defines
4
5!define MAINDIR $PROGRAMFILES64
6!define PRODUCT_NAME "MeshLab_64b"
7!define PRODUCT_VERSION "2018.03"
8!define PRODUCT_PUBLISHER "Paolo Cignoni - Guido Ranzuglia VCG - ISTI - CNR"
9!define PRODUCT_WEB_SITE "http://www.meshlab.net"
10!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\meshlab.exe"
11!define PRODUCT_DIR_REGKEY_S "Software\Microsoft\Windows\CurrentVersion\App Paths\meshlabserver.exe"
12!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
13!define PRODUCT_UNINST_ROOT_KEY "HKLM"
14;!define QT_BASE "C:\Qt_5.7\5.7\msvc2015_64\"
15;!define QT_BASE ${QTDIR}
16ReadEnvStr $QT_BASE "QTDIR"
17!define ADDITIONAL_DLLS "C:\Users\ranzuglia\Desktop\MeshLab-related\additional_dlls"
18!define ICU_DLLS "${ADDITIONAL_DLLS}\icu\bin64"
19!define DISTRIB_FOLDER "../distrib"
20!define MICROSOFT_VS2010_REDIST_KEYDIR "Software\Microsoft\Windows\CurrentVersion\Uninstall\"
21
22; MUI 1.67 compatible -----
23!include "MUI.nsh"
24
25; MUI Settings
26!define MUI_ABORTWARNING
27!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
28!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
29
30; Welcome page
31!insertmacro MUI_PAGE_WELCOME
32; License page
33!insertmacro MUI_PAGE_LICENSE "..\..\LICENSE.txt"
34; License page
35!insertmacro MUI_PAGE_LICENSE "..\..\docs\privacy.txt"
36; Directory page
37!insertmacro MUI_PAGE_DIRECTORY
38; Instfiles page
39!insertmacro MUI_PAGE_INSTFILES
40
41
42; Finish page
43!define MUI_FINISHPAGE_RUN "$INSTDIR\meshlab.exe"
44!insertmacro MUI_PAGE_FINISH
45
46; Uninstaller pages
47!insertmacro MUI_UNPAGE_INSTFILES
48
49; Language files
50!insertmacro MUI_LANGUAGE "English"
51
52; MUI end ------
53!define /date NOW "%Y_%m_%d"
54
55Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
56OutFile "MeshLab2016.12_${NOW}.exe"
57;InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
58InstallDir "${MAINDIR}\VCG\MeshLab"
59ShowInstDetails show
60ShowUnInstDetails show
61
62!include LogicLib.nsh
63!macro IfKeyExists ROOT MAIN_KEY KEY
64  Push $R0
65  Push $R1
66  Push $R2
67
68  # XXX bug if ${ROOT}, ${MAIN_KEY} or ${KEY} use $R0 or $R1
69  SetRegView 64
70  StrCpy $R1 "0" # loop index
71  StrCpy $R2 "0" # not found
72 ;MessageBox MB_OK "Passato : ${MAIN_KEY}"
73  ${Do}
74    EnumRegKey $R0 ${ROOT} "${MAIN_KEY}" "$R1"
75	;MessageBox MB_OK "Letto : $R0"
76    ${If} $R0 == "${KEY}"
77      StrCpy $R2 "1" # found
78      ${Break}
79    ${EndIf}
80    IntOp $R1 $R1 + 1
81  ${LoopWhile} $R0 != ""
82
83  ClearErrors
84
85  Exch 2
86  Pop $R0
87  Pop $R1
88  Exch $R2
89!macroend
90
91Section "MainSection" SEC01
92  SetOutPath "$INSTDIR"
93  SetOverwrite on
94  File "${DISTRIB_FOLDER}\meshlab.exe"
95  File "${DISTRIB_FOLDER}\meshlabserver.exe"
96  CreateDirectory "$SMPROGRAMS\MeshLab"
97  CreateShortCut "$SMPROGRAMS\MeshLab\MeshLab.lnk" "$INSTDIR\meshlab.exe"
98  CreateShortCut "$DESKTOP\MeshLab.lnk" "$INSTDIR\meshlab.exe"
99  CreateShortCut "$SMPROGRAMS\MeshLab\MeshLabServer.lnk" "cmd.exe /k $INSTDIR\meshlabserver.exe"
100
101  ;Let's delete all the dangerous stuff from previous releases.
102  Delete "$INSTDIR\qt*.dll"
103  Delete "$INSTDIR\ming*.dll"
104  Delete "$INSTDIR\plugins\*.dll"
105  Delete "$INSTDIR\imageformats\*.dll"
106  Delete "$INSTDIR\platforms\*.dll"
107
108  SetOutPath "$INSTDIR\shaders"
109  File "${DISTRIB_FOLDER}\shaders\*.frag"
110  File "${DISTRIB_FOLDER}\shaders\*.gdp"
111  File "${DISTRIB_FOLDER}\shaders\*.vert"
112  SetOutPath "$INSTDIR\shaders\decorate_shadow\ao"
113  SetOutPath "$INSTDIR\shaders\decorate_shadow\sm"
114  File "${DISTRIB_FOLDER}\shaders\decorate_shadow\sm\*.frag"
115  File "${DISTRIB_FOLDER}\shaders\decorate_shadow\sm\*.vert"
116  SetOutPath "$INSTDIR\shaders\decorate_shadow\ssao"
117  File "${DISTRIB_FOLDER}\shaders\decorate_shadow\ssao\*.frag"
118  File "${DISTRIB_FOLDER}\shaders\decorate_shadow\ssao\*.vert"
119  SetOutPath "$INSTDIR\shaders\decorate_shadow\vsm"
120  File "${DISTRIB_FOLDER}\shaders\decorate_shadow\vsm\*.frag"
121  File "${DISTRIB_FOLDER}\shaders\decorate_shadow\vsm\*.vert"
122  SetOutPath "$INSTDIR\shaders\decorate_shadow\vsmb"
123  File "${DISTRIB_FOLDER}\shaders\decorate_shadow\vsmb\*.frag"
124  File "${DISTRIB_FOLDER}\shaders\decorate_shadow\vsmb\*.vert"
125  File "${DISTRIB_FOLDER}\shaders\*.frag"
126  SetOutPath "$INSTDIR\plugins"
127
128  ; MeshLab plugins
129  File "${DISTRIB_FOLDER}/plugins\*.dll"
130  File "${DISTRIB_FOLDER}/plugins\*.xml"
131
132  ; All the U3D binary stuff
133  SetOutPath "$INSTDIR\plugins\U3D_W32"
134  File "${DISTRIB_FOLDER}/plugins\U3D_W32\IDTFConverter.exe"
135  File "${DISTRIB_FOLDER}/plugins\U3D_W32\*.dll"
136  File "${DISTRIB_FOLDER}/plugins\U3D_W32\*.txt"
137  SetOutPath "$INSTDIR\plugins\U3D_W32\plugins"
138  File "${DISTRIB_FOLDER}/plugins\U3D_W32\Plugins\IFXExporting.dll"
139
140  SetOutPath "$INSTDIR\textures"
141  File "${DISTRIB_FOLDER}/textures\chrome.png"
142  File "${DISTRIB_FOLDER}/textures\*.dds"
143  File "${DISTRIB_FOLDER}/textures\fur.png"
144  File "${DISTRIB_FOLDER}/textures\glyphmosaic.png"
145  ;File "${DISTRIB_FOLDER}/textures\NPR Metallic Outline.tga"
146  File "${DISTRIB_FOLDER}/textures\hatch*.jpg"
147
148  SetOutPath "$INSTDIR\textures\litspheres"
149  File "${DISTRIB_FOLDER}/textures\litspheres\*.png"
150
151  SetOutPath "$INSTDIR\textures\cubemaps"
152  File "${DISTRIB_FOLDER}/textures\cubemaps\uffizi*.jpg"
153  SetOutPath "$INSTDIR\samples"
154  File "${DISTRIB_FOLDER}/sample\texturedknot.ply"
155  File "${DISTRIB_FOLDER}/sample\texturedknot.obj"
156  File "${DISTRIB_FOLDER}/sample\texturedknot.mtl"
157  File "${DISTRIB_FOLDER}/sample\TextureDouble_A.png"
158  File "${DISTRIB_FOLDER}/sample\Laurana50k.ply"
159  File "${DISTRIB_FOLDER}/sample\duck_triangulate.dae"
160  File "${DISTRIB_FOLDER}/sample\seashell.gts"
161  File "${DISTRIB_FOLDER}/sample\chameleon4k.pts"
162  File "${DISTRIB_FOLDER}/sample\normalmap\laurana500.*"
163  File "${DISTRIB_FOLDER}/sample\normalmap\matteonormb.*"
164  SetOutPath "$INSTDIR\samples\images"
165  File "${DISTRIB_FOLDER}/sample\images\duckCM.jpg"
166  SetOutPath "$INSTDIR\imageformats"
167  File "${QT_BASE}\plugins\imageformats\qjpeg.dll"
168  File "${QT_BASE}\plugins\imageformats\qgif.dll"
169  File "${QT_BASE}\plugins\imageformats\qtiff.dll"
170   SetOutPath "$INSTDIR\platforms"
171  File "${QT_BASE}\plugins\platforms\qminimal.dll"
172  File "${QT_BASE}\plugins\platforms\qwindows.dll"
173
174  SetOutPath "$INSTDIR"
175  ;File "${DISTRIB_FOLDER}\common.lib"
176  File "${QT_BASE}\bin\Qt5Core.dll"
177  File "${QT_BASE}\bin\Qt5Gui.dll"
178  File "${QT_BASE}\bin\Qt5OpenGL.dll"
179  File "${QT_BASE}\bin\Qt5Xml.dll"
180  File "${QT_BASE}\bin\Qt5Network.dll"
181  File "${QT_BASE}\bin\Qt5Script.dll"
182  File "${QT_BASE}\bin\Qt5XmlPatterns.dll"
183  File "${QT_BASE}\bin\Qt5Widgets.dll"
184  File "${ICU_DLLS}\icuin51.dll"
185  File "${ICU_DLLS}\icudt51.dll"
186  File "${ICU_DLLS}\icuuc51.dll"
187  File "${ADDITIONAL_DLLS}\vc_redist.x64.exe"
188
189  ;File "C:\MinGW\bin\mingwm10.dll"
190  ;File "${QT_BASE}\..\mingw\bin\mingwm10.dll"
191  ;File "${QT_BASE}\..\mingw\bin\libgcc_s_dw2-1.dll"
192  ;File "${QT_BASE}\..\mingw\bin\libgomp-1.dll"
193
194  File "..\..\docs\readme.txt"
195  ;File "..\..\docs\history.txt"
196  File "..\..\LICENSE.txt"
197SectionEnd
198
199Section -Prerequisites
200	;EnumRegKey $0 HKCR "SOFTWARE\Test" 0
201	;ReadRegStr $0 HKLM ${MICROSOFT_VS2008_REDIST_KEYDIR} ${MICROSOFT_VS2008_X64}
202	;MessageBox MB_OK "Letto : $0"
203	;Quit
204
205	;!insertmacro IfKeyExists HKLM  ${MICROSOFT_VS2010_REDIST_KEYDIR} ${MICROSOFT_VS2010_X64}
206	;Pop $R0
207	;${If} $R0 == "1"
208	;	Goto endPrerequisites
209	;${Else}
210	;	!insertmacro IfKeyExists HKLM ${MICROSOFT_VS2010_REDIST_KEYDIR} ${MICROSOFT_VS2010_IA64}
211	;	Pop $R0
212	;	${If} $R0 == "1"
213	;		Goto endPrerequisites
214	;	${Else}
215	;		MessageBox MB_OK "Your system does not appear to have $\"Microsoft Visual C++ 2010 SP1 Redistributable Package (x64) installed$\".$\r MeshLab's Installation process will be aborted.$\r Please, install it and restart the MeshLab installer!"
216	;		Quit
217	;	${Endif}
218	;${Endif}
219	;endPrerequisites:
220	ReadRegStr $1 HKLM "SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x64" "Installed"
221	${If} $1 == "1"
222		Goto endPrerequisites
223	${Else}
224		ExecWait "$INSTDIR\vc_redist.x64.exe"
225	${EndIf}
226	endPrerequisites:
227SectionEnd
228
229Section -AdditionalIcons
230  WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
231  CreateShortCut "$SMPROGRAMS\MeshLab\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
232  CreateShortCut "$SMPROGRAMS\MeshLab\Uninstall.lnk" "$INSTDIR\uninst.exe"
233SectionEnd
234
235Section -Post
236  WriteUninstaller "$INSTDIR\uninst.exe"
237  WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\meshlab.exe"
238  WriteRegStr HKLM "${PRODUCT_DIR_REGKEY_S}" "" "$INSTDIR\meshlabserver.exe"
239  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
240  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
241  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\meshlab.exe"
242  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
243  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
244  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
245SectionEnd
246
247
248Function un.onUninstSuccess
249  HideWindow
250  MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
251FunctionEnd
252
253Function un.onInit
254  MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
255  Abort
256FunctionEnd
257
258Section Uninstall
259  Delete "$INSTDIR\${PRODUCT_NAME}.url"
260  Delete "$INSTDIR\*.dll"
261  Delete "$INSTDIR\*.txt"
262  Delete "$INSTDIR\*.exe"
263  Delete "$INSTDIR\shaders\*.frag"
264  Delete "$INSTDIR\shaders\*.vert"
265  Delete "$INSTDIR\shaders\*.gdp"
266  Delete "$INSTDIR\shadersrm\*.rfx"
267  Delete "$INSTDIR\samples\*.*"
268  Delete "$INSTDIR\samples\images\*.*"
269  Delete "$INSTDIR\plugins\*.dll"
270  Delete "$INSTDIR\plugins\U3D_W32\*.dll"
271  Delete "$INSTDIR\plugins\U3D_W32\*.exe"
272  Delete "$INSTDIR\plugins\U3D_W32\*.txt"
273  Delete "$INSTDIR\plugins\U3D_W32\plugins\*.dll"
274  Delete "$INSTDIR\plugins\*.dll"
275  Delete "$INSTDIR\imageformats\*.dll"
276  Delete "$INSTDIR\textures\*.png"
277  Delete "$INSTDIR\textures\*.dds"
278  Delete "$INSTDIR\textures\cubemaps\*.jpg"
279  Delete "$INSTDIR\textures\*.jpg"
280  Delete "$INSTDIR\textures\*.tga"
281
282  Delete "$SMPROGRAMS\MeshLab\Uninstall.lnk"
283  Delete "$SMPROGRAMS\MeshLab\Website.lnk"
284  Delete "$DESKTOP\MeshLab.lnk"
285  Delete "$SMPROGRAMS\MeshLab\MeshLab.lnk"
286
287  RMDir "$SMPROGRAMS\MeshLab"
288  RMDir "$INSTDIR\CVS"
289  RMDir "$INSTDIR\imageformats"
290  RMDir "$INSTDIR\plugins\U3D_W32\plugins"
291  RMDir "$INSTDIR\plugins\U3D_W32"
292  RMDir "$INSTDIR\plugins"
293  RMDir "$INSTDIR\samples\images"
294  RMDir "$INSTDIR\samples"
295  RMDir "$INSTDIR\textures\cubemaps"
296  RMDir /r "$INSTDIR\textures"
297  RMDir /r "$INSTDIR\shaders"
298  RMDir /r "$INSTDIR\shadersrm"
299  RMDir /r "$INSTDIR"
300
301  DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
302  DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
303  DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY_S}"
304  SetAutoClose true
305SectionEnd
306
307  ;******************** PARTE SPERIMENTALE SULLE ASSOCIAZIONI FILE ****************
308;Things that need to be extracted on startup (keep these lines before any File command!)
309;Only useful for BZIP2 compression
310;Use ReserveFile for your own InstallOptions INI files too!
311
312!define TEMP1 $R0 ;Temp variable
313
314ReserveFile "${NSISDIR}\Plugins\InstallOptions.dll"
315; ReserveFile "fileassociation_nsis.ini"
316
317;Order of pages
318; la prox linea se scommnentata serve ad abilitare il loading di una pagine aggiuntiva
319; in cui si settano le associazioni file extensions-registro per il meshlab.
320; Page custom SetCustom ValidateCustom ": Testing InstallOptions" ;Custom page. InstallOptions gets called in SetCustom.
321;Page instfiles
322
323Section "Components"
324
325  ;Get Install Options dialog user input
326
327  ReadINIStr ${TEMP1} "$PLUGINSDIR\fileassociation_nsis.ini" "Field 2" "State"
328  DetailPrint "Install X=${TEMP1}"
329  ReadINIStr ${TEMP1} "$PLUGINSDIR\fileassociation_nsis.ini" "Field 3" "State"
330  DetailPrint "Install Y=${TEMP1}"
331  ReadINIStr ${TEMP1} "$PLUGINSDIR\fileassociation_nsis.ini" "Field 4" "State"
332  DetailPrint "Install Z=${TEMP1}"
333  ReadINIStr ${TEMP1} "$PLUGINSDIR\fileassociation_nsis.ini" "Field 5" "State"
334  DetailPrint "File=${TEMP1}"
335  ReadINIStr ${TEMP1} "$PLUGINSDIR\fileassociation_nsis.ini" "Field 6" "State"
336  DetailPrint "Dir=${TEMP1}"
337  ReadINIStr ${TEMP1} "$PLUGINSDIR\fileassociation_nsis.ini" "Field 8" "State"
338  DetailPrint "Info=${TEMP1}"
339
340SectionEnd
341
342Function .onInit
343
344  ;Extract InstallOptions files
345  ;$PLUGINSDIR will automatically be removed when the installer closes
346
347  InitPluginsDir
348;  File /oname=$PLUGINSDIR\fileassociation_nsis.ini "fileassociation_nsis.ini"
349
350FunctionEnd
351
352Function SetCustom
353
354  ;Display the InstallOptions dialog
355
356  Push ${TEMP1}
357
358    InstallOptions::dialog "$PLUGINSDIR\fileassociation_nsis.ini"
359    Pop ${TEMP1}
360
361  Pop ${TEMP1}
362
363FunctionEnd
364
365Function ValidateCustom
366
367  ReadINIStr ${TEMP1} "$PLUGINSDIR\fileassociation_nsis.ini" "Field 2" "State"
368  StrCmp ${TEMP1} 1 done
369
370  ReadINIStr ${TEMP1} "$PLUGINSDIR\fileassociation_nsis.ini" "Field 3" "State"
371  StrCmp ${TEMP1} 1 done
372
373  ReadINIStr ${TEMP1} "$PLUGINSDIR\fileassociation_nsis.ini" "Field 4" "State"
374  StrCmp ${TEMP1} 1 done
375    MessageBox MB_ICONEXCLAMATION|MB_OK "You must select at least one install option!"
376    Abort
377
378  done:
379
380FunctionEnd
381