Files
annotations/build/installer.iss
T
Alex Bezdieniezhnykh 792abce8c4 small ux fixes
2025-03-04 13:30:13 +02:00

208 lines
6.5 KiB
Plaintext

[Setup]
AppName=Azaion Suite
AppVersion=1.3.2
DefaultDirName={localappdata}\Azaion\Azaion Suite
DefaultGroupName=Azaion Suite
OutputDir=..\
OutputBaseFilename=AzaionSuiteInstaller
SetupIconFile=..\dist\logo.ico
UninstallDisplayName=Azaion Suite
UninstallDisplayIcon={app}\Azaion.Suite.exe
Compression=lzma2/fast
SolidCompression=yes
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Files]
Source: "..\dist\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs;
[Icons]
Name: "{group}\Azaion Suite"; Filename: "{app}\Azaion.Suite.exe"
Name: "{commondesktop}\Azaion Suite"; Filename: "{app}\Azaion.Suite.exe"; Tasks: desktopicon
[Constants]
CUDA12_URL=https://developer.download.nvidia.com/compute/cuda/12.8.0/local_installers/cuda_12.8.0_571.96_windows.exe
CUDNN9_URL=https://developer.download.nvidia.com/compute/cudnn/9.7.1/local_installers/cudnn_9.7.1_windows.exe
function GetEnvironmentVariable(const Name: string): string;
var
Buffer: array[0..2047] of Char;
Size: DWORD;
begin
Size := SizeOf(Buffer) - 1;
if GetEnvironmentVariableW(PChar(Name), Buffer, Size) = 0 then
Result := ''
else
Result := Buffer;
end;
function CheckCUDAGPU(): Boolean;
var
ResultCode: Integer;
Output: string;
GPUInfo: string;
begin
Result := False;
if not Exec('wmic', 'path win32_VideoController get name, caption', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) then
begin
MsgBox('Error checking GPU information.', mbError, MB_OK);
Exit;
end;
Output := GetShellOutput('wmic path win32_VideoController get name, caption');
Output := LowerCase(Output);
if (Pos('nvidia', Output) > 0) or (Pos('amd', Output) > 0) then
Result := True
else
MsgBox('No CUDA-compatible GPU detected. This application requires a CUDA-capable GPU to run.', mbError, MB_OK);
end;
function CheckCUDA12(): Boolean;
var
CUDA_PATH: string;
begin
Result := False;
CUDA_PATH := GetEnvironmentVariable('CUDA_PATH');
if CUDA_PATH <> '' then
Result := True
else
MsgBox('CUDA 12.x is not detected. Please ensure CUDA Toolkit 12.x is installed and CUDA_PATH environment variable is set.', mbError, MB_OK);
end;
function CheckcuDNN9(): Boolean;
var
ResultCode: Integer;
Output: string;
begin
Result := False;
if not Exec('where', 'cudnn*', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) then
begin
MsgBox('Error checking for cuDNN.', mbError, MB_OK);
Exit;
end;
Output := GetShellOutput('where cudnn*');
Output := LowerCase(Output);
if Pos('v9', Output) > 0 then
Result := True
else
MsgBox('cuDNN 9.x is not detected. Please ensure cuDNN 9.x is installed and accessible in your system path.', mbError, MB_OK);
end;
function DownloadFileSilent(const URL, LocalFile: string): Boolean;
var
ResultCode: Integer;
begin
Result := URLDownloadToFile(nil, PChar(URL), PChar(LocalFile), 0, nil) = 0;
if not Result then
MsgBox('Error downloading file from: ' + URL, mbError, MB_OK);
end;
function InstallExecutableSilent(const ExecutablePath: string; const Parameters: string): Boolean;
var
ResultCode: Integer;
begin
Result := Exec(ExecutablePath, Parameters, '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
if not Result then
MsgBox('Error executing: ' + ExecutablePath, mbError, MB_OK);
end;
procedure CurStepChanged(CurStep: TSetupStep);
var
NeedsCUDA12, NeedscuDNN9: Boolean;
CUDA12InstallerURL, cuDNN9InstallerURL, CUDA12InstallerLocal, cuDNN9InstallerLocal: string;
DownloadSuccess, InstallSuccess: Boolean;
begin
if CurStep = ssInstall then
begin
if not CheckCUDAGPU() then
begin
Abort();
Exit;
end;
NeedsCUDA12 := not CheckCUDA12();
NeedscuDNN9 := not CheckcuDNN9();
if NeedsCUDA12 or NeedscuDNN9 then
begin
SuppressMessages(True);
SuppressMovieModalMessages(True);
MsgBox('Required dependencies (CUDA and/or cuDNN) are missing. Installer will attempt to download and install them silently.', mbInformation, MB_OK);
CUDA12InstallerURL := '{const:CUDA12_URL}';
cuDNN9InstallerURL := '{const:CUDNN9_URL}';
CUDA12InstallerLocal := ExpandConstant('{tmp}\cuda_installer.exe');
cuDNN9InstallerLocal := ExpandConstant('{tmp}\cudnn_installer.exe');
if NeedsCUDA12 then
begin
Log('Downloading CUDA 12 installer...');
if DownloadFileSilent(CUDA12InstallerURL, CUDA12InstallerLocal) then
begin
Log('Installing CUDA 12 silently...');
if InstallExecutableSilent(CUDA12InstallerLocal, '-s') then
Log('CUDA 12 installed successfully.')
else
begin
Log('CUDA 12 installation failed.');
MsgBox('CUDA 12 installation failed. Please install CUDA Toolkit 12.x manually and restart the installer.', mbCriticalError, MB_OK);
Abort();
Exit;
end;
else
begin
MsgBox('Failed to download CUDA 12 installer. Please download and install CUDA Toolkit 12.x manually and restart the installer.', mbCriticalError, MB_OK);
Abort();
Exit;
end;
end;
if NeedscuDNN9 then
begin
Log('Downloading cuDNN 9 installer...');
if DownloadFileSilent(cuDNN9InstallerURL, cuDNN9InstallerLocal) then
begin
Log('Installing cuDNN 9 silently...');
if InstallExecutableSilent(cuDNN9InstallerLocal, '-s') then
Log('cuDNN 9 installed successfully.')
else
begin
Log('cuDNN 9 installation failed.');
MsgBox('cuDNN 9 installation failed. Please install cuDNN 9.x manually and restart the installer.', mbCriticalError, MB_OK);
Abort();
Exit;
end;
else
begin
MsgBox('Failed to download cuDNN 9 installer. Please download and install cuDNN 9.x manually and restart the installer.', mbCriticalError, MB_OK);
Abort();
Exit;
end;
end;
SuppressMessages(False);
SuppressMovieModalMessages(False);
if NeedsCUDA12 or NeedscuDNN9 then
begin
MsgBox('CUDA and cuDNN dependencies installation completed.', mbInformation, MB_OK);
if not CheckCUDA12() or not CheckcuDNN9() then
MsgBox('Dependencies installation finished, but still not detected correctly. Please verify your CUDA and cuDNN installation.', mbWarning, MB_OK);
end;
end;
end;
end;
procedure InitializeSetup();
begin
end;
[UninstallRun]