1 ;NSIS Modern User Interface
2 ;Start Menu Folder Selection Example Script
3 ;Written by Joost Verburg
5 ;--------------------------------
10 ;--------------------------------
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" ""
24 SetCompressor
/FINAL
/SOLID lzma
25 SetCompressorDictSize
64
27 ;Request application privileges for Windows Vista
28 RequestExecutionLevel admin
30 ;--------------------------------
35 ;--------------------------------
38 !define MUI_ABORTWARNING
40 ;--------------------------------
43 ; See http://nsis.sourceforge.net/Check_if_a_file_exists_at_compile_time for documentation
44 !macro !defineifexist _VAR_NAME _FILE_NAME
46 !ifdef NSIS_WIN32_MAKENSIS
48 !system 'if exist "${_FILE_NAME}" echo !define ${_VAR_NAME} > "${_TEMPFILE}"'
51 !system 'if [ -e "${_FILE_NAME}" ]; then echo "!define ${_VAR_NAME}" > "${_TEMPFILE}"; fi'
53 !include '${_TEMPFILE}'
54 !delfile '${_TEMPFILE}'
57 !define !defineifexist "!insertmacro !defineifexist"
59 ;--------------------------------
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 ;--------------------------------
89 !insertmacro MUI_LANGUAGE
"English"
90 !insertmacro MUI_LANGUAGE
"French"
92 ;--------------------------------
95 Section "OpenTX Simulator" SecDummy
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"
107 File "@SYSDIR@\system32\pthreadVC2.dll"
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"
127 SetOutPath "$INSTDIR"
128 ;Store installation folder
129 WriteRegStr HKCU "Software\OpenTX" "" $INSTDIR
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
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
153 ;--------------------------------
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 ;--------------------------------
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"
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"
203 ExecShell "" "$INSTDIR\simulator.exe"