Version 3.7
[GPXSee.git] / pkg / gpxsee.nsi
blob55fbbea67c49085d1c29bfa64adde8d85de5ed93
1 !include "MUI2.nsh"
2 !include "x64.nsh"
4 ; The name of the installer
5 Name "GPXSee"
6 ; Program version
7 !define VERSION "3.7"
9 ; The file to write
10 OutFile "GPXSee-${VERSION}.exe"
12 ; Required execution level
13 RequestExecutionLevel admin
15 ; The default installation directory
16 InstallDir "$PROGRAMFILES\GPXSee"
18 ; Registry key to check for directory (so if you install again, it will
19 ; overwrite the old one automatically)
20 InstallDirRegKey HKLM "Software\GPXSee" "Install_Dir"
22 ; Registry key for uninstaller
23 !define REGENTRY "Software\Microsoft\Windows\CurrentVersion\Uninstall\GPXSee"
24 ; File types registry entries
25 !define REGGPX "GPXSee.gpx"
26 !define REGTCX "GPXSee.tcx"
27 !define REGKML "GPXSee.kml"
28 !define REGFIT "GPXSee.fit"
29 !define REGIGC "GPXSee.igc"
30 !define REGNMEA "GPXSee.nmea"
32 ; Start menu page configuration
33 !define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
34 !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\GPXSee"
35 !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "GPXSee"
37 Var StartMenuFolder
39 ;--------------------------------
41 ; Pages
43 !insertmacro MUI_PAGE_WELCOME
44 !insertmacro MUI_PAGE_LICENSE "licence.txt"
45 !insertmacro MUI_PAGE_COMPONENTS
46 !insertmacro MUI_PAGE_DIRECTORY
47 !insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder
48 !insertmacro MUI_PAGE_INSTFILES
50 !insertmacro MUI_UNPAGE_CONFIRM
51 !insertmacro MUI_UNPAGE_INSTFILES
53 ;--------------------------------
55 ; Languages
56 !insertmacro MUI_LANGUAGE "English"
59 ; The stuff to install
60 Section "GPXSee (required)" SEC_APP
62 SectionIn RO
64 ; Set output path to the installation directory.
65 SetOutPath $INSTDIR
67 ; Put the files there
68 File "gpxsee.exe"
69 File "maps.txt"
71 ; Create start menu entry and add links
72 SetShellVarContext all
73 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
74 CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
75 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
76 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\GPXSee.lnk" "$INSTDIR\gpxsee.exe"
77 !insertmacro MUI_STARTMENU_WRITE_END
79 ; Create the uninstaller
80 WriteUninstaller "$INSTDIR\uninstall.exe"
82 ; Write the installation path into the registry
83 DetailPrint "Registering application..."
84 WriteRegStr HKLM SOFTWARE\GPXSee "Install_Dir" "$INSTDIR"
86 ; Write the uninstall keys for Windows
87 WriteRegStr HKLM "${REGENTRY}" "DisplayName" "GPXSee"
88 WriteRegStr HKLM "${REGENTRY}" "Publisher" "Martin Tuma"
89 WriteRegStr HKLM "${REGENTRY}" "DisplayVersion" "${VERSION}"
90 WriteRegStr HKLM "${REGENTRY}" "UninstallString" '"$INSTDIR\uninstall.exe"'
91 WriteRegDWORD HKLM "${REGENTRY}" "NoModify" 1
92 WriteRegDWORD HKLM "${REGENTRY}" "NoRepair" 1
94 ; Associate file formats
95 DetailPrint "Associating file types..."
96 WriteRegStr HKCR ".gpx" "" "${REGGPX}"
97 WriteRegStr HKCR "${REGGPX}" "" "GPS Exchange Format"
98 WriteRegStr HKCR "${REGGPX}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,1"
99 WriteRegStr HKCR "${REGGPX}\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
100 WriteRegStr HKCR ".tcx" "" "${REGTCX}"
101 WriteRegStr HKCR "${REGTCX}" "" "Training Center XML"
102 WriteRegStr HKCR "${REGTCX}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,2"
103 WriteRegStr HKCR "${REGTCX}\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
104 WriteRegStr HKCR ".kml" "" "${REGKML}"
105 WriteRegStr HKCR "${REGKML}" "" "Keyhole Markup Language"
106 WriteRegStr HKCR "${REGKML}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,3"
107 WriteRegStr HKCR "${REGKML}\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
108 WriteRegStr HKCR ".fit" "" "${REGFIT}"
109 WriteRegStr HKCR "${REGFIT}" "" "Flexible and Interoperable Data Transfer"
110 WriteRegStr HKCR "${REGFIT}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,4"
111 WriteRegStr HKCR "${REGFIT}\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
112 WriteRegStr HKCR ".igc" "" "${REGIGC}"
113 WriteRegStr HKCR "${REGIGC}" "" "Flight Recorder Data Format"
114 WriteRegStr HKCR "${REGIGC}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,5"
115 WriteRegStr HKCR "${REGIGC}\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
116 WriteRegStr HKCR ".nmea" "" "${REGNMEA}"
117 WriteRegStr HKCR "${REGNMEA}" "" "NMEA 0183 data"
118 WriteRegStr HKCR "${REGNMEA}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,6"
119 WriteRegStr HKCR "${REGNMEA}\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
121 System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)'
123 SectionEnd
125 Section "QT libs" SEC_QT
127 File "Qt5Core.dll"
128 File "Qt5Gui.dll"
129 File "Qt5Widgets.dll"
130 File "Qt5PrintSupport.dll"
131 File "Qt5Network.dll"
132 File "libGLESv2.dll"
133 File "libEGL.dll"
134 File "D3DCompiler_47.dll"
135 File /r "platforms"
136 File /r "imageformats"
137 File /r "printsupport"
139 SectionEnd
141 Section "MSVC runtime" SEC_MSVC
143 DetailPrint "Checking whether Visual C++ 2015 Redistributable is already installed..."
144 ${If} ${RunningX64}
145 ReadRegDword $R0 HKLM "SOFTWARE\Wow6432Node\Microsoft\VisualStudio\14.0\VC\Runtimes\x86" "Installed"
146 ${Else}
147 ReadRegDword $R0 HKLM "SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x86" "Installed"
148 ${EndIf}
150 StrCmp $R0 "1" 0 +3
151 DetailPrint "Visual C++ 2015 Redistributable is already installed, skipping install."
152 Goto done
154 DetailPrint "Installing Visual C++ 2015 Redistributable..."
155 SetOutPath $TEMP
156 File "VC_redist.x86.exe"
157 ExecWait '"$TEMP/VC_redist.x86.exe" /install /quiet /norestart'
159 done:
160 SectionEnd
162 ;--------------------------------
164 ; Uninstaller
166 Section "Uninstall"
168 ; Remove registry keys
169 DeleteRegKey HKLM "${REGENTRY}"
170 DeleteRegKey HKLM SOFTWARE\GPXSee
172 ; Remove directories used
173 RMDir /r "$INSTDIR"
175 ; Remove Start menu entries
176 SetShellVarContext all
177 !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
178 Delete "$SMPROGRAMS\$StartMenuFolder\*.*"
179 RMDir "$SMPROGRAMS\$StartMenuFolder"
181 ; Remove GPX file association
182 DeleteRegKey HKCR "${REGGPX}"
183 DeleteRegKey HKCR ".gpx"
184 DeleteRegKey HKCR "${REGTCX}"
185 DeleteRegKey HKCR ".tcx"
186 DeleteRegKey HKCR "${REGKML}"
187 DeleteRegKey HKCR ".kml"
188 DeleteRegKey HKCR "${REGFIT}"
189 DeleteRegKey HKCR ".fit"
190 DeleteRegKey HKCR "${REGIGC}"
191 DeleteRegKey HKCR ".igc"
192 DeleteRegKey HKCR "${REGNMEA}"
193 DeleteRegKey HKCR ".nmea"
194 System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)'
196 SectionEnd
198 ;-------------------------------
200 ;Descriptions
202 ;Language strings
203 LangString DESC_QT ${LANG_ENGLISH} \
204 "QT Library. Unselct only if you have QT already installed!"
205 LangString DESC_MSVC ${LANG_ENGLISH} \
206 "Visual C++ 2015 runtime components. Unselct only if you have the runtime already installed!"
207 LangString DESC_APP ${LANG_ENGLISH} \
208 "GPXSee application"
210 ;Assign language strings to sections
211 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
212 !insertmacro MUI_DESCRIPTION_TEXT ${SEC_QT} $(DESC_QT)
213 !insertmacro MUI_DESCRIPTION_TEXT ${SEC_MSVC} $(DESC_MSVC)
214 !insertmacro MUI_DESCRIPTION_TEXT ${SEC_APP} $(DESC_APP)
215 !insertmacro MUI_FUNCTION_DESCRIPTION_END