CloudCompare_x64_InnoSetup.iss 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. ; Script generated by the Inno Setup Script Wizard.
  2. ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
  3. #define MyAppName "CloudCompare"
  4. #define MyAppVersion "2.14.alpha (XX-XX-2024)"
  5. #define MyAppPublisher "Daniel Girardeau-Montaut"
  6. #define MyAppURL "http://www.cloudcompare.org/"
  7. #define MyAppExeName "CloudCompare.exe"
  8. #define MyVCRedistPath "E:\These\C++\CloudCompare\vc_redist"
  9. #define MyFaroRedistPath "E:\These\C++\Faro\redist"
  10. #define MyFaroRedistExe "FARO LS 2020.0.7.6378 Setup.exe"
  11. #define MyCCPath "E:\These\C++\CloudCompare\new_bin_x64_msvc_2017\CloudCompare"
  12. #define MyOutputDir "E:\These\C++\CloudCompare\new_bin_x64_msvc_2017"
  13. #define MyCreationDate GetDateTimeString('mm_dd_yyyy', '', '')
  14. #define CertificateSubject "Open Source Developer, Daniel Girardeau-Montaut"
  15. [Setup]
  16. ; NOTE: The value of AppId uniquely identifies this application.
  17. ; Do not use the same AppId value in installers for other applications.
  18. ; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
  19. AppID={{4DE0A2C8-03F9-4B3F-BAFC-1D5F2141464B}
  20. AppName={#MyAppName}
  21. AppVersion={#MyAppVersion}
  22. AppVerName={#MyAppName} {#MyAppVersion}
  23. AppPublisher={#MyAppPublisher}
  24. AppPublisherURL={#MyAppURL}
  25. AppSupportURL={#MyAppURL}
  26. AppUpdatesURL={#MyAppURL}
  27. DefaultDirName={pf}\{#MyAppName}
  28. DefaultGroupName={#MyAppName}
  29. UninstallDisplayIcon={app}\{#MyAppExeName}
  30. AllowNoIcons=true
  31. OutputBaseFilename={#MyAppName}_v{#MyAppVersion}_setup_x64
  32. Compression=lzma2/Ultra64
  33. SolidCompression=true
  34. OutputDir={#MyOutputDir}
  35. InternalCompressLevel=Ultra64
  36. ; "ArchitecturesAllowed=x64" specifies that Setup cannot run on
  37. ; anything but x64.
  38. ArchitecturesAllowed=x64
  39. ; "ArchitecturesInstallIn64BitMode=x64" requests that the install be
  40. ; done in "64-bit mode" on x64, meaning it should use the native
  41. ; 64-bit Program Files directory and the 64-bit view of the registry.
  42. ArchitecturesInstallIn64BitMode=x64
  43. ; Installer signing
  44. SignTool=signtool Sign /n "{#CertificateSubject}" /fd sha256 /t http://timestamp.digicert.com $f
  45. [Languages]
  46. Name: "english"; MessagesFile: "compiler:Default.isl"
  47. [Tasks]
  48. Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}";
  49. Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1
  50. ; Warning: update the 'Faro support' checkbox index in the NextButtonClick method if you insert another checkbox above this one!!!
  51. Name: "faro_support" ; Description: "Install Faro I/O plugin (to load FWS/FLS files). The will install Faro LS redistributable package as well." ; GroupDescription: "Faro LS support"; Flags: unchecked
  52. ; Warning: update the 'Python plugin support' checkbox index in the NextButtonClick method if you insert another checkbox above this one!!!
  53. Name: "python_plugin_support" ; Description: "Install the Python and 3DFin plugins" ; GroupDescription: "Python plugin support"; Flags: unchecked
  54. [Files]
  55. Source: "{#MyCCPath}\CloudCompare.exe"; DestDir: "{app}"; Flags: ignoreversion
  56. Source: "{#MyCCPath}\*"; Excludes: "*.manifest,QBRGM*.dll,QFARO*.dll,PythonRuntime.dll,plugins-python,Python"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
  57. ; Unknown dependency support:)
  58. Source: "{#MyVCRedistPath}\vcredist_2013_x64.exe"; DestDir: {tmp}; Flags: deleteafterinstall 64bit;
  59. ; All other Visual Studio dependencies at once: 2015, 2017 and 2019
  60. Source: "{#MyVCRedistPath}\vcredist_all_x64.exe"; DestDir: {tmp}; Flags: deleteafterinstall 64bit;
  61. ; FARO LS support
  62. Source: "{#MyFaroRedistPath}\x64\{#MyFaroRedistExe}"; DestDir: {tmp}; Flags: deleteafterinstall 64bit; Check: WithFaro
  63. Source: "{#MyFaroRedistPath}\x64\{#MyAppExeName}.manifest"; DestDir: "{app}"; Flags: ignoreversion; Check: WithFaro
  64. Source: "{#MyCCPath}\plugins\QFARO*.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion; Check: WithFaro
  65. Source: "{#MyCCPath}\plugins\PythonRuntime.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion; Check: WithPythonPlugin
  66. Source: "{#MyCCPath}\plugins\Python\*"; DestDir: "{app}\plugins\Python"; Flags: ignoreversion recursesubdirs createallsubdirs; Check: WithPythonPlugin
  67. Source: "{#MyCCPath}\plugins-python\*"; DestDir: "{app}\plugins-python"; Flags: ignoreversion recursesubdirs createallsubdirs; Check: WithPythonPlugin
  68. [Icons]
  69. Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
  70. Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
  71. Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon
  72. [Run]
  73. Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
  74. Filename: "{tmp}\vcredist_2013_x64.exe"; Parameters: "/install /quiet /norestart"
  75. Filename: "{tmp}\vcredist_all_x64.exe"; Parameters: "/install /quiet /norestart"
  76. Filename: "{tmp}\{#MyFaroRedistExe}"; Check: WithFaro
  77. [Code]
  78. function InitializeUninstall(): Boolean;
  79. var ErrorCode: Integer;
  80. begin
  81. ShellExec('open','taskkill.exe','/f /im {#MyAppExeName}','',SW_HIDE,ewNoWait,ErrorCode);
  82. ShellExec('open','tskill.exe',' {#MyAppName}','',SW_HIDE,ewNoWait,ErrorCode);
  83. result := True;
  84. end;
  85. var
  86. WithFaroSupport: Boolean;
  87. WithPythonPluginSupport: Boolean;
  88. function WithFaro: Boolean;
  89. begin
  90. Result := WithFaroSupport;
  91. end;
  92. function WithPythonPlugin: Boolean;
  93. begin
  94. Result := WithPythonPluginSupport;
  95. end;
  96. /////////////////////////////////////////////////////////////////////
  97. function GetUninstallString(): String;
  98. var
  99. sUnInstPath: String;
  100. sUnInstallString: String;
  101. begin
  102. sUnInstPath := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{#emit SetupSetting("AppId")}_is1');
  103. sUnInstallString := '';
  104. if not RegQueryStringValue(HKLM, sUnInstPath, 'UninstallString', sUnInstallString) then
  105. RegQueryStringValue(HKCU, sUnInstPath, 'UninstallString', sUnInstallString);
  106. Result := sUnInstallString;
  107. end;
  108. /////////////////////////////////////////////////////////////////////
  109. function IsUpgrade(): Boolean;
  110. begin
  111. Result := (GetUninstallString() <> '');
  112. end;
  113. /////////////////////////////////////////////////////////////////////
  114. function UnInstallOldVersion(): Integer;
  115. var
  116. sUnInstallString: String;
  117. iResultCode: Integer;
  118. begin
  119. // Return Values:
  120. // 1 - uninstall string is empty
  121. // 2 - error executing the UnInstallString
  122. // 3 - successfully executed the UnInstallString
  123. // default return value
  124. Result := 0;
  125. // get the uninstall string of the old app
  126. sUnInstallString := GetUninstallString();
  127. if sUnInstallString <> '' then begin
  128. sUnInstallString := RemoveQuotes(sUnInstallString);
  129. if Exec(sUnInstallString, '/SILENT /NORESTART /SUPPRESSMSGBOXES','', SW_HIDE, ewWaitUntilTerminated, iResultCode) then
  130. Result := 3
  131. else
  132. Result := 2;
  133. end else
  134. Result := 1;
  135. end;
  136. /////////////////////////////////////////////////////////////////////
  137. procedure CurStepChanged(CurStep: TSetupStep);
  138. begin
  139. if (CurStep=ssInstall) then
  140. begin
  141. if (IsUpgrade()) then
  142. begin
  143. UnInstallOldVersion();
  144. end;
  145. end;
  146. end;
  147. /////////////////////////////////////////////////////////////////////
  148. function NextButtonClick(CurPageID: Integer): Boolean;
  149. begin
  150. Result := True;
  151. if (CurPageID = wpSelectTasks) then
  152. begin
  153. //'Faro support' checkbox is the 2nd one but each checkbox is nested
  154. //inside a group, and each group conuts as 1!
  155. WithFaroSupport := WizardForm.TasksList.Checked[3];
  156. //'Python plugin support' checkbox is the 3rd one but each checkbox is nested
  157. //inside a group, and each group conuts as 1!
  158. WithPythonPluginSupport := WizardForm.TasksList.Checked[5];
  159. end;
  160. end;