Fix doc path
[opentx.git] / companion / targets / windows / simulator-vs.nsi.in
blob1b479e0c30777fc5c8abfed15fbec0c2f2558b91
1 ;NSIS Modern User Interface
2 ;Start Menu Folder Selection Example Script
3 ;Written by Joost Verburg
5 ;--------------------------------
6 ;Include Modern UI
8 !include "MUI2.nsh"
10 ;--------------------------------
11 ;General
13 ;Name and file
14 Name "OpenTX Simulator"
15 OutFile "simulator-windows-@VERSION@.exe"
17 ;Default installation folder
18 InstallDir "$PROGRAMFILES\OpenTX"
20 ;Get installation folder from registry if available
21 InstallDirRegKey HKCU "Software\OpenTX" ""
23 ;Compressor options
24 SetCompressor /FINAL /SOLID lzma
25 SetCompressorDictSize 64
27 ;Request application privileges for Windows Vista
28 RequestExecutionLevel admin
30 ;--------------------------------
31 ;Variables
33 Var StartMenuFolder
35 ;--------------------------------
36 ;Interface Settings
38 !define MUI_ABORTWARNING
40 ;--------------------------------
41 ;File Exists Macro
43 ; See http://nsis.sourceforge.net/Check_if_a_file_exists_at_compile_time for documentation
44 !macro !defineifexist _VAR_NAME _FILE_NAME
45 !tempfile _TEMPFILE
46 !ifdef NSIS_WIN32_MAKENSIS
47 ; Windows - cmd.exe
48 !system 'if exist "${_FILE_NAME}" echo !define ${_VAR_NAME} > "${_TEMPFILE}"'
49 !else
50 ; Posix - sh
51 !system 'if [ -e "${_FILE_NAME}" ]; then echo "!define ${_VAR_NAME}" > "${_TEMPFILE}"; fi'
52 !endif
53 !include '${_TEMPFILE}'
54 !delfile '${_TEMPFILE}'
55 !undef _TEMPFILE
56 !macroend
57 !define !defineifexist "!insertmacro !defineifexist"
59 ;--------------------------------
60 ;Pages
62 !insertmacro MUI_PAGE_LICENSE "@CMAKE_CURRENT_SOURCE_DIR@\..\targets\windows\license.txt"
63 !insertmacro MUI_PAGE_COMPONENTS
64 !insertmacro MUI_PAGE_DIRECTORY
66 ;Start Menu Folder Page Configuration
67 !define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU"
68 !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\OpenTX"
69 !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
71 !insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder
73 !insertmacro MUI_PAGE_INSTFILES
75 # These indented statements modify settings for MUI_PAGE_FINISH
76 !define MUI_FINISHPAGE_NOAUTOCLOSE
77 !define MUI_FINISHPAGE_RUN
78 !define MUI_FINISHPAGE_RUN_CHECKED
79 !define MUI_FINISHPAGE_RUN_TEXT "Launch OpenTX Simulator"
80 !define MUI_FINISHPAGE_RUN_FUNCTION "LaunchLink"
81 !insertmacro MUI_PAGE_FINISH
83 !insertmacro MUI_UNPAGE_CONFIRM
84 !insertmacro MUI_UNPAGE_INSTFILES
86 ;--------------------------------
87 ;Languages
89 !insertmacro MUI_LANGUAGE "English"
90 !insertmacro MUI_LANGUAGE "French"
92 ;--------------------------------
93 ;Installer Sections
95 Section "OpenTX Simulator" SecDummy
97 SetOutPath "$INSTDIR"
99 File "@CMAKE_CURRENT_SOURCE_DIR@\..\targets\windows\license.txt"
100 File "Release\simulator.exe"
101 File "Release\opentx-*-simulator.dll"
103 ${!defineifexist} PTHREAD_WINDIR "C:\Programs\pthreads\Pre-built.2\lib\pthreadVC2.dll"
104 !ifdef PTHREAD_WINDIR
105 File "C:\Programs\pthreads\Pre-built.2\lib\pthreadVC2.dll"
106 !else
107 File "@SYSDIR@\system32\pthreadVC2.dll"
108 !endif
109 File "C:\Programs\xerces-vc\bin\xerces-c_3_1.dll"
110 File "C:\Programs\SDL\lib\SDL.dll"
111 File "@SYSDIR@\msvcp100.dll"
112 File "@SYSDIR@\msvcr100.dll"
113 File "@QT_BINARY_DIR@\QtCore4.dll"
114 File "@QT_BINARY_DIR@\QtGui4.dll"
115 File "@QT_BINARY_DIR@\QtNetwork4.dll"
116 File "@QT_BINARY_DIR@\Phonon4.dll"
117 File "@QT_BINARY_DIR@\QtXml4.dll"
119 CreateDirectory "$INSTDIR\phonon_backend"
120 SetOutPath "$INSTDIR\phonon_backend"
121 File "@QT_BINARY_DIR@\..\plugins\phonon_backend\Phonon_ds94.dll"
123 CreateDirectory "$INSTDIR\lang"
124 SetOutPath "$INSTDIR\lang"
125 File "src\*.qm"
127 SetOutPath "$INSTDIR"
128 ;Store installation folder
129 WriteRegStr HKCU "Software\OpenTX" "" $INSTDIR
131 ;Create uninstaller
132 WriteUninstaller "$INSTDIR\Uninstall.exe"
134 ;Registry information for add/remove programs
135 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenTX" "DisplayName" "OpenTX Simulator"
136 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenTX" "UninstallString" "$\"$INSTDIR\Uninstall.exe$\""
137 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenTX" "DisplayIcon" "$\"$INSTDIR\simulator.exe$\""
138 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenTX" "Publisher" "OpenTX"
139 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenTX" "URLInfoAbout" "http://www.open-tx.org"
140 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ImageMaker" "QuietUninstallString" "$\"$INSTDIR\Uninstall.exe$\" /S"
142 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
144 ;Create shortcuts
145 CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
146 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\simulator.lnk" "$INSTDIR\simulator.exe"
147 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
149 !insertmacro MUI_STARTMENU_WRITE_END
151 SectionEnd
153 ;--------------------------------
154 ;Descriptions
156 ;Language strings
157 LangString DESC_SecDummy ${LANG_ENGLISH} "Simulator for OpenTX"
158 LangString DESC_SecDummy ${LANG_FRENCH} "Simulateur pour OpenTX"
160 ;Assign language strings to sections
161 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
162 !insertmacro MUI_DESCRIPTION_TEXT ${SecDummy} $(DESC_SecDummy)
163 !insertmacro MUI_FUNCTION_DESCRIPTION_END
165 ;--------------------------------
166 ;Uninstaller Section
168 Section "Uninstall"
170 ;ADD YOUR OWN FILES HERE...
172 Delete "$INSTDIR\license.txt"
173 Delete "$INSTDIR\simulator.exe"
174 Delete "$INSTDIR\pthreadVC2.dll"
175 Delete "$INSTDIR\xerces-c_3_1.dll"
176 Delete "$INSTDIR\SDL.dll"
177 Delete "$INSTDIR\msvcp100.dll"
178 Delete "$INSTDIR\msvcr100.dll"
179 Delete "$INSTDIR\QtCore4.dll"
180 Delete "$INSTDIR\QtGui4.dll"
181 Delete "$INSTDIR\QtXml4.dll"
182 Delete "$INSTDIR\QtNetwork4.dll"
183 Delete "$INSTDIR\Phonon4.dll"
184 Delete "$INSTDIR\Uninstall.exe"
185 Delete "$INSTDIR\lang\*.*"
186 Delete "$INSTDIR\opentx-*-simulator.dll"
188 RMDir "$INSTDIR\lang"
189 RMDir "$INSTDIR"
191 !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
193 Delete "$SMPROGRAMS\$StartMenuFolder\simulator.lnk"
194 Delete "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk"
195 RMDir "$SMPROGRAMS\$StartMenuFolder"
197 DeleteRegKey /ifempty HKCU "Software\OpenTX"
198 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenTX"
200 SectionEnd
202 Function LaunchLink
203 ExecShell "" "$INSTDIR\simulator.exe"
204 FunctionEnd