Skip to content

Commit 565a14f

Browse files
Add sample InnoSetup Windows installation file
Since the primary WindowsInstaller.iss is not tracked to allow for differing paths. A sample WindowsInstaller.iss is provided for a template. Any items in brackets <LIKE-THIS> should be replaced the correct data.
1 parent 9c7f106 commit 565a14f

1 file changed

Lines changed: 186 additions & 0 deletions

File tree

WindowsInstaller.iss.sample

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

0 commit comments

Comments
 (0)