-
Notifications
You must be signed in to change notification settings - Fork 0
/
WindowsInstaller.iss.sample
202 lines (175 loc) · 8.37 KB
/
WindowsInstaller.iss.sample
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
; MAKE SURE TO CHANGE THIS INFORMATION BEFORE BUILDING A NEW RELEASE
; MUST UPDATE SOURCE DIRECTORY AT A MINIMUM
#define MyAppName "SIUE Fat Segmentation Tool"
#define MyAppPublisher "Addison Elliott"
#define MyAppURL "https://github.com/addisonElliott/SIUE-Fat-Segmentation-Tool"
#define MyAppExeName "SIUE Fat Segmentation Tool.exe"
#define MyAppRelease "Release"
; Source directory of the build. This should be the folder that Qt Creator generates when building
#define SrcDir "<SOURCE-DIRECTORY>-" + MyAppRelease + "\" + LowerCase(MyAppRelease)
; Get application version based on the metadata from the executable
#define MyAppVersion GetFileVersion(SrcDir + "\" + MyAppExeName)
; Output filename and directory for the installer
#define OutputFilename "SIUE-Fat-Segmentation-Tool-v" + MyAppVersion + "-" + MyAppRelease + "-Win_x64"
#define OutputDirectory "<DESIRED-OUTPUT-DIRECTORY-HERE>"
; Location of the binary directories for the external libraries: NIFTI, ZLIB, OpenCV Debug & Release
#define NiftiBin "<NIFTI-BIN-PATH>"
#define ZlibBin "<ZLIB-BIN-PATH>"
#define OpenCVBinDebug "<OPENCV-DEBUG-BIN-PATH>"
#define OpenCVBinRelease "<OPENCV-RELEASE-BIN-PATH>"
#define QuazipBin "<QUAZIP-BIN-PATH>"
#define OpenSSLBin "<OPENSSL-WIN64-BIN-PATH>"
#define WinDeployQt "<WINDEPLOYQT-BIN>"
; Run WinDeployQt when compiling script to get Qt DLLs to directory
; Add --debug or --release depending on MyAppRelease macro
#expr Exec(WinDeployQt, SrcDir + " --" + LowerCase(MyAppRelease))
[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{9E4A7C1E-4DA4-4ABB-8250-AFCF2A11BD32}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DisableProgramGroupPage=yes
OutputDir={#OutputDirectory}
OutputBaseFilename={#OutputFilename}
Compression=lzma
SolidCompression=yes
ArchitecturesInstallIn64BitMode=x64
ArchitecturesAllowed=x86 x64
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Dirs]
Name: {app}\; Permissions: users-modify
Name: {app}\iconengines\; Permissions: users-modify
Name: {app}\imageformats\; Permissions: users-modify
Name: {app}\platforms\; Permissions: users-modify
Name: {app}\translations\; Permissions: users-modify
[Files]
#if MyAppRelease == "Debug"
Source: "{#NiftiBin}/libniftid.dll"; DestDir: "{app}"; Flags: ignoreversion
#else
Source: "{#NiftiBin}/libnifti.dll"; DestDir: "{app}"; Flags: ignoreversion
#endif
Source: "{#ZlibBin}/zlib.dll"; DestDir: "{app}"; Flags: ignoreversion
#if MyAppRelease == "Debug"
Source: "{#OpenCVBinDebug}/opencv_core310d.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#OpenCVBinDebug}/opencv_imgproc310d.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#OpenCVBinDebug}/opencv_highgui310d.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#OpenCVBinDebug}/opencv_ml310d.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#OpenCVBinDebug}/opencv_video310d.dll"; DestDir: "{app}"; Flags: ignoreversion
#else
Source: "{#OpenCVBinRelease}/opencv_core310.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#OpenCVBinRelease}/opencv_imgproc310.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#OpenCVBinRelease}/opencv_highgui310.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#OpenCVBinRelease}/opencv_ml310.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#OpenCVBinRelease}/opencv_video310.dll"; DestDir: "{app}"; Flags: ignoreversion
#endif
#if MyAppRelease == "Debug"
Source: "{#QuazipBin}/quazipd.dll"; DestDir: "{app}"; Flags: ignoreversion
#else
Source: "{#QuazipBin}/quazip.dll"; DestDir: "{app}"; Flags: ignoreversion
#endif
Source: "{#OpenSSLBin}/libeay32.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#OpenSSLBin}/libssl32.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#OpenSSLBin}/ssleay32.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#SrcDir}\*.dll"; DestDir: "{app}"; Flags: ignoreversion skipifsourcedoesntexist
Source: "{#SrcDir}\*.pdb"; DestDir: "{app}"; Flags: ignoreversion skipifsourcedoesntexist
Source: "{#SrcDir}\{#MyAppName}.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#SrcDir}\{#MyAppName}_resource.res"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#SrcDir}\iconengines\*"; DestDir: "{app}\iconengines"; Flags: ignoreversion recursesubdirs createallsubdirs skipifsourcedoesntexist
Source: "{#SrcDir}\imageformats\*"; DestDir: "{app}\imageformats"; Flags: ignoreversion recursesubdirs createallsubdirs skipifsourcedoesntexist
Source: "{#SrcDir}\platforms\*"; DestDir: "{app}\platforms"; Flags: ignoreversion recursesubdirs createallsubdirs skipifsourcedoesntexist
Source: "{#SrcDir}\translations\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs skipifsourcedoesntexist
Source: "{#SrcDir}\vcredist_x64.exe"; DestDir: {tmp}; Flags: deleteafterinstall skipifsourcedoesntexist
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
Name: "{commonprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
Filename: {tmp}\vcredist_x64.exe; \
Parameters: "/q /passive /norestart /Q:a /c:""msiexec /q /i vcredist.msi"""; \
Check: VCRedistNeedsInstall; \
StatusMsg: "Installing VC++ 2015 Redistributables..."
[Code]
function IsX64: boolean;
begin
Result := Is64BitInstallMode and (ProcessorArchitecture = paX64);
end;
procedure Explode(var Dest: TArrayOfString; Text: String; Separator: String);
var i, p: Integer;
begin
i := 0;
repeat
SetArrayLength(Dest, i+1);
p := Pos(Separator,Text);
if p > 0 then begin
Dest[i] := Copy(Text, 1, p-1);
Text := Copy(Text, p + Length(Separator), Length(Text));
i := i + 1;
end else begin
Dest[i] := Text;
Text := '';
end;
until Length(Text)=0;
end;
function IsVcRedistInstalled(version: String; build: cardinal): boolean;
var
regBuildNumber: cardinal;
regKey: String;
regInstalled: cardinal;
regStringBuildNumber: String;
strArrayBuildNumber: TArrayOfString;
begin
Log('Check for VC Redist ' + version + ' with build ' + IntToStr(build));
if(IsX64()) then begin
regKey := 'SOFTWARE\WOW6432Node\Microsoft\VisualStudio\'+ version +'\VC\Runtimes\x64';
end else begin
regKey := 'SOFTWARE\Microsoft\VisualStudio\'+ version +'\VC\VCRedist\x86';
end;
RegQueryDWordValue(HKLM, regKey, 'Installed', regInstalled);
//Normal version installed, compare buildNumber
if(regInstalled = 1) then begin
Log('VC Redist ' + version + ' Installed');
RegQueryDWordValue(HKLM, regKey, 'Bld', regBuildNumber);
Result:= (regBuildNumber >= build);
Log('Detected VC Redist Build ' + IntToStr(regBuildNumber));
Exit;
end;
Log('VC Redist ' + version + ' not in default directory registry.')
//Check developer version
if(IsX64()) then begin
regKey := 'SOFTWARE\Wow6432Node\Microsoft\DevDiv\vc\Servicing\'+ version +'\RuntimeAdditional';
end else begin
regKey := 'SOFTWARE\Microsoft\DevDiv\vc\Servicing\'+ version +'\VC\VCRedist\x86';
end;
RegQueryDWordValue(HKLM, regKey, 'Install', regInstalled);
if(regInstalled <> 1) then begin
Result := false;
Exit;
end;
RegQueryStringValue(HKLM, regKey, 'Version', regStringBuildNumber);
Explode(strArrayBuildNumber, regStringBuildNumber, '.');
regBuildNumber := StrToInt(strArrayBuildNumber[2]);
Result:= (regBuildNumber >= build);
end;
function VCRedistNeedsInstall: Boolean;
begin
{ here the Result must be True when you need to install your VCRedist }
{ or False when you don't need to, so now it's upon you how you build }
{ this statement, the following won't install your VC redist only when }
{ the Visual C++ 2010 Redist (x86) and Visual C++ 2010 SP1 Redist(x86) }
{ are installed for the current user }
Result := not IsVcRedistInstalled('14.0', 24215);
end;