1 ;NSIS Modern User Interface
2 ;Start Menu Folder Selection Example Script
3 ;Written by Joost Verburg
5 ;--------------------------------
9 !include "@CMAKE_CURRENT_SOURCE_DIR@\..\targets\windows\FileAssociation.nsh"
11 ;--------------------------------
15 Name "OpenTX companion"
16 OutFile "companion-windows-v@VERSION@.exe"
18 ;Default installation folder
19 InstallDir "$PROGRAMFILES\OpenTX companion"
21 ;Get installation folder from registry if available
22 InstallDirRegKey HKCU "Software\companion9x" ""
25 SetCompressor
/FINAL
/SOLID lzma
26 SetCompressorDictSize
64
28 ;Request application privileges for Windows Vista
29 RequestExecutionLevel admin
31 ;--------------------------------
36 ;--------------------------------
39 !define MUI_ABORTWARNING
41 ;--------------------------------
44 !insertmacro MUI_PAGE_LICENSE
"@CMAKE_CURRENT_SOURCE_DIR@\..\targets\windows\license.txt"
45 !insertmacro MUI_PAGE_COMPONENTS
46 !insertmacro MUI_PAGE_DIRECTORY
48 ;Start Menu Folder Page Configuration
49 !define MUI_STARTMENUPAGE_REGISTRY_ROOT
"HKCU"
50 !define MUI_STARTMENUPAGE_REGISTRY_KEY
"Software\companion9x"
51 !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME
"Start Menu Folder"
53 !insertmacro MUI_PAGE_STARTMENU Application
$StartMenuFolder
55 !insertmacro MUI_PAGE_INSTFILES
57 # These indented statements modify settings for MUI_PAGE_FINISH
58 !define MUI_FINISHPAGE_NOAUTOCLOSE
59 !define MUI_FINISHPAGE_RUN
60 !define MUI_FINISHPAGE_RUN_CHECKED
61 !define MUI_FINISHPAGE_RUN_TEXT
"Launch companion"
62 !define MUI_FINISHPAGE_RUN_FUNCTION
"LaunchLink"
63 # !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
64 # !define MUI_FINISHPAGE_SHOWREADME $INSTDIR\readme.txt
65 !insertmacro MUI_PAGE_FINISH
67 !insertmacro MUI_UNPAGE_CONFIRM
68 !insertmacro MUI_UNPAGE_INSTFILES
70 ;--------------------------------
73 !insertmacro MUI_LANGUAGE
"English"
74 !insertmacro MUI_LANGUAGE
"French"
76 ;--------------------------------
79 Section "OpenTX companion" SecDummy
83 File "@CMAKE_CURRENT_SOURCE_DIR@\..\targets\windows\license.txt"
85 File "C:\Programs\xerces\src\.libs\libxerces-c-3-1.dll"
86 File "C:\MinGW\bin\libgcc_s_dw2-1.dll"
87 File "C:\MinGW\bin\mingwm10.dll"
88 File "C:\MinGW\bin\libstdc++-6.dll"
89 File "@QT_BINARY_DIR@\QtCore4.dll"
90 File "@QT_BINARY_DIR@\QtGui4.dll"
91 File "@QT_BINARY_DIR@\QtXml4.dll"
92 File "@QT_BINARY_DIR@\QtNetwork4.dll"
93 File "@QT_BINARY_DIR@\Phonon4.dll"
94 File "@CMAKE_CURRENT_SOURCE_DIR@\..\targets\windows\avrdude.exe"
95 File "@CMAKE_CURRENT_SOURCE_DIR@\..\targets\windows\avrdude.conf"
96 File "@CMAKE_CURRENT_SOURCE_DIR@\..\targets\windows\libusb0.dll"
97 File "@CMAKE_CURRENT_SOURCE_DIR@\..\targets\windows\dfu-util.exe"
99 CreateDirectory "$INSTDIR\phonon_backend"
100 SetOutPath "$INSTDIR\phonon_backend"
101 File "@QT_BINARY_DIR@\..\plugins\phonon_backend\Phonon_ds94.dll"
103 CreateDirectory "$INSTDIR\lang"
104 SetOutPath "$INSTDIR\lang"
107 SetOutPath "$INSTDIR"
108 ;Store installation folder
109 WriteRegStr HKCU "Software\companion9x" "" $INSTDIR
111 ;Associate with extentions ,bin and .hex
112 ${registerExtension} "$INSTDIR\companion.exe" ".bin" "BIN_File"
113 ${registerExtension} "$INSTDIR\companion.exe" ".hex" "HEX_File"
114 ${registerExtension} "$INSTDIR\companion.exe" ".companion" "EEPE_File"
115 ${registerExtension} "$INSTDIR\companion.exe" ".eepm" "EEPM_File"
118 WriteUninstaller "$INSTDIR\Uninstall.exe"
120 ;Registry information for add/remove programs
121 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenTX" "DisplayName" "OpenTX Companion"
122 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenTX" "UninstallString" "$\"$INSTDIR\Uninstall
.exe
$\
""
123 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenTX" "DisplayIcon" "$\"$INSTDIR\companion
.exe
$\
""
124 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenTX" "Publisher" "OpenTX"
125 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenTX" "URLInfoAbout" "http://www.open-tx.org"
126 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ImageMaker" "QuietUninstallString" "$\"$INSTDIR\Uninstall
.exe
$\
" /S"
128 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
131 CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
132 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\companion.lnk" "$INSTDIR\companion.exe"
133 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
135 !insertmacro MUI_STARTMENU_WRITE_END
139 ;--------------------------------
143 LangString DESC_SecDummy
${LANG_ENGLISH} "Models and settings editor for OpenTX"
144 LangString DESC_SecDummy
${LANG_FRENCH} "Editeur de r�glages et mod�les pour OpenTX"
146 ;Assign language strings to sections
147 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
148 !insertmacro MUI_DESCRIPTION_TEXT
${SecDummy} $(DESC_SecDummy
)
149 !insertmacro MUI_FUNCTION_DESCRIPTION_END
151 ;--------------------------------
156 ;ADD YOUR OWN FILES HERE...
158 Delete "$INSTDIR\license.txt"
159 Delete "$INSTDIR\companion.exe"
160 Delete "$INSTDIR\libxerces-c-3-1.dll"
161 Delete "$INSTDIR\libgcc_s_dw2-1.dll"
162 Delete "$INSTDIR\mingwm10.dll"
163 Delete "$INSTDIR\libstdc++-6.dll"
164 Delete "$INSTDIR\QtCore4.dll"
165 Delete "$INSTDIR\QtGui4.dll"
166 Delete "$INSTDIR\QtNetwork4.dll"
167 Delete "$INSTDIR\Phonon4.dll"
168 Delete "$INSTDIR\QtXml4.dll"
169 Delete "$INSTDIR\avrdude.exe"
170 Delete "$INSTDIR\avrdude.conf"
171 Delete "$INSTDIR\libusb0.dll"
172 Delete "$INSTDIR\dfu-util.exe"
173 Delete "$INSTDIR\Uninstall.exe"
175 Delete "$INSTDIR\lang\*.*"
176 Delete "$INSTDIR\phonon_backend\*.*"
178 RMDir "$INSTDIR\lang"
179 RMDir "$INSTDIR\phonon_backend"
182 ${unregisterExtension} ".bin" "BIN File"
183 ${unregisterExtension} ".hex" "HEX File"
184 ${unregisterExtension} ".eepm" "EEPE File"
185 ${unregisterExtension} ".companion" "EEPM File"
187 !insertmacro MUI_STARTMENU_GETFOLDER Application
$StartMenuFolder
189 Delete "$SMPROGRAMS\$StartMenuFolder\companion.lnk"
190 Delete "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk"
191 RMDir "$SMPROGRAMS\$StartMenuFolder"
193 DeleteRegKey /ifempty
HKCU "Software\companion9x"
194 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenTX"
199 ExecShell "" "$INSTDIR\companion.exe"