You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

windows-openvibe-x.x.x-setup-x86.nsi 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. ; define a default for dep dir
  2. !ifndef DEPENDENCIES_DIR
  3. !define DEPENDENCIES_DIR "..\..\dependencies"
  4. !endif
  5. !define OV_VERSION "3.1.0"
  6. !define OV_VERSION_SHORT "310"
  7. !ifndef OUTFILE
  8. !define OUTFILE "openvibe-${OV_VERSION}-32bit-setup.exe"
  9. !endif
  10. SetCompressor /FINAL /SOLID lzma
  11. SetCompressorDictSize 16
  12. !include "MUI.nsh"
  13. !include "zipdll.nsh"
  14. ;Name and file
  15. !define OV_NAME "OpenViBE ${OV_VERSION} (32bit)"
  16. Name "${OV_NAME}"
  17. OutFile ${OUTFILE}
  18. ;To detect a previous installation
  19. !define OV_REGKEY "openvibe${OV_VERSION_SHORT}"
  20. ;Default installation folder
  21. InstallDir "$PROGRAMFILES\openvibe-${OV_VERSION}"
  22. Var OLDINSTDIR
  23. Var DIRECTX_MISSING
  24. ;Interface Settings
  25. !define MUI_ABORTWARNING
  26. ;Pages
  27. !insertmacro MUI_PAGE_WELCOME
  28. !insertmacro MUI_PAGE_LICENSE "..\COPYING"
  29. !insertmacro MUI_PAGE_DIRECTORY
  30. !insertmacro MUI_PAGE_COMPONENTS
  31. !insertmacro MUI_PAGE_INSTFILES
  32. !insertmacro MUI_PAGE_FINISH
  33. !insertmacro MUI_UNPAGE_WELCOME
  34. !insertmacro MUI_UNPAGE_CONFIRM
  35. !insertmacro MUI_UNPAGE_INSTFILES
  36. !insertmacro MUI_UNPAGE_FINISH
  37. ;Languages
  38. !insertmacro MUI_LANGUAGE "English"
  39. ;Installer and uninstaller icons
  40. Icon "${NSISDIR}\Contrib\Graphics\Icons\box-install.ico"
  41. UninstallIcon "${NSISDIR}\Contrib\Graphics\Icons\box-uninstall.ico"
  42. ;##########################################################################################################################################################
  43. ;##########################################################################################################################################################
  44. ;##########################################################################################################################################################
  45. Function .onInit
  46. ; Note that for logging to work, you will need a logging-enabled build of nsis.
  47. ; At the time of writing this, you could get one from http://nsis.sourceforge.net/Special_Builds
  48. LogSet on
  49. UserInfo::GetAccountType
  50. Pop $R1
  51. StrCmp $R1 "Admin" has_admin_rights 0
  52. MessageBox MB_OK "You must be administrator to install OpenViBE" /SD IDOK
  53. Quit
  54. has_admin_rights:
  55. ReadRegStr $0 HKLM SOFTWARE\${OV_REGKEY} InstallDir
  56. ${If} $0 != ""
  57. IfFileExists "$0\Uninstall.exe" +1 +5
  58. MessageBox MB_YESNO "A previous installation of ${OV_NAME} is installed under $0.$\nContinuing the install procedure will remove previous installation of ${OV_NAME} (including all files you eventually added in the installation directory).$\nWould you like to accept this removal and continue on installation process ?" /SD IDYES IDNO +1 IDYES +2
  59. Abort
  60. StrCpy $OLDINSTDIR $0
  61. StrCpy $INSTDIR $0
  62. ${EndIf}
  63. ; Make OpenViBE section mandatory
  64. IntOp $0 ${SF_SELECTED} | ${SF_RO}
  65. IntOp $0 $0 | ${SF_BOLD}
  66. SectionSetFlags "Section1" $0
  67. FunctionEnd
  68. ; Returns characters before -, _ or .
  69. Function GetFirstStrPart
  70. Exch $R0
  71. Push $R1
  72. Push $R2
  73. StrLen $R1 $R0
  74. IntOp $R1 $R1 + 1
  75. loop:
  76. IntOp $R1 $R1 - 1
  77. StrCpy $R2 $R0 1 -$R1
  78. StrCmp $R2 "" exit2
  79. StrCmp $R2 "-" exit1
  80. StrCmp $R2 "_" exit1
  81. StrCmp $R2 "." exit1
  82. Goto loop
  83. exit1:
  84. StrCpy $R0 $R0 -$R1
  85. exit2:
  86. Pop $R2
  87. Pop $R1
  88. Exch $R0
  89. FunctionEnd
  90. ;##########################################################################################################################################################
  91. ;##########################################################################################################################################################
  92. ;##########################################################################################################################################################
  93. Section "!OpenViBE" Section1
  94. LogSet on
  95. ${If} $OLDINSTDIR != ""
  96. RMDir /r $OLDINSTDIR
  97. RMDir /r "$SMPROGRAMS\${OV_NAME}"
  98. ${EndIf}
  99. SetOutPath $INSTDIR
  100. WriteRegStr HKLM "SOFTWARE\${OV_REGKEY}" "InstallDir" "$INSTDIR"
  101. WriteUninstaller Uninstall.exe
  102. CreateDirectory "$INSTDIR\dependencies\arch"
  103. StrCpy $DIRECTX_MISSING "false"
  104. SetOutPath "$INSTDIR\dependencies"
  105. IfFileExists "$SYSDIR\d3dx9_43.dll" no_need_to_install_directx
  106. NSISdl::download "https://download.microsoft.com/download/8/4/A/84A35BF1-DAFE-4AE8-82AF-AD2AE20B6B14/directx_Jun2010_redist.exe" "arch\directx-jun2010.exe"
  107. Pop $R0 ; Get the return value
  108. StrCmp $R0 "success" +4
  109. MessageBox MB_OK "Download failed: $R0$\nCheck your Internet connection and your firewall settings.$\nDirect X won't be installed and 3D functionalities won't be available...$\nYou can install DirectX later to enable 3D functionalities !" /SD IDOK
  110. StrCpy $DIRECTX_MISSING "true"
  111. Goto no_need_to_install_directx ; Quit
  112. ExecWait '"arch\directx-jun2010.exe" /T:"$INSTDIR\tmp" /Q'
  113. ExecWait '"$INSTDIR\tmp\DXSETUP.exe" /silent'
  114. RMDir /r "$INSTDIR\tmp"
  115. no_need_to_install_directx:
  116. ; We download the redist from microsoft as its rather large. At the time of writing, vc140 is used by gNeedAccess and hence AS.
  117. SetOutPath "$INSTDIR\dependencies"
  118. IfFileExists "$SYSDIR\msvcp140.dll" no_need_to_install_vc140
  119. NSISdl::download "https://download.microsoft.com/download/9/3/F/93FCF1E7-E6A4-478B-96E7-D4B285925B00/vc_redist.x86.exe" "arch\vc_redist.x86.exe"
  120. Pop $R0 ; Get the return value
  121. StrCmp $R0 "success" +3
  122. MessageBox MB_OK "Download failed: $R0$\nCheck your Internet connection and your firewall settings.$\nVisual Studio 2015 Redistributable x86 (vc140) could not be downloaded.\nYou can try to install it manually from Microsoft and then retry the OpenViBE installer." /SD IDOK
  123. Quit
  124. ExecWait '"arch\vc_redist.x86.exe" /install /norestart /passive'
  125. no_need_to_install_vc140:
  126. ; This is the destination path where the zips will be copied to
  127. SetOutPath "$INSTDIR\dependencies\arch"
  128. ; The following source paths are relative to this .nsi script location
  129. File "${DEPENDENCIES_DIR}\arch\build\windows\*runtime.zip"
  130. File "${DEPENDENCIES_DIR}\arch\build\windows\pthread*.zip"
  131. ; All vcredist packages extracted to the same folder
  132. File "${DEPENDENCIES_DIR}\arch\build\windows\vcredist*.zip"
  133. ; The zips are extracted here by the installer
  134. SetOutPath "$INSTDIR\dependencies"
  135. ; Extract all the zip archives
  136. ; n.b. this thing will freeze on exec if there is no - or _ in the filename
  137. ClearErrors
  138. FindFirst $R0 $R1 "arch\*.zip"
  139. ZipLoop:
  140. IfErrors ZipDone
  141. ; find the base name, push to R2
  142. Push "$R1"
  143. Call GetFirstStrPart
  144. Pop "$R2"
  145. ZipDLL::extractall "arch\$R1" "$R2"
  146. ClearErrors
  147. FindNext $R0 $R1
  148. Goto ZipLoop
  149. ZipDone:
  150. FindClose $R0
  151. ; Zip extract hopefully done now
  152. SetOutPath "$INSTDIR"
  153. ; Export binaries
  154. File /nonfatal /r ..\..\dist\extras-Release-x86\bin
  155. ; Export launch scripts
  156. File /nonfatal ..\..\dist\extras-Release-x86\*.cmd
  157. ; File /nonfatal /r ..\dist\doc
  158. ; File /nonfatal /r ..\dist\include
  159. ; etc and lib folders are needed for the gtk theme
  160. File /nonfatal /r /x *.lib ..\..\dist\extras-Release-x86\lib
  161. File /nonfatal /r ..\..\dist\extras-Release-x86\etc
  162. File /nonfatal /r ..\..\dist\extras-Release-x86\log
  163. File /nonfatal /r ..\..\dist\extras-Release-x86\share
  164. ; File /nonfatal /r ..\dist\tmp
  165. StrCmp $DIRECTX_MISSING "false" no_need_to_patch_3d_functionnality
  166. FileOpen $0 "$INSTDIR\share\openvibe\kernel\openvibe.conf" a
  167. FileSeek $0 0 END
  168. FileWrite $0 "$\r$\n"
  169. FileWrite $0 "#####################################################################################$\r$\n"
  170. FileWrite $0 "# Patched by installer because DirectX is missing$\r$\n"
  171. FileWrite $0 "#####################################################################################$\r$\n"
  172. FileWrite $0 "Kernel_3DVisualizationEnabled = false$\r$\n"
  173. FileClose $0
  174. no_need_to_patch_3d_functionnality:
  175. ; Overwrite the file that may be in share/, as it contains local definitions to the build machine
  176. FileOpen $0 "$INSTDIR\bin\openvibe-set-env.cmd" w
  177. FileWrite $0 "@echo off$\r$\n"
  178. FileWrite $0 "$\r$\n"
  179. FileWrite $0 "$\r$\n"
  180. FileWrite $0 "SET OGRE_HOME=$INSTDIR\dependencies\ogre$\r$\n"
  181. FileWrite $0 "SET VRPNROOT=$INSTDIR\dependencies\vrpn$\r$\n"
  182. FileWrite $0 "$\r$\n"
  183. FileWrite $0 "SET PATH=$INSTDIR\dependencies\gtk\bin;%PATH%$\r$\n"
  184. FileWrite $0 "SET PATH=$INSTDIR\dependencies\cegui\bin;%PATH%$\r$\n"
  185. FileWrite $0 "SET PATH=$INSTDIR\dependencies\cegui\dependencies\bin;%PATH%$\r$\n"
  186. FileWrite $0 "SET PATH=%OGRE_HOME%\bin\release;%OGRE_HOME%\bin\debug;%PATH%$\r$\n"
  187. FileWrite $0 "SET PATH=%VRPNROOT%\bin;%PATH%$\r$\n"
  188. FileWrite $0 "SET PATH=$INSTDIR\dependencies\pthread\lib;%PATH%$\r$\n"
  189. FileWrite $0 "SET PATH=$INSTDIR\dependencies\vcredist\;%PATH%$\r$\n"
  190. FileWrite $0 "$\r$\n"
  191. FileWrite $0 "REM Apply user-provided Python2.7 paths if available$\r$\n"
  192. FileWrite $0 "IF NOT !PYTHONHOME27!==!EMPTY! IF NOT !PYTHONPATH27!==!EMPTY! SET REPLACE_PYTHON=true$\r$\n"
  193. FileWrite $0 "IF NOT !REPLACE_PYTHON!==!EMPTY! ($\r$\n"
  194. FileWrite $0 " SET $\"PYTHONHOME=%PYTHONHOME27%$\"$\r$\n"
  195. FileWrite $0 " SET $\"PYTHONPATH=%PYTHONPATH27%$\"$\r$\n"
  196. FileWrite $0 ")$\r$\n"
  197. FileClose $0
  198. FileOpen $0 "$INSTDIR\dependencies\cegui\resources.cfg" w
  199. FileWrite $0 "FileSystem=$INSTDIR\dependencies\cegui\datafiles\configs$\r$\n"
  200. FileWrite $0 "FileSystem=$INSTDIR\dependencies\cegui\datafiles\fonts$\r$\n"
  201. FileWrite $0 "FileSystem=$INSTDIR\dependencies\cegui\datafiles\imagesets$\r$\n"
  202. FileWrite $0 "FileSystem=$INSTDIR\dependencies\cegui\datafiles\layouts$\r$\n"
  203. FileWrite $0 "FileSystem=$INSTDIR\dependencies\cegui\datafiles\looknfeel$\r$\n"
  204. FileWrite $0 "FileSystem=$INSTDIR\dependencies\cegui\datafiles\lua_scripts$\r$\n"
  205. FileWrite $0 "FileSystem=$INSTDIR\dependencies\cegui\datafiles\schemes$\r$\n"
  206. FileWrite $0 "FileSystem=$INSTDIR\dependencies\cegui\datafiles\xml_schemes$\r$\n"
  207. FileClose $0
  208. FileOpen $0 "$INSTDIR\dependencies\gtk\etc\gtk-2.0\gtkrc" w
  209. FileWrite $0 "gtk-theme-name = $\"Redmond$\"$\r$\n"
  210. FileWrite $0 "style $\"user-font$\"$\r$\n"
  211. FileWrite $0 "{$\r$\n"
  212. FileWrite $0 " font_name=$\"Sans 8$\"$\r$\n"
  213. FileWrite $0 "}$\r$\n"
  214. FileWrite $0 "widget_class $\"*$\" style $\"user-font$\"$\r$\n"
  215. FileClose $0
  216. CreateDirectory "$SMPROGRAMS\${OV_NAME}"
  217. CreateDirectory "$SMPROGRAMS\${OV_NAME}\Developer tools"
  218. CreateShortCut "$SMPROGRAMS\${OV_NAME}\Developer tools\OpenViBE ID Generator.lnk" "$INSTDIR\openvibe-id-generator.cmd" "" "%SystemRoot%\system32\shell32.dll" 57
  219. CreateShortCut "$SMPROGRAMS\${OV_NAME}\Developer tools\OpenViBE Plugin Inspector.lnk" "$INSTDIR\openvibe-plugin-inspector.cmd" "" "%SystemRoot%\system32\shell32.dll" 57
  220. CreateShortCut "$SMPROGRAMS\${OV_NAME}\Developer tools\OpenViBE Skeleton Generator.lnk" "$INSTDIR\openvibe-skeleton-generator.cmd" "" "%SystemRoot%\system32\shell32.dll" 57
  221. CreateShortCut "$SMPROGRAMS\${OV_NAME}\OpenViBE Designer 32bit.lnk" "$INSTDIR\openvibe-designer.cmd" "" "%SystemRoot%\system32\shell32.dll" 137
  222. CreateShortCut "$SMPROGRAMS\${OV_NAME}\OpenViBE Acquisition Server 32bit.lnk" "$INSTDIR\openvibe-acquisition-server.cmd" "" "%SystemRoot%\system32\shell32.dll" 18
  223. CreateShortCut "$SMPROGRAMS\${OV_NAME}\OpenViBE Tracker 32bit.lnk" "$INSTDIR\openvibe-tracker.cmd" "" "%SystemRoot%\system32\shell32.dll" 249
  224. CreateShortCut "$SMPROGRAMS\${OV_NAME}\OpenViBE VR-demo Spaceship 32bit.lnk" "$INSTDIR\openvibe-vr-demo-spaceship.cmd" "" "%SystemRoot%\system32\shell32.dll" 200
  225. CreateShortCut "$SMPROGRAMS\${OV_NAME}\OpenViBE VR-demo Handball 32bit.lnk" "$INSTDIR\openvibe-vr-demo-handball.cmd" "" "%SystemRoot%\system32\shell32.dll" 200
  226. CreateShortCut "$SMPROGRAMS\${OV_NAME}\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
  227. ; AccessControl::EnableFileInheritance "$INSTDIR"
  228. ; AccessControl::GrantOnFile "$INSTDIR" "(BU)" "GenericRead + GenericWrite + GenericExecute + Delete" ; to ensure windows XP back compatibility
  229. ; AccessControl::GrantOnFile "$INSTDIR" "(S-1-5-32-545)" "GenericRead + GenericWrite + GenericExecute + Delete" ; (BU) user group (builtin users) does not exist on win7. this SID replaces it.
  230. SectionEnd
  231. Section "Uninstall"
  232. RMDir /r $INSTDIR
  233. RMDir /r "$SMPROGRAMS\${OV_NAME}"
  234. SectionEnd
  235. LangString DESC_Section1 ${LANG_ENGLISH} "The OpenViBE package: Designer, Acquisition Server, drivers, examples, etc."
  236. !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
  237. !insertmacro MUI_DESCRIPTION_TEXT ${Section1} $(DESC_Section1)
  238. !insertmacro MUI_FUNCTION_DESCRIPTION_END