summaryrefslogtreecommitdiff
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-05-01 15:35:24 +0000
committerKitware Robot <kwrobot@kitware.com>2023-05-01 11:35:46 -0400
commit4bb13d6a5b382cb30d40b21e04d1d4ad6833ac35 (patch)
tree061ec9543c951c941405b4d46c77c1b17784eb8f /Modules
parent139d79409e8939c31ef997c0daef9d9e04553687 (diff)
parent1d6db661796b2b764e845b7cf6b9f8399037c668 (diff)
downloadcmake-4bb13d6a5b382cb30d40b21e04d1d4ad6833ac35.tar.gz
Merge topic 'cpack-inno-setup'
1d6db66179 CPack: Add Inno Setup generator 9b0dc652ff ci: Provide Inno Setup tools to some Windows CI jobs Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !8399
Diffstat (limited to 'Modules')
-rw-r--r--Modules/CPack.cmake24
-rw-r--r--Modules/Internal/CPack/ISComponents.pas88
-rw-r--r--Modules/Internal/CPack/ISScript.template.in34
3 files changed, 139 insertions, 7 deletions
diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake
index f9cf33fa9a..ff1cb7e6fd 100644
--- a/Modules/CPack.cmake
+++ b/Modules/CPack.cmake
@@ -262,8 +262,8 @@ installers. The most commonly-used variables are:
Lists each of the executables and associated text label to be used to
create Start Menu shortcuts. For example, setting this to the list
``ccmake;CMake`` will create a shortcut named "CMake" that will execute the
- installed executable :program:`ccmake`. Not all CPack generators use it (at least
- NSIS, and WIX do).
+ installed executable :program:`ccmake`. Not all CPack generators use it (at least
+ NSIS, Inno Setup and WIX do).
.. variable:: CPACK_STRIP_FILES
@@ -738,14 +738,16 @@ if(NOT CPACK_GENERATOR)
)
endif()
else()
- option(CPACK_BINARY_7Z "Enable to build 7-Zip packages" OFF)
- option(CPACK_BINARY_NSIS "Enable to build NSIS packages" ON)
- option(CPACK_BINARY_NUGET "Enable to build NuGet packages" OFF)
- option(CPACK_BINARY_WIX "Enable to build WiX packages" OFF)
- option(CPACK_BINARY_ZIP "Enable to build ZIP packages" OFF)
+ option(CPACK_BINARY_7Z "Enable to build 7-Zip packages" OFF)
+ option(CPACK_BINARY_NSIS "Enable to build NSIS packages" ON)
+ option(CPACK_BINARY_INNOSETUP "Enable to build Inno Setup packages" OFF)
+ option(CPACK_BINARY_NUGET "Enable to build NuGet packages" OFF)
+ option(CPACK_BINARY_WIX "Enable to build WiX packages" OFF)
+ option(CPACK_BINARY_ZIP "Enable to build ZIP packages" OFF)
mark_as_advanced(
CPACK_BINARY_7Z
CPACK_BINARY_NSIS
+ CPACK_BINARY_INNOSETUP
CPACK_BINARY_NUGET
CPACK_BINARY_WIX
CPACK_BINARY_ZIP
@@ -762,6 +764,7 @@ if(NOT CPACK_GENERATOR)
cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_FREEBSD FREEBSD)
cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_IFW IFW)
cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_NSIS NSIS)
+ cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_INNOSETUP INNOSETUP)
cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_NUGET NuGet)
cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_PRODUCTBUILD productbuild)
cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_RPM RPM)
@@ -869,6 +872,13 @@ if(NOT DEFINED CPACK_DMG_SLA_USE_RESOURCE_FILE_LICENSE
unset(_CPack_CMP0133)
endif()
+# Inno Setup specific variables
+if(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ _cpack_set_default(CPACK_INNOSETUP_ARCHITECTURE "x86")
+elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ _cpack_set_default(CPACK_INNOSETUP_ARCHITECTURE "x64")
+endif()
+
# WiX specific variables
_cpack_set_default(CPACK_WIX_SIZEOF_VOID_P "${CMAKE_SIZEOF_VOID_P}")
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@