summaryrefslogtreecommitdiff
path: root/Modules/Internal/CPack
diff options
context:
space:
mode:
authorJannik Alber <alber.jannik@gmail.com>2022-10-25 22:13:02 +0200
committerBrad King <brad.king@kitware.com>2023-04-28 09:33:28 -0400
commit1d6db661796b2b764e845b7cf6b9f8399037c668 (patch)
tree89f470f1bf4e927cd085952c3bffbeadd23027dc /Modules/Internal/CPack
parent9b0dc652ffc328394e70bf6ee015b50cfefa4125 (diff)
downloadcmake-1d6db661796b2b764e845b7cf6b9f8399037c668.tar.gz
CPack: Add Inno Setup generator
Diffstat (limited to 'Modules/Internal/CPack')
-rw-r--r--Modules/Internal/CPack/ISComponents.pas88
-rw-r--r--Modules/Internal/CPack/ISScript.template.in34
2 files changed, 122 insertions, 0 deletions
diff --git a/Modules/Internal/CPack/ISComponents.pas b/Modules/Internal/CPack/ISComponents.pas
new file mode 100644
index 0000000000..8b5c8b4fc2
--- /dev/null
+++ b/Modules/Internal/CPack/ISComponents.pas
@@ -0,0 +1,88 @@
+{ Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+file Copyright.txt or https://cmake.org/licensing for details. }
+
+function CPackGetCustomInstallationMessage(Param: String): String;
+begin
+ Result := SetupMessage(msgCustomInstallation);
+end;
+
+{ Downloaded components }
+#ifdef CPackDownloadCount
+const
+ NO_PROGRESS_BOX = 4;
+ RESPOND_YES_TO_ALL = 16;
+var
+ CPackDownloadPage: TDownloadWizardPage;
+ CPackShell: Variant;
+
+<event('InitializeWizard')>
+procedure CPackInitializeWizard();
+begin
+ CPackDownloadPage := CreateDownloadPage(SetupMessage(msgWizardPreparing), SetupMessage(msgPreparingDesc), nil);
+ CPackShell := CreateOleObject('Shell.Application');
+end;
+
+<event('NextButtonClick')>
+function CPackNextButtonClick(CurPageID: Integer): Boolean;
+begin
+ if CurPageID = wpReady then
+ begin
+ CPackDownloadPage.Clear;
+ CPackDownloadPage.Show;
+
+#sub AddDownload
+ if WizardIsComponentSelected('{#CPackDownloadComponents[i]}') then
+ #emit "CPackDownloadPage.Add('" + CPackDownloadUrls[i] + "', '" + CPackDownloadArchives[i] + ".zip', '" + CPackDownloadHashes[i] + "');"
+#endsub
+#define i
+#for {i = 0; i < CPackDownloadCount; i++} AddDownload
+#undef i
+
+ try
+ try
+ CPackDownloadPage.Download;
+ Result := True;
+ except
+ if not CPackDownloadPage.AbortedByUser then
+ SuppressibleMsgBox(AddPeriod(GetExceptionMessage), mbCriticalError, MB_OK, IDOK);
+
+ Result := False;
+ end;
+ finally
+ CPackDownloadPage.Hide;
+ end;
+ end else
+ Result := True;
+end;
+
+procedure CPackExtractFile(ArchiveName, FileName: String);
+var
+ ZipFileName: String;
+ ZipFile: Variant;
+ Item: Variant;
+ TargetFolderName: String;
+ TargetFolder: Variant;
+begin
+ TargetFolderName := RemoveBackslashUnlessRoot(ExpandConstant('{tmp}\' + ArchiveName + '\' + ExtractFileDir(FileName)));
+ ZipFileName := ExpandConstant('{tmp}\' + ArchiveName + '.zip');
+
+ if not DirExists(TargetFolderName) then
+ if not ForceDirectories(TargetFolderName) then
+ RaiseException(Format('Target path "%s" cannot be created', [TargetFolderName]));
+
+ ZipFile := CPackShell.NameSpace(ZipFileName);
+ if VarIsClear(ZipFile) then
+ RaiseException(Format('Cannot open ZIP file "%s" or does not exist', [ZipFileName]));
+
+ Item := ZipFile.ParseName(FileName);
+ if VarIsClear(Item) then
+ RaiseException(Format('Cannot find "%s" in "%s" ZIP file', [FileName, ZipFileName]));
+
+ TargetFolder := CPackShell.NameSpace(TargetFolderName);
+ if VarIsClear(TargetFolder) then
+ RaiseException(Format('Target path "%s" does not exist', [TargetFolderName]));
+
+ TargetFolder.CopyHere(Item, NO_PROGRESS_BOX or RESPOND_YES_TO_ALL);
+end;
+
+#endif
diff --git a/Modules/Internal/CPack/ISScript.template.in b/Modules/Internal/CPack/ISScript.template.in
new file mode 100644
index 0000000000..1171058939
--- /dev/null
+++ b/Modules/Internal/CPack/ISScript.template.in
@@ -0,0 +1,34 @@
+; Script generated by the CPack Inno Setup generator.
+; All changes made in this file will be lost when CPack is run again.
+
+@CPACK_INNOSETUP_INCLUDES_INTERNAL@
+
+[Setup]
+@CPACK_INNOSETUP_SETUP_INTERNAL@
+
+[Languages]
+@CPACK_INNOSETUP_LANGUAGES_INTERNAL@
+
+[Dirs]
+@CPACK_INNOSETUP_DIRS_INTERNAL@
+
+[Files]
+@CPACK_INNOSETUP_FILES_INTERNAL@
+
+[Types]
+@CPACK_INNOSETUP_TYPES_INTERNAL@
+
+[Components]
+@CPACK_INNOSETUP_COMPONENTS_INTERNAL@
+
+[Tasks]
+@CPACK_INNOSETUP_TASKS_INTERNAL@
+
+[Icons]
+@CPACK_INNOSETUP_ICONS_INTERNAL@
+
+[Run]
+@CPACK_INNOSETUP_RUN_INTERNAL@
+
+[Code]
+@CPACK_INNOSETUP_CODE_INTERNAL@