1!include x64.nsh
2Name "@CMAKE_PROJECT_NAME@ SDK for @INST_PLATFORM@"
3OutFile "@CMAKE_BINARY_DIR@\${BUILDDIR}@INST_NAME@.exe"
4InstallDir @INST_DIR@
5
6SetCompressor bzip2
7
8Page directory
9Page instfiles
10
11UninstPage uninstConfirm
12UninstPage instfiles
13
14Section "@CMAKE_PROJECT_NAME@ SDK for @INST_PLATFORM@ (required)"
15!ifdef WIN64
16	${If} ${RunningX64}
17	${DisableX64FSRedirection}
18	${Endif}
19!endif
20	SectionIn RO
21!ifdef GCC
22	IfFileExists $SYSDIR/libturbojpeg.dll exists 0
23!else
24	IfFileExists $SYSDIR/turbojpeg.dll exists 0
25!endif
26	goto notexists
27	exists:
28!ifdef GCC
29	MessageBox MB_OK "An existing version of the @CMAKE_PROJECT_NAME@ SDK for @INST_PLATFORM@ is already installed.  Please uninstall it first."
30!else
31	MessageBox MB_OK "An existing version of the @CMAKE_PROJECT_NAME@ SDK for @INST_PLATFORM@ or the TurboJPEG SDK is already installed.  Please uninstall it first."
32!endif
33	quit
34
35	notexists:
36	SetOutPath $SYSDIR
37!ifdef GCC
38	File "@CMAKE_BINARY_DIR@\libturbojpeg.dll"
39!else
40	File "@CMAKE_BINARY_DIR@\${BUILDDIR}turbojpeg.dll"
41!endif
42	SetOutPath $INSTDIR\bin
43!ifdef GCC
44	File "@CMAKE_BINARY_DIR@\libturbojpeg.dll"
45!else
46	File "@CMAKE_BINARY_DIR@\${BUILDDIR}turbojpeg.dll"
47!endif
48!ifdef GCC
49	File "/oname=libjpeg-@DLL_VERSION@.dll" "@CMAKE_BINARY_DIR@\sharedlib\libjpeg-*.dll"
50!else
51	File "@CMAKE_BINARY_DIR@\sharedlib\${BUILDDIR}jpeg@DLL_VERSION@.dll"
52!endif
53	File "@CMAKE_BINARY_DIR@\sharedlib\${BUILDDIR}cjpeg.exe"
54	File "@CMAKE_BINARY_DIR@\sharedlib\${BUILDDIR}djpeg.exe"
55	File "@CMAKE_BINARY_DIR@\sharedlib\${BUILDDIR}jpegtran.exe"
56	File "@CMAKE_BINARY_DIR@\${BUILDDIR}tjbench.exe"
57	File "@CMAKE_BINARY_DIR@\${BUILDDIR}rdjpgcom.exe"
58	File "@CMAKE_BINARY_DIR@\${BUILDDIR}wrjpgcom.exe"
59	SetOutPath $INSTDIR\lib
60!ifdef GCC
61	File "@CMAKE_BINARY_DIR@\libturbojpeg.dll.a"
62	File "@CMAKE_BINARY_DIR@\libturbojpeg.a"
63	File "@CMAKE_BINARY_DIR@\sharedlib\libjpeg.dll.a"
64	File "@CMAKE_BINARY_DIR@\libjpeg.a"
65!else
66	File "@CMAKE_BINARY_DIR@\${BUILDDIR}turbojpeg.lib"
67	File "@CMAKE_BINARY_DIR@\${BUILDDIR}turbojpeg-static.lib"
68	File "@CMAKE_BINARY_DIR@\sharedlib\${BUILDDIR}jpeg.lib"
69	File "@CMAKE_BINARY_DIR@\${BUILDDIR}jpeg-static.lib"
70!endif
71!ifdef JAVA
72	SetOutPath $INSTDIR\classes
73	File "@CMAKE_BINARY_DIR@\java\${BUILDDIR}turbojpeg.jar"
74!endif
75	SetOutPath $INSTDIR\include
76	File "@CMAKE_BINARY_DIR@\jconfig.h"
77	File "@CMAKE_SOURCE_DIR@\jerror.h"
78	File "@CMAKE_SOURCE_DIR@\jmorecfg.h"
79	File "@CMAKE_SOURCE_DIR@\jpeglib.h"
80	File "@CMAKE_SOURCE_DIR@\turbojpeg.h"
81	SetOutPath $INSTDIR\doc
82	File "@CMAKE_SOURCE_DIR@\README"
83	File "@CMAKE_SOURCE_DIR@\README-turbo.txt"
84	File "@CMAKE_SOURCE_DIR@\example.c"
85	File "@CMAKE_SOURCE_DIR@\libjpeg.txt"
86	File "@CMAKE_SOURCE_DIR@\structure.txt"
87	File "@CMAKE_SOURCE_DIR@\usage.txt"
88	File "@CMAKE_SOURCE_DIR@\wizard.txt"
89
90	WriteRegStr HKLM "SOFTWARE\@INST_REG_NAME@ @VERSION@" "Install_Dir" "$INSTDIR"
91
92	WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@INST_REG_NAME@ @VERSION@" "DisplayName" "@CMAKE_PROJECT_NAME@ SDK v@VERSION@ for @INST_PLATFORM@"
93	WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@INST_REG_NAME@ @VERSION@" "UninstallString" '"$INSTDIR\uninstall_@VERSION@.exe"'
94	WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@INST_REG_NAME@ @VERSION@" "NoModify" 1
95	WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@INST_REG_NAME@ @VERSION@" "NoRepair" 1
96	WriteUninstaller "uninstall_@VERSION@.exe"
97SectionEnd
98
99Section "Uninstall"
100!ifdef WIN64
101	${If} ${RunningX64}
102	${DisableX64FSRedirection}
103	${Endif}
104!endif
105
106	SetShellVarContext all
107
108	DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@INST_REG_NAME@ @VERSION@"
109	DeleteRegKey HKLM "SOFTWARE\@INST_REG_NAME@ @VERSION@"
110
111!ifdef GCC
112	Delete $INSTDIR\bin\libjpeg-@DLL_VERSION@.dll
113	Delete $INSTDIR\bin\libturbojpeg.dll
114	Delete $SYSDIR\libturbojpeg.dll
115	Delete $INSTDIR\lib\libturbojpeg.dll.a"
116	Delete $INSTDIR\lib\libturbojpeg.a"
117	Delete $INSTDIR\lib\libjpeg.dll.a"
118	Delete $INSTDIR\lib\libjpeg.a"
119!else
120	Delete $INSTDIR\bin\jpeg@DLL_VERSION@.dll
121	Delete $INSTDIR\bin\turbojpeg.dll
122	Delete $SYSDIR\turbojpeg.dll
123	Delete $INSTDIR\lib\jpeg.lib
124	Delete $INSTDIR\lib\jpeg-static.lib
125	Delete $INSTDIR\lib\turbojpeg.lib
126	Delete $INSTDIR\lib\turbojpeg-static.lib
127!endif
128!ifdef JAVA
129	Delete $INSTDIR\classes\turbojpeg.jar
130!endif
131	Delete $INSTDIR\bin\cjpeg.exe
132	Delete $INSTDIR\bin\djpeg.exe
133	Delete $INSTDIR\bin\jpegtran.exe
134	Delete $INSTDIR\bin\tjbench.exe
135	Delete $INSTDIR\bin\rdjpgcom.exe
136	Delete $INSTDIR\bin\wrjpgcom.exe
137	Delete $INSTDIR\include\jconfig.h"
138	Delete $INSTDIR\include\jerror.h"
139	Delete $INSTDIR\include\jmorecfg.h"
140	Delete $INSTDIR\include\jpeglib.h"
141	Delete $INSTDIR\include\turbojpeg.h"
142	Delete $INSTDIR\uninstall_@VERSION@.exe
143	Delete $INSTDIR\doc\README
144	Delete $INSTDIR\doc\README-turbo.txt
145	Delete $INSTDIR\doc\example.c
146	Delete $INSTDIR\doc\libjpeg.txt
147	Delete $INSTDIR\doc\structure.txt
148	Delete $INSTDIR\doc\usage.txt
149	Delete $INSTDIR\doc\wizard.txt
150
151	RMDir "$INSTDIR\include"
152	RMDir "$INSTDIR\lib"
153	RMDir "$INSTDIR\doc"
154!ifdef JAVA
155	RMDir "$INSTDIR\classes"
156!endif
157	RMDir "$INSTDIR\bin"
158	RMDir "$INSTDIR"
159
160SectionEnd
161