Skip to content

Commit 5328635

Browse files
committed
Create nsis script
1 parent dd036c6 commit 5328635

File tree

4 files changed

+506
-0
lines changed

4 files changed

+506
-0
lines changed

install/windows/nsis/app.nsi

Lines changed: 328 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,328 @@
1+
; NSIS script file
2+
3+
4+
;==============================;
5+
; Configuration ;
6+
;==============================;
7+
8+
!ifndef APP_ARCH
9+
!define APP_ARCH x86_64
10+
!endif
11+
12+
!ifndef INSTALLER_FILE
13+
!define INSTALLER_FILE GCodeWorkShop_${APP_ARCH}_Setup.exe
14+
!endif
15+
16+
; Base directories
17+
18+
!ifndef PROJECT_ROOT
19+
!define PROJECT_ROOT ${__FILEDIR__}\..\..\..
20+
!endif
21+
22+
!ifndef BUILD_ROOT
23+
!if /FileExists "${BUILD_ROOT}\build\"
24+
!define BUILD_ROOT ${PROJECT_ROOT}\build
25+
!else
26+
!define BUILD_ROOT ${PROJECT_ROOT}
27+
!endif
28+
!endif
29+
30+
; Sources directories
31+
32+
!ifndef APP_BINS
33+
!define APP_BINS ${PROJECT_ROOT}\bin\release
34+
!endif
35+
36+
!ifndef APP_DOCS
37+
!define APP_DOCS ${PROJECT_ROOT}\doc
38+
!endif
39+
40+
!ifndef APP_EXAMPLES
41+
!define APP_EXAMPLES ${PROJECT_ROOT}\examples
42+
!endif
43+
44+
!ifndef APP_I18N
45+
!define APP_I18N ${PROJECT_ROOT}\lang
46+
!endif
47+
48+
!ifndef CXX_BINS
49+
!ifdef CXX_RUNTIME
50+
!define CXX_BINS ${CXX_RUNTIME}
51+
!else
52+
!define CXX_BINS ${APP_BINS}
53+
!endif
54+
!endif
55+
56+
!ifndef QT_BINS
57+
!ifdef QT_HOST_BINS
58+
!define QT_BINS ${QT_HOST_BINS}
59+
!else
60+
!define QT_BINS ${APP_BINS}
61+
!endif
62+
!endif
63+
64+
!ifndef QT_DEP_BINS
65+
!define QT_DEP_BINS ${QT_BINS}
66+
!endif
67+
68+
!ifndef QT_PLUGINS
69+
!ifdef QT_HOST_DATA
70+
!define QT_PLUGINS ${QT_HOST_DATA}\plugins
71+
!else
72+
!define QT_PLUGINS ${QT_BINS}
73+
!endif
74+
!endif
75+
76+
!ifndef QT_I18NS
77+
!ifdef QT_HOST_DATA
78+
!define QT_I18NS ${QT_HOST_DATA}\translations
79+
!else
80+
!define QT_I18NS ${QT_BINS}\translations
81+
!endif
82+
!endif
83+
84+
; Destination subdirectories
85+
86+
!ifndef DST_BINS
87+
!define DST_BINS bin
88+
!endif
89+
90+
!ifndef DST_DOCS
91+
!define DST_DOCS doc
92+
!endif
93+
94+
!ifndef DST_EXAMPLES
95+
!define DST_EXAMPLES examples
96+
!endif
97+
98+
!ifndef DST_I18NS
99+
!define DST_I18NS lang
100+
!endif
101+
102+
103+
;==============================;
104+
; General ;
105+
;==============================;
106+
107+
; The icon for the installer and uninstaller.
108+
; MUI_ICON icon_file
109+
; MUI_UNICON icon_file
110+
111+
Unicode true
112+
Name "GCodeWorkShop"
113+
OutFile "${INSTALLER_FILE}"
114+
115+
!if ${APP_ARCH} == "x86_64"
116+
InstallDir "$PROGRAMFILES64\GCodeWorkShop"
117+
!else
118+
InstallDir "$PROGRAMFILES32\GCodeWorkShop"
119+
!endif
120+
121+
InstallDirRegKey HKEY_LOCAL_MACHINE "SOFTWARE\GCodeWorkShop" ""
122+
; SetCompressor lzma
123+
124+
125+
; Modern UI
126+
127+
!include "MUI.nsh"
128+
!define MUI_ABORTWARNING
129+
130+
131+
;==============================;
132+
; Pages ;
133+
;==============================;
134+
135+
Var STARTMENU_FOLDER
136+
137+
!insertmacro MUI_PAGE_WELCOME
138+
!insertmacro MUI_PAGE_LICENSE "${PROJECT_ROOT}\LICENSE"
139+
!insertmacro MUI_PAGE_DIRECTORY
140+
141+
;Start Menu Folder Page Configuration
142+
!define MUI_STARTMENUPAGE_REGISTRY_ROOT HKEY_LOCAL_MACHINE
143+
!define MUI_STARTMENUPAGE_REGISTRY_KEY "SOFTWARE\GCodeWorkShop"
144+
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
145+
!insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER
146+
147+
!insertmacro MUI_PAGE_INSTFILES
148+
!insertmacro MUI_PAGE_FINISH
149+
150+
; Uninstaller pages
151+
!insertmacro MUI_UNPAGE_WELCOME
152+
!insertmacro MUI_UNPAGE_CONFIRM
153+
!insertmacro MUI_UNPAGE_INSTFILES
154+
!insertmacro MUI_UNPAGE_FINISH
155+
156+
157+
;==============================;
158+
; Languages ;
159+
;==============================;
160+
161+
!insertmacro MUI_LANGUAGE "English"
162+
!insertmacro MUI_LANGUAGE "Catalan"
163+
!insertmacro MUI_LANGUAGE "Czech"
164+
!insertmacro MUI_LANGUAGE "Dutch"
165+
!insertmacro MUI_LANGUAGE "Finnish"
166+
!insertmacro MUI_LANGUAGE "German"
167+
!insertmacro MUI_LANGUAGE "Polish"
168+
!insertmacro MUI_LANGUAGE "Russian"
169+
!insertmacro MUI_LANGUAGE "Spanish"
170+
171+
172+
;==============================;
173+
; Main section ;
174+
;==============================;
175+
176+
Section "-Install"
177+
SetOutPath "$INSTDIR"
178+
File /oname=LICENSE.txt "${PROJECT_ROOT}\LICENSE"
179+
180+
SetOutPath "$INSTDIR\${DST_BINS}"
181+
File /oname=GCodeWorkShop.exe "${APP_BINS}\gcodeworkshop.exe"
182+
File /oname=GCodeFileServer.exe "${APP_BINS}\gcodefileserver.exe"
183+
File /oname=qt.conf "${__FILEDIR__}\..\qt.conf"
184+
185+
;Store installation folder
186+
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\GCodeWorkShop" "" "$INSTDIR"
187+
188+
;Create uninstaller
189+
WriteUninstaller "$INSTDIR\uninst.exe"
190+
191+
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
192+
;Create shortcuts
193+
CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
194+
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\GCodeWorkShop.lnk" "$INSTDIR\${DST_BINS}\GCodeWorkShop.exe"
195+
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\uninst.exe"
196+
!insertmacro MUI_STARTMENU_WRITE_END
197+
SectionEnd
198+
199+
Section "Uninstall"
200+
Push $R0
201+
!insertmacro MUI_STARTMENU_GETFOLDER Application $R0
202+
Delete "$SMPROGRAMS\$R0\Uninstall.lnk"
203+
Delete "$SMPROGRAMS\$R0\GCodeWorkShop.lnk"
204+
RMDir "$SMPROGRAMS\$R0"
205+
Pop $R0
206+
207+
DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\GCodeWorkShop"
208+
DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\GCodeWorkShop"
209+
210+
Delete "$INSTDIR\${DST_BINS}\GCodeWorkShop.exe"
211+
Delete "$INSTDIR\${DST_BINS}\GCodeFileServer.exe"
212+
Delete "$INSTDIR\${DST_BINS}\qt.conf"
213+
Delete "$INSTDIR\LICENSE.txt"
214+
Delete "$INSTDIR\uninst.exe"
215+
216+
RMDir "$INSTDIR\${DST_BINS}"
217+
RMDir "$INSTDIR"
218+
SectionEnd
219+
220+
221+
;==============================;
222+
; Internationalisation ;
223+
;==============================;
224+
225+
Section "-Install i18n"
226+
SetOutPath "$INSTDIR\${DST_I18NS}"
227+
228+
File /oname=gcodeworkshop_ca.qm "${APP_I18N}\gcodeworkshop_ca.qm"
229+
File /oname=gcodeworkshop_cs_CZ.qm "${APP_I18N}\gcodeworkshop_cs_CZ.qm"
230+
File /oname=gcodeworkshop_de.qm "${APP_I18N}\gcodeworkshop_de.qm"
231+
File /oname=gcodeworkshop_es.qm "${APP_I18N}\gcodeworkshop_es.qm"
232+
File /oname=gcodeworkshop_fi.qm "${APP_I18N}\gcodeworkshop_fi.qm"
233+
File /oname=gcodeworkshop_nl.qm "${APP_I18N}\gcodeworkshop_nl.qm"
234+
File /oname=gcodeworkshop_pl.qm "${APP_I18N}\gcodeworkshop_pl.qm"
235+
File /oname=gcodeworkshop_ru.qm "${APP_I18N}\gcodeworkshop_ru.qm"
236+
File /oname=kdiff3_ca.qm "${APP_I18N}\kdiff3_ca.qm"
237+
File /oname=kdiff3_cs_CZ.qm "${APP_I18N}\kdiff3_cs_CZ.qm"
238+
File /oname=kdiff3_de.qm "${APP_I18N}\kdiff3_de.qm"
239+
File /oname=kdiff3_es.qm "${APP_I18N}\kdiff3_es.qm"
240+
File /oname=kdiff3_fi.qm "${APP_I18N}\kdiff3_fi.qm"
241+
File /oname=kdiff3_nl.qm "${APP_I18N}\kdiff3_nl.qm"
242+
File /oname=kdiff3_pl.qm "${APP_I18N}\kdiff3_pl.qm"
243+
File /oname=kdiff3_ru.qm "${APP_I18N}\kdiff3_ru.qm"
244+
SectionEnd
245+
246+
Section "un.Install i18n"
247+
Delete "$INSTDIR\${DST_I18NS}\gcodeworkshop_ca.qm"
248+
Delete "$INSTDIR\${DST_I18NS}\gcodeworkshop_cs_CZ.qm"
249+
Delete "$INSTDIR\${DST_I18NS}\gcodeworkshop_de.qm"
250+
Delete "$INSTDIR\${DST_I18NS}\gcodeworkshop_es.qm"
251+
Delete "$INSTDIR\${DST_I18NS}\gcodeworkshop_fi.qm"
252+
Delete "$INSTDIR\${DST_I18NS}\gcodeworkshop_nl.qm"
253+
Delete "$INSTDIR\${DST_I18NS}\gcodeworkshop_pl.qm"
254+
Delete "$INSTDIR\${DST_I18NS}\gcodeworkshop_ru.qm"
255+
Delete "$INSTDIR\${DST_I18NS}\kdiff3_ca.qm"
256+
Delete "$INSTDIR\${DST_I18NS}\kdiff3_cs_CZ.qm"
257+
Delete "$INSTDIR\${DST_I18NS}\kdiff3_de.qm"
258+
Delete "$INSTDIR\${DST_I18NS}\kdiff3_es.qm"
259+
Delete "$INSTDIR\${DST_I18NS}\kdiff3_fi.qm"
260+
Delete "$INSTDIR\${DST_I18NS}\kdiff3_nl.qm"
261+
Delete "$INSTDIR\${DST_I18NS}\kdiff3_pl.qm"
262+
Delete "$INSTDIR\${DST_I18NS}\kdiff3_ru.qm"
263+
264+
RMDir "$INSTDIR\${DST_I18NS}"
265+
RMDir "$INSTDIR"
266+
SectionEnd
267+
268+
269+
;==============================;
270+
; Documentation ;
271+
;==============================;
272+
273+
Section "-Install doc"
274+
SetOutPath "$INSTDIR\${DST_DOCS}"
275+
276+
File /oname=SerialTransmission_Help.html "${APP_DOCS}\SerialTransmission_Help.html"
277+
SectionEnd
278+
279+
Section "un.Install doc"
280+
Delete "$INSTDIR\${DST_DOCS}\SerialTransmission_Help.html"
281+
282+
RMDir "$INSTDIR\${DST_DOCS}"
283+
RMDir "$INSTDIR"
284+
SectionEnd
285+
286+
287+
;==============================;
288+
; Examples ;
289+
;==============================;
290+
291+
Section "-Install Examples"
292+
SetOutPath "$INSTDIR\${DST_EXAMPLES}"
293+
294+
File /oname=0100.nc "${APP_EXAMPLES}\0100.nc"
295+
File /oname=FANUC0M.nc "${APP_EXAMPLES}\FANUC0M.nc"
296+
File /oname=FANUC0T.nc "${APP_EXAMPLES}\FANUC0T.nc"
297+
File /oname=FLANGE.nc "${APP_EXAMPLES}\FLANGE.nc"
298+
File /oname=HAAS.nc "${APP_EXAMPLES}\HAAS.nc"
299+
File /oname=HK.nc "${APP_EXAMPLES}\HK.nc"
300+
File /oname=OSP5020M.nc "${APP_EXAMPLES}\OSP5020M.nc"
301+
File /oname=OSP7000L.nc "${APP_EXAMPLES}\OSP7000L.nc"
302+
File /oname=PHILIPS.nc "${APP_EXAMPLES}\PHILIPS.nc"
303+
File /oname=SINUMERIK840D.nc "${APP_EXAMPLES}\SINUMERIK840D.nc"
304+
File /oname=SINUMERIK850.nc "${APP_EXAMPLES}\SINUMERIK850.nc"
305+
File /oname=TOKARKA.nc "${APP_EXAMPLES}\TOKARKA.NC"
306+
File /oname=cnc_tips.txt "${APP_EXAMPLES}\cnc_tips.txt"
307+
File /oname=macro7.nc "${APP_EXAMPLES}\macro7.nc"
308+
SectionEnd
309+
310+
Section "un.Install Examples"
311+
Delete "$INSTDIR\${DST_EXAMPLES}\0100.nc"
312+
Delete "$INSTDIR\${DST_EXAMPLES}\FANUC0M.nc"
313+
Delete "$INSTDIR\${DST_EXAMPLES}\FANUC0T.nc"
314+
Delete "$INSTDIR\${DST_EXAMPLES}\FLANGE.nc"
315+
Delete "$INSTDIR\${DST_EXAMPLES}\HAAS.nc"
316+
Delete "$INSTDIR\${DST_EXAMPLES}\HK.nc"
317+
Delete "$INSTDIR\${DST_EXAMPLES}\OSP5020M.nc"
318+
Delete "$INSTDIR\${DST_EXAMPLES}\OSP7000L.nc"
319+
Delete "$INSTDIR\${DST_EXAMPLES}\PHILIPS.nc"
320+
Delete "$INSTDIR\${DST_EXAMPLES}\SINUMERIK840D.nc"
321+
Delete "$INSTDIR\${DST_EXAMPLES}\SINUMERIK850.nc"
322+
Delete "$INSTDIR\${DST_EXAMPLES}\TOKARKA.nc"
323+
Delete "$INSTDIR\${DST_EXAMPLES}\cnc_tips.txt"
324+
Delete "$INSTDIR\${DST_EXAMPLES}\macro7.nc"
325+
326+
RMDir "$INSTDIR\${DST_EXAMPLES}"
327+
RMDir "$INSTDIR"
328+
SectionEnd

0 commit comments

Comments
 (0)